| @@ -2,6 +2,8 @@ package com.iformall.controller.basic; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| @@ -49,7 +51,7 @@ public class WxBrandController extends BaseController { | |||
| if (null == wxBrand) { | |||
| wxBrand = new WxBrand(); | |||
| } | |||
| wxBrand.updateTenantInfo(getTenantInfo()); | |||
| wxBrand.setTenantId(getTenantInfo().getFinalTenantId()); | |||
| wxBrand.setSortColumns(BaseEntity.SortField.Id_DESC); | |||
| final PageInfo<WxBrand> page = wxBrandService.listAsPage(wxBrand, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -59,20 +61,24 @@ public class WxBrandController extends BaseController { | |||
| @SystemControllerLog(description = "品牌-增加") | |||
| public ResultData add(@RequestBody WxBrand wxBrand) { | |||
| logger.debug("[" + getIpAddr() + "] WxBrandController::add"); | |||
| wxBrand.updateTenantInfo(getTenantInfo()); | |||
| wxBrand.setTenantId(getTenantInfo().getFinalTenantId()); | |||
| return wxBrandService.save(wxBrand); | |||
| } | |||
| @TenantIgnore | |||
| @PostMapping("update") | |||
| @SystemControllerLog(description = "品牌-更新") | |||
| public ResultData update(@RequestBody WxBrand wxBrand) { | |||
| logger.debug("[" + getIpAddr() + "] WxBrandController::update"); | |||
| wxBrand.updateTenantInfo(getTenantInfo()); | |||
| if(wxBrand.getId() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| if(EnumDelFlag.YES.getCode().equals(wxBrand.getIsDel())){ | |||
| //判断是否解绑商户 | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(wxBrand); | |||
| // wxMerchant.updateTenantInfo(wxBrand); | |||
| wxMerchant.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| wxMerchant.setBrand(wxBrand.getId()); | |||
| @@ -118,10 +124,10 @@ public class WxBrandController extends BaseController { | |||
| public ResultData hasBrand(String name, Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBrandController::hasBrand"); | |||
| WxBrand wxBrand = new WxBrand(); | |||
| wxBrand.updateTenantInfo(getTenantInfo()); | |||
| wxBrand.setId(id); | |||
| wxBrand.setTenantId(getTenantInfo().getFinalTenantId()); | |||
| wxBrand.setName(name); | |||
| wxBrand.setId(id); | |||
| return wxBrandService.hasBrand(wxBrand); | |||
| } | |||
| @@ -22,6 +22,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "mall_permission", | |||
| "mall_sale_type", | |||
| "mall_user_role", | |||
| "wx_brand", | |||
| "wx_channel", | |||
| "wx_business", | |||
| "wx_sub_business", | |||
| @@ -74,6 +75,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_mall", | |||
| "wx_appinfo", | |||
| "wx_authorizer_info", | |||
| "wx_brand", | |||
| "wx_c_user", | |||
| "tt_c_user", | |||
| "wx_user_visit", | |||
| @@ -0,0 +1,4 @@ | |||
| --历史品牌数据 | |||
| UPDATE `mallink`.`wx_brand` SET `tenant_id` = `parent_tenant_id` WHERE `parent_tenant_id` is not null and `parent_tenant_id` != ''; | |||
| UPDATE `mallink`.`wx_brand` SET `parent_tenant_id` = null; | |||
| @@ -23,6 +23,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "mall_permission", | |||
| "mall_sale_type", | |||
| "mall_user_role", | |||
| "wx_brand", | |||
| "wx_channel", | |||
| "wx_business", | |||
| "wx_coupon_type", | |||
| @@ -62,6 +63,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_mall", | |||
| "wx_appinfo", | |||
| "wx_authorizer_info", | |||
| "wx_brand", | |||
| "wx_c_user", | |||
| "tt_c_user", | |||
| "wx_user_visit", | |||
| @@ -23,6 +23,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "mall_permission", | |||
| "mall_sale_type", | |||
| "mall_user_role", | |||
| "wx_brand", | |||
| "wx_channel", | |||
| "wx_business", | |||
| "wx_coupon_type", | |||
| @@ -67,6 +68,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_mall", | |||
| "wx_appinfo", | |||
| "wx_authorizer_info", | |||
| "wx_brand", | |||
| "wx_c_user", | |||
| "tt_c_user", | |||
| "wx_user_visit", | |||
| @@ -23,6 +23,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "mall_permission", | |||
| "mall_sale_type", | |||
| "mall_user_role", | |||
| "wx_brand", | |||
| "wx_channel", | |||
| "wx_business", | |||
| "wx_coupon_type", | |||
| @@ -67,6 +68,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_mall", | |||
| "wx_appinfo", | |||
| "wx_authorizer_info", | |||
| "wx_brand", | |||
| "wx_c_user", | |||
| "tt_c_user", | |||
| "wx_user_visit", | |||
| @@ -101,7 +101,7 @@ public class WxBrandServiceImpl implements WxBrandService { | |||
| @Override | |||
| public List<Map<String,Object>> queryBrand(TenantEntity tenantEntity) { | |||
| WxBrand wxBrand = new WxBrand(); | |||
| wxBrand.updateTenantInfo(tenantEntity); | |||
| wxBrand.setTenantId(tenantEntity.getFinalTenantId()); | |||
| return wxBrandMapper.queryBrandByTenant(wxBrand); | |||
| } | |||
| @@ -115,7 +115,7 @@ public class WxBrandServiceImpl implements WxBrandService { | |||
| @Override | |||
| public Map<Long, WxBrand> getAllMap(TenantEntity tenantEntity) { | |||
| WxBrand brandQ = new WxBrand(); | |||
| brandQ.updateTenantInfo(tenantEntity); | |||
| brandQ.setTenantId(tenantEntity.getFinalTenantId()); | |||
| List<WxBrand> brandList = wxBrandMapper.findList(brandQ); | |||
| Map<Long,WxBrand> map = new HashMap<Long,WxBrand>(); | |||
| if (null != brandList) { | |||
| @@ -2,6 +2,8 @@ package com.iformall.controller.basic; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.annotation.TenantIgnore; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| @@ -9,6 +11,7 @@ import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.WxBrand; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.enums.EnumDelFlag; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.service.WxBrandService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -48,7 +51,7 @@ public class WxBrandController extends BaseController { | |||
| if (null == wxBrand) { | |||
| wxBrand = new WxBrand(); | |||
| } | |||
| wxBrand.updateTenantInfo(getTenantInfo()); | |||
| wxBrand.setTenantId(getTenantInfo().getFinalTenantId()); | |||
| wxBrand.setSortColumns(BaseEntity.SortField.Id_DESC); | |||
| final PageInfo<WxBrand> page = wxBrandService.listAsPage(wxBrand, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -58,22 +61,26 @@ public class WxBrandController extends BaseController { | |||
| @SystemControllerLog(description = "品牌-增加") | |||
| public ResultData add(@RequestBody WxBrand wxBrand) { | |||
| logger.debug("[" + getIpAddr() + "] WxBrandController::add"); | |||
| wxBrand.updateTenantInfo(getTenantInfo()); | |||
| wxBrand.setTenantId(getTenantInfo().getFinalTenantId()); | |||
| return wxBrandService.save(wxBrand); | |||
| } | |||
| @TenantIgnore | |||
| @PostMapping("update") | |||
| @SystemControllerLog(description = "品牌-更新") | |||
| public ResultData update(@RequestBody WxBrand wxBrand) { | |||
| logger.debug("[" + getIpAddr() + "] WxBrandController::update"); | |||
| wxBrand.updateTenantInfo(getTenantInfo()); | |||
| if(wxBrand.getId() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| if(EnumDelFlag.YES.getCode().equals(wxBrand.getIsDel())){ | |||
| //判断是否解绑商户 | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.setIsDel(0); | |||
| // wxMerchant.updateTenantInfo(wxBrand); | |||
| wxMerchant.setIsDel(EnumYesOrNo.NO.getCode()); | |||
| wxMerchant.setBrand(wxBrand.getId()); | |||
| wxMerchant.updateTenantInfo(wxBrand); | |||
| List<WxMerchant> merchantList = wxMerchantService.findList(wxMerchant); | |||
| if(CollectionUtils.isNotEmpty(merchantList)){ | |||
| @@ -117,9 +124,10 @@ public class WxBrandController extends BaseController { | |||
| public ResultData hasBrand(String name, Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBrandController::hasBrand"); | |||
| WxBrand wxBrand = new WxBrand(); | |||
| wxBrand.updateTenantInfo(getTenantInfo()); | |||
| wxBrand.setName(name); | |||
| wxBrand.setId(id); | |||
| wxBrand.setTenantId(getTenantInfo().getFinalTenantId()); | |||
| wxBrand.setName(name); | |||
| return wxBrandService.hasBrand(wxBrand); | |||
| } | |||