修改值问题
This commit is contained in:
@@ -21,7 +21,7 @@ import java.util.stream.Collectors;
|
||||
* @since 2025-02-19
|
||||
*/
|
||||
@Service
|
||||
public class ShopExtendServiceImpl extends ServiceImpl<ShopExtendMapper, ShopExtend> implements ShopExtendService{
|
||||
public class ShopExtendServiceImpl extends ServiceImpl<ShopExtendMapper, ShopExtend> implements ShopExtendService {
|
||||
private final static Map<String, String> KEY_MAP = Map.of(
|
||||
"index_bg", "首页",
|
||||
"my_bg", "我的页面背景图",
|
||||
@@ -36,8 +36,11 @@ public class ShopExtendServiceImpl extends ServiceImpl<ShopExtendMapper, ShopExt
|
||||
}
|
||||
|
||||
BeanUtil.copyProperties(shopExtendDTO, shopExtend);
|
||||
shopExtend.setAutoKey(null);
|
||||
return update(shopExtend, new QueryWrapper().eq(ShopExtend::getShopId, shopId).eq(ShopExtend::getAutoKey, shopExtendDTO.getAutokey()));
|
||||
if (shopExtendDTO.getValue() == null) {
|
||||
shopExtend.setValue(null);
|
||||
}
|
||||
mapper.updateByQuery(shopExtend, false, new QueryWrapper().eq(ShopExtend::getShopId, shopId).eq(ShopExtend::getAutoKey, shopExtendDTO.getAutokey()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,7 +56,7 @@ public class ShopExtendServiceImpl extends ServiceImpl<ShopExtendMapper, ShopExt
|
||||
|
||||
public List<ShopExtend> checkAndInitialize(List<ShopExtend> shopExtendList, long shopId) {
|
||||
List<ShopExtend> newRecords = new ArrayList<>();
|
||||
List<String> requiredAutoKeys = Arrays.asList("index_bg", "my_bg", "member_bg", "shopinfo_bg","ticket_logo");
|
||||
List<String> requiredAutoKeys = Arrays.asList("index_bg", "my_bg", "member_bg", "shopinfo_bg", "ticket_logo");
|
||||
|
||||
if (shopExtendList.isEmpty()) {
|
||||
for (String key : requiredAutoKeys) {
|
||||
@@ -61,7 +64,7 @@ public class ShopExtendServiceImpl extends ServiceImpl<ShopExtendMapper, ShopExt
|
||||
newRecord.initAutoKey(key, shopId);
|
||||
newRecords.add(newRecord);
|
||||
}
|
||||
mapper.insertBatchSelective(newRecords,50);
|
||||
mapper.insertBatchSelective(newRecords, 50);
|
||||
return newRecords;
|
||||
} else {
|
||||
for (ShopExtend shopExtend : shopExtendList) {
|
||||
@@ -98,7 +101,7 @@ public class ShopExtendServiceImpl extends ServiceImpl<ShopExtendMapper, ShopExt
|
||||
}
|
||||
|
||||
if (!newRecords.isEmpty()) {
|
||||
mapper.insertBatchSelective(newRecords,50);
|
||||
mapper.insertBatchSelective(newRecords, 50);
|
||||
}
|
||||
|
||||
shopExtendList.addAll(newRecords);
|
||||
|
||||
Reference in New Issue
Block a user