diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index 267892459..e917d6345 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -307,22 +307,24 @@ public class WxMerchantServiceImpl implements WxMerchantService { if (shopidlist.isEmpty()) { return new ResultData(ErrorCode.SHOP_NOT_SELECTED); } - //先检查是否存在已出租的商铺 + + //更新商铺 for (long shopid : shopidlist) { WxShop shop = wxShopMapper.selectByPrimaryKey(shopid); if (shop.getStatus().equals(EnumShopStatus.RENT.getCode())) { return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shop.getShopNumber() + " 已出租"); } - } - //更新商铺 - for (long shopid : shopidlist) { + WxMerchantShop wxMerchantShop = new WxMerchantShop(); + wxMerchantShop.setShopId(shopid); + wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); + int count = wxMerchantShopMapper.selectCount(wxMerchantShop); + if (count > 0) { + return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shop.getShopNumber() + " 已出租"); + } //更新商铺状态 - WxShop shop = new WxShop(); - shop.setId(shopid); shop.setStatus(EnumShopStatus.RENT.getCode()); wxShopMapper.updateByPrimaryKeySelective(shop); //关联表插入 - WxMerchantShop wxMerchantShop = new WxMerchantShop(); wxMerchantShop.setId(idWorker.nextId()); wxMerchantShop.setMerchantId(merchantId); wxMerchantShop.setTenantId(wxMerchant.getTenantId());