feat:旗舰店

This commit is contained in:
苏竹红
2025-11-28 15:40:57 +08:00
parent 7a10dc6bf7
commit 23eb77a317
2 changed files with 17 additions and 1 deletions

View File

@@ -52,7 +52,10 @@ public class ShopInfoDAO {
if(CollectionUtils.isEmpty(shopInfoList)){
return CommonConstants.ZERO;
}
shopInfoList.forEach(v -> v.setStoreId(UUIDUtils.get32UUID()));
for (ShopInfoDO shopInfo : shopInfoList) {
validateShopName(shopInfo.getShopName());
shopInfo.setStoreId(UUIDUtils.get32UUID());
}
return shopInfoMapper.batchAddShop(shopInfoList);
}
@@ -112,6 +115,7 @@ public class ShopInfoDAO {
* @return
*/
public Long addShopInfo(ShopInfoDO shopInfo){
validateShopName(shopInfo.getShopName());
shopInfo.setStoreId(UUIDUtils.get32UUID());
shopInfoMapper.insertSelective(shopInfo);
return shopInfo.getId();
@@ -122,6 +126,7 @@ public class ShopInfoDAO {
log.info("店铺为空 或者店铺id为空");
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
validateShopName(shopInfo.getShopName());
return shopInfoMapper.updateByPrimaryKeySelective(shopInfo);
}
@@ -377,4 +382,14 @@ public class ShopInfoDAO {
public List<ShopInfoDO> getPushHqtShopList(){
return shopInfoMapper.getPushHqtShopList();
}
/**
* 校验名称 不能包含旗舰二字
* @param shopName
*/
private void validateShopName(String shopName) {
if (StringUtils.isNotBlank(shopName) && shopName.contains("旗舰")) {
throw new ServiceException(ErrorCodeEnum.SHOP_NAME_INVALID);
}
}
}