|
|
|
@@ -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); |
|
|
|
} |
|
|
|
|
|
|
|
|