|
|
|
@@ -13,7 +13,6 @@ import com.iformall.enums.EnumDelStatus; |
|
|
|
import com.iformall.enums.EnumRentShopType; |
|
|
|
import com.iformall.enums.EnumShopStatus; |
|
|
|
import com.iformall.enums.EnumUserAdmin; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.mapper.WxMerchantShopMapper; |
|
|
|
import com.iformall.mapper.WxShopMapper; |
|
|
|
import com.iformall.service.ExcelService; |
|
|
|
@@ -80,14 +79,14 @@ public class WxShopServiceImpl implements WxShopService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void deleteById(Long id, Integer isAdmin) { |
|
|
|
public ResultData deleteById(Long id, Integer isAdmin) { |
|
|
|
//1、已出租不让删除 |
|
|
|
WxShop wxShop = wxShopMapper.selectByPrimaryKey(id); |
|
|
|
if (wxShop == null) { |
|
|
|
throw new MallinkException(ErrorCode.SHOP_IS_NOT_FOUND); |
|
|
|
return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND); |
|
|
|
} |
|
|
|
if (wxShop.getStatus().equals(EnumShopStatus.RENT.getCode())) { |
|
|
|
throw new MallinkException(ErrorCode.SHOP_BAN_DELETED); |
|
|
|
return new ResultData(ErrorCode.SHOP_BAN_DELETED); |
|
|
|
} |
|
|
|
//2、是否关联过商户 |
|
|
|
WxMerchantShop wxMerchantShop = new WxMerchantShop(); |
|
|
|
@@ -97,7 +96,7 @@ public class WxShopServiceImpl implements WxShopService { |
|
|
|
int count = wxMerchantShops.size(); |
|
|
|
if (count > 0) { |
|
|
|
if (!isAdmin.equals(EnumUserAdmin.ADMIN.getCode())) { |
|
|
|
throw new MallinkException(ErrorCode.SHOP_DELETED_BY_ADMIN); |
|
|
|
return new ResultData(ErrorCode.SHOP_DELETED_BY_ADMIN); |
|
|
|
} |
|
|
|
//更新标记 |
|
|
|
wxShop.setIsDel(EnumDelStatus.DEL.getCode()); |
|
|
|
@@ -108,8 +107,11 @@ public class WxShopServiceImpl implements WxShopService { |
|
|
|
updateMerchantShop.setIsDel(EnumDelStatus.DEL.getCode()); |
|
|
|
wxMerchantShopMapper.updateByPrimaryKeySelective(updateMerchantShop); |
|
|
|
} |
|
|
|
} else { |
|
|
|
//无关联商铺直接删除 |
|
|
|
wxShopMapper.deleteByPrimaryKey(id); |
|
|
|
} |
|
|
|
wxShopMapper.deleteByPrimaryKey(id); |
|
|
|
return new ResultData(Result.SUCCESS, "删除成功"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|