| @@ -6,10 +6,13 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxBrand; | import com.iformall.domain.po.WxBrand; | ||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.service.WxBrandService; | import com.iformall.service.WxBrandService; | ||||
| import com.iformall.service.WxMerchantService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.collections.CollectionUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -30,6 +33,8 @@ public class WxBrandController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxBrandService wxBrandService; | private WxBrandService wxBrandService; | ||||
| @Autowired | |||||
| private WxMerchantService wxMerchantService; | |||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @@ -60,6 +65,19 @@ public class WxBrandController extends BaseController { | |||||
| public ResultData update(@RequestBody WxBrand wxBrand) { | public ResultData update(@RequestBody WxBrand wxBrand) { | ||||
| logger.debug("[" + getIpAddr() + "] WxBrandController::update"); | logger.debug("[" + getIpAddr() + "] WxBrandController::update"); | ||||
| wxBrand.setTenantId(getTenantId()); | wxBrand.setTenantId(getTenantId()); | ||||
| if(wxBrand.getIsDel().equals(1)){ | |||||
| //判断是否解绑商户 | |||||
| WxMerchant wxMerchant = new WxMerchant(); | |||||
| wxMerchant.setTenantId(wxBrand.getTenantId()); | |||||
| wxMerchant.setIsDel(0); | |||||
| wxMerchant.setBrand(wxBrand.getId()); | |||||
| List<WxMerchant> merchantList = wxMerchantService.findList(wxMerchant); | |||||
| if(CollectionUtils.isNotEmpty(merchantList)){ | |||||
| return new ResultData(Result.ERROR, "您有未解绑的商户,请先解绑。"); | |||||
| } | |||||
| } | |||||
| return wxBrandService.update(wxBrand); | return wxBrandService.update(wxBrand); | ||||
| } | } | ||||
| @@ -0,0 +1,2 @@ | |||||
| alter table wx_merchant | |||||
| add column `is_del` SMALLINT(1) DEFAULT 0 COMMENT '是否删除1是0否'; | |||||
| @@ -175,6 +175,10 @@ public class WxMerchant extends BaseEntity { | |||||
| @Transient | @Transient | ||||
| private WxProfitSharingReceiver wxProfitSharingReceiver; | private WxProfitSharingReceiver wxProfitSharingReceiver; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = " ") | |||||
| private Integer isDel; | |||||
| @Override | @Override | ||||
| public String getSortColumns() { | public String getSortColumns() { | ||||
| super.setSortColumns(this.sortColumns); | super.setSortColumns(this.sortColumns); | ||||
| @@ -43,6 +43,14 @@ public interface WxMerchantService { | |||||
| */ | */ | ||||
| List<WxMerchant> etcpList(WxMerchant record); | List<WxMerchant> etcpList(WxMerchant record); | ||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| List<WxMerchant> findList(WxMerchant record); | |||||
| /** | /** | ||||
| * 查询商户列表 | * 查询商户列表 | ||||
| * @param tenantId | * @param tenantId | ||||
| @@ -148,6 +148,11 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| return wxMerchantMapper.findList(record); | return wxMerchantMapper.findList(record); | ||||
| } | } | ||||
| @Override | |||||
| public List<WxMerchant> findList(WxMerchant record) { | |||||
| return wxMerchantMapper.findList(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public List<WxMerchantSimpleVo> findList(String tenantId) { | public List<WxMerchantSimpleVo> findList(String tenantId) { | ||||
| WxMerchant wxMerchant = new WxMerchant(); | WxMerchant wxMerchant = new WxMerchant(); | ||||
| @@ -27,12 +27,14 @@ | |||||
| <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/> | <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/> | ||||
| <result column="introduction" jdbcType="VARCHAR" property="introduction"/> | <result column="introduction" jdbcType="VARCHAR" property="introduction"/> | ||||
| <result column="action_desc" jdbcType="VARCHAR" property="actionDesc"/> | <result column="action_desc" jdbcType="VARCHAR" property="actionDesc"/> | ||||
| <result column="is_del" property="isDel"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`, | `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`, | ||||
| `business_id`,`sub_business_id`,`shop_type`,`brand`,`type`,`is_public`,email,`title`,`cover_picture`,`is_admin`,`bill_setting`,`qr_code`, | `business_id`,`sub_business_id`,`shop_type`,`brand`,`type`,`is_public`,email,`title`,`cover_picture`,`is_admin`,`bill_setting`,`qr_code`, | ||||
| `introduction`,`action_desc` | |||||
| `introduction`,`action_desc`,is_del | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -99,6 +101,9 @@ | |||||
| <if test=" null != isAdmin "> | <if test=" null != isAdmin "> | ||||
| and `is_admin` = #{isAdmin} | and `is_admin` = #{isAdmin} | ||||
| </if> | </if> | ||||
| <if test=" null != isDel "> | |||||
| and `is_del` = #{isDel} | |||||
| </if> | |||||
| <if test=" null != rentShopType "> | <if test=" null != rentShopType "> | ||||
| and id not in( | and id not in( | ||||
| select merchant_id from wx_rent_contract where tenant_id=#{tenantId} and rent_shop_type=1 and merchant_id is | select merchant_id from wx_rent_contract where tenant_id=#{tenantId} and rent_shop_type=1 and merchant_id is | ||||