余额开关根据模块影响

This commit is contained in:
张松
2025-10-24 09:54:57 +08:00
parent bc14da11f5
commit d1acc9da71
5 changed files with 9 additions and 7 deletions

View File

@@ -61,7 +61,7 @@ public class FreeDineConfigServiceImpl extends ServiceImpl<FreeDineConfigMapper,
config.setShopIdList(JSONArray.toJSONString(freeDineConfigEditDTO.getShopIdList()));
}
shopConfigService.editStatusByShopIdList(config.getShopId(), freeDineConfigEditDTO.getEnable() ? 1 : 0, ShopConfig::getIsAccountPay, freeDineConfigEditDTO.getUseShopType(), freeDineConfigEditDTO.getShopIdList());
shopConfigService.editStatusByShopIdList(config.getShopId(), freeDineConfigEditDTO.getEnable() ? 1 : 0,true, ShopConfig::getIsAccountPay, freeDineConfigEditDTO.getUseShopType(), freeDineConfigEditDTO.getShopIdList());
if (freeDineConfigEditDTO.getUseType() != null) {
config.setUseType(JSONObject.toJSONString(freeDineConfigEditDTO.getUseType()));
}

View File

@@ -41,7 +41,7 @@ public class ShopConfigServiceImpl extends ServiceImpl<ShopConfigMapper, ShopCon
@Override
public <T> void editStatusByShopIdList(Long mainShopId, Integer isEnable, LambdaGetter<T> property, String useShopType, List<Long> shopIdList) {
public <T> void editStatusByShopIdList(Long mainShopId, Integer isEnable, boolean onyUpValid, LambdaGetter<T> property, String useShopType, List<Long> shopIdList) {
ShopConfig shopConfig = getOne(new QueryWrapper().eq(ShopConfig::getId, mainShopId));
if (shopConfig == null) {
shopConfig = new ShopConfig();
@@ -56,7 +56,7 @@ public class ShopConfigServiceImpl extends ServiceImpl<ShopConfigMapper, ShopCon
});
}
if (isEnable == 0) {
if (isEnable == 0 && !onyUpValid) {
updateChain().or(or -> {
or.eq(ShopConfig::getMainId, mainShopId);
}).or(or -> {
@@ -73,7 +73,9 @@ public class ShopConfigServiceImpl extends ServiceImpl<ShopConfigMapper, ShopCon
if (shopIdList.isEmpty()) {
updateChain().eq(ShopConfig::getMainId, mainShopId).set(property, 1).update();
}else {
updateChain().notIn(ShopConfig::getId, shopIdList).set(property, 0).update();
if (!onyUpValid) {
updateChain().notIn(ShopConfig::getId, shopIdList).set(property, 0).update();
}
updateChain().in(ShopConfig::getId, shopIdList).set(property, 1).update();
}
}