优化店铺初始化方法

This commit is contained in:
zhangchenbiao
2024-05-21 14:24:43 +08:00
parent d011fad63f
commit 5d6c5573cc

View File

@@ -54,8 +54,13 @@ public class ShopServiceImpl implements ShopService {
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
Integer wantShopNum = lineInfo.getWantShopNum();
List<ShopInfoDO> shopList = shopInfoDAO.getShopList(lineInfo.getId());
int shopSize = shopList.size();
if(shopSize >= wantShopNum){
return 0;
}
List<ShopInfoDO> addShopList = new ArrayList<>();
for (int i = 0; i < wantShopNum; i++) {
for (int i = shopSize; i < wantShopNum; i++) {
ShopInfoDO shopInfo = new ShopInfoDO();
shopInfo.setRegionId(lineInfo.getRegionId());
shopInfo.setLineId(lineInfo.getId());