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