多店铺需求

This commit is contained in:
Tankaikai 2025-04-07 17:13:18 +08:00
parent 4c99688c59
commit 91ec453948
2 changed files with 11 additions and 3 deletions

View File

@ -295,5 +295,10 @@ public class ShopInfo implements Serializable {
*/
@Column(ignore = true)
private Integer isAccountPay;
/**
* 主店名称
*/
@Column(ignore = true)
private String headShopName;
}

View File

@ -113,11 +113,14 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
if (status != null) {
queryWrapper.eq(ShopInfo::getStatus, status);
}
List<ShopInfo> shopAllList = getMapper().selectListByQuery(query().select(ShopInfo::getId, ShopInfo::getShopName));
Map<Long, String> shopKv = shopAllList.stream().collect(Collectors.toMap(ShopInfo::getId, ShopInfo::getShopName));
queryWrapper.orderBy(ShopInfo::getCreateTime, false);
Page<ShopInfo> page = page(new Page<>(pageDTO.page(), pageDTO.size()), queryWrapper);
page.getRecords().forEach(shopInfo -> {
ShopConfig shopConfig = shopConfigService.getById(shopInfo.getId());
BeanUtil.copyProperties(shopConfig, shopInfo);
shopInfo.setHeadShopName(shopKv.get(shopInfo.getMainId()));
});
return page;
}
@ -146,7 +149,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
// 如果店铺类型是单店是否主店要设为否
if (ShopTypeEnum.ONLY.getValue().equals(shopInfoAddDTO.getShopType())) {
shopInfoAddDTO.setIsHeadShop(YesNoEnum.NO.value());
if(shopInfoAddDTO.getMainId() != null) {
if (shopInfoAddDTO.getMainId() != null) {
throw new CzgException("单店不允许设置主店ID");
}
} else {
@ -367,8 +370,8 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
List<ShopInfo> branchList = mapper.selectListByQuery(query().select(ShopInfo::getId, ShopInfo::getShopName).eq(ShopInfo::getMainId, shopId).orderBy(ShopInfo::getId, true));
for (ShopInfo info : branchList) {
ShopBranchSelectDTO branch = new ShopBranchSelectDTO();
head.setShopId(info.getId());
head.setShopName(info.getShopName());
branch.setShopId(info.getId());
branch.setShopName(info.getShopName());
list.add(branch);
}
return list;