Browse Source

[商铺][修改][删除商铺]

release_toaliyun_real
gongbiao 7 years ago
parent
commit
548b530ae7
4 changed files with 41 additions and 11 deletions
  1. +2
    -0
      mallinkAdmin/src/main/resources/db/migration/V201904031030__UPDATE_WX_SHOP.sql
  2. +11
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxShop.java
  3. +16
    -3
      mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java
  4. +12
    -8
      mallinkService/src/main/resources/mapper/WxShopMapper.xml

+ 2
- 0
mallinkAdmin/src/main/resources/db/migration/V201904031030__UPDATE_WX_SHOP.sql View File

@@ -0,0 +1,2 @@
ALTER TABLE `wx_shop`
ADD COLUMN `is_del` smallint(2) DEFAULT 0 COMMENT '是否删除1是0否';

+ 11
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxShop.java View File

@@ -126,6 +126,17 @@ public class WxShop implements Serializable {
@io.swagger.annotations.ApiModelProperty(value = "邮箱", name = "email")
private String email;

@io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = " ")
private Integer isDel;

public Integer getIsDel() {
return isDel;
}

public void setIsDel(Integer isDel) {
this.isDel = isDel;
}

public String getEmail() {
return email;
}


+ 16
- 3
mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java View File

@@ -9,6 +9,7 @@ import com.iformall.common.ResultData;
import com.iformall.domain.po.WxMerchantShop;
import com.iformall.domain.po.WxShop;
import com.iformall.domain.vo.WxShopVo;
import com.iformall.enums.EnumDelStatus;
import com.iformall.enums.EnumRentShopType;
import com.iformall.enums.EnumShopStatus;
import com.iformall.enums.EnumUserAdmin;
@@ -91,10 +92,22 @@ public class WxShopServiceImpl implements WxShopService {
//2、是否关联过商户
WxMerchantShop wxMerchantShop = new WxMerchantShop();
wxMerchantShop.setShopId(wxShop.getId());
int count = wxMerchantShopMapper.selectCount(wxMerchantShop);
List<WxMerchantShop> wxMerchantShops = wxMerchantShopMapper.select(wxMerchantShop);
//有关联过商户必须是管理员才能删除
if (count > 0 && !isAdmin.equals(EnumUserAdmin.ADMIN.getCode())) {
throw new MallinkException(ErrorCode.SHOP_DELETED_BY_ADMIN);
int count = wxMerchantShops.size();
if (count > 0) {
if (!isAdmin.equals(EnumUserAdmin.ADMIN.getCode())) {
throw new MallinkException(ErrorCode.SHOP_DELETED_BY_ADMIN);
}
//更新标记
wxShop.setIsDel(EnumDelStatus.DEL.getCode());
wxShopMapper.updateByPrimaryKeySelective(wxShop);
//关联表
for (int i = 0; i < count; i++) {
WxMerchantShop updateMerchantShop = wxMerchantShops.get(i);
updateMerchantShop.setIsDel(EnumDelStatus.DEL.getCode());
wxMerchantShopMapper.updateByPrimaryKeySelective(updateMerchantShop);
}
}
wxShopMapper.deleteByPrimaryKey(id);
}


+ 12
- 8
mallinkService/src/main/resources/mapper/WxShopMapper.xml View File

@@ -25,16 +25,18 @@
<result column="point_type" jdbcType="INTEGER" property="pointType"/>
<result column="comments" jdbcType="VARCHAR" property="comments"/>
<result column="email" property="email"/>
<result column="is_del" jdbcType="INTEGER" property="isDel"/>

</resultMap>

<sql id="allColumns">
`id`,`tenant_id`,`shop_number`,`build_area`,`operation_area`,`building`,
`floor`,`status`,`x`,`y`,`addr`,`baidu_poi`,`longitude`,`latitude`,`create_date`,
`update_date`,`img_url`,`manager`,`manager_phone`,`type`,`point_type`,`comments`,email
`update_date`,`img_url`,`manager`,`manager_phone`,`type`,`point_type`,`comments`,email,`is_del`
</sql>

<sql id="dynamicWhereConditions">
where 1 = 1
where is_del=0

<if test=" null != id ">
and `id` = #{id}
@@ -132,6 +134,7 @@
<if test=" null != email ">
and `email` = #{email}
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -160,7 +163,7 @@
left join wx_merchant m on ms.merchant_id=m.id
left join wx_mall_building b on s.building=b.id
left join wx_mall_floor f on s.floor=f.id
where 1 = 1
where is_del=0

<if test=" null != id ">
and s.`id` = #{id}
@@ -322,7 +325,7 @@
left join wx_mall_floor f on s.floor=f.id
left join wx_business bus on m.business_id = bus.id
left join wx_brand brand on m.brand = brand.id
where 1 = 1
where s.is_del=0

<if test=" null != id ">
and s.`id` = #{id}
@@ -442,12 +445,12 @@
from wx_merchant_shop ms inner join wx_merchant m on ms.merchant_id=m.id
inner join wx_shop s on ms.shop_id=s.id
inner join wx_rent_contract c on ms.merchant_id=c.merchant_id
where ms.tenant_id=#{tenantId} and ms.shop_id=#{shopId} and ms.is_del=0
where ms.tenant_id=#{tenantId} and ms.shop_id=#{shopId} and ms.is_del=0 and s.is_del=0
</select>
<select id="queryShopLeftInfo" resultType="hashmap" parameterType="hashmap">
select count(id) shopcount,IFNULL(sum(build_area),0) area from wx_shop
where tenant_id=#{tenantId} and status=#{status}
where tenant_id=#{tenantId} and status=#{status} and is_del=0
</select>

<select id="listShopFromContract" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
@@ -460,7 +463,7 @@
left join wx_merchant m on ms.merchant_id=m.id
left join wx_mall_building b on s.building=b.id
left join wx_mall_floor f on s.floor=f.id
where 1=1 and ms.is_del=0
where s.is_del=0 and ms.is_del=0
and s.tenant_id=#{tenantId}
<if test=" null != status">
and s.`status` = #{status}
@@ -483,7 +486,8 @@
<select id="hasShopNumber" parameterType="com.iformall.domain.po.WxShop" resultType="Integer">
select count(*) from wx_shop where tenant_id=#{tenantId} and shop_number=#{shopNumber} and `type`=#{type}
select count(*) from wx_shop where tenant_id=#{tenantId} and shop_number=#{shopNumber} and `type`=#{type} and
is_del=0
<if test=" null != id">
and id != #{id}
</if>


Loading…
Cancel
Save