|
|
@@ -3,13 +3,16 @@ package shop.alien.store.service.impl;
|
|
|
import com.alibaba.excel.util.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import shop.alien.entity.store.StoreDictionary;
|
|
|
import shop.alien.entity.store.StoreMenu;
|
|
|
import shop.alien.entity.store.vo.StoreDictionaryVo;
|
|
|
+import shop.alien.entity.store.vo.SystemConfigVo;
|
|
|
import shop.alien.mapper.StoreDictionaryMapper;
|
|
|
import shop.alien.store.service.StoreDictService;
|
|
|
import shop.alien.store.util.CommonConstant;
|
|
|
@@ -96,6 +99,38 @@ public class StoreDictServiceImpl extends ServiceImpl<StoreDictionaryMapper, Sto
|
|
|
.collect(Collectors.groupingBy(StoreDictionary::getTypeName));
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public SystemConfigVo getConfig(String dictType) {
|
|
|
+ SystemConfigVo systemConfigVo = new SystemConfigVo();
|
|
|
+ systemConfigVo.setDictType(dictType);
|
|
|
+ LambdaQueryWrapper<StoreDictionary> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(StoreDictionary::getTypeName, dictType);
|
|
|
+ queryWrapper.eq(StoreDictionary::getDeleteFlag, 0);
|
|
|
+ List<StoreDictionary> storeDictionaryList = this.list(queryWrapper);
|
|
|
+ if(!CollectionUtils.isEmpty(storeDictionaryList)){
|
|
|
+ StoreDictionary storeDictionary = storeDictionaryList.get(0);
|
|
|
+ systemConfigVo.setConfigValue1(storeDictionary.getDictId());
|
|
|
+ systemConfigVo.setConfigValue2(storeDictionary.getDictDetail());
|
|
|
+ }
|
|
|
+ return systemConfigVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void editConfig(SystemConfigVo systemConfigVo) {
|
|
|
+ if(systemConfigVo != null && StringUtils.isNotBlank(systemConfigVo.getDictType())){
|
|
|
+ LambdaQueryWrapper<StoreDictionary> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(StoreDictionary::getTypeName, systemConfigVo.getDictType());
|
|
|
+ queryWrapper.eq(StoreDictionary::getDeleteFlag, 0);
|
|
|
+ List<StoreDictionary> storeDictionaryList = this.list(queryWrapper);
|
|
|
+ if(!CollectionUtils.isEmpty(storeDictionaryList)){
|
|
|
+ StoreDictionary storeDictionary = storeDictionaryList.get(0);
|
|
|
+ storeDictionary.setDictId(systemConfigVo.getConfigValue1());
|
|
|
+ storeDictionary.setDictDetail(systemConfigVo.getConfigValue2());
|
|
|
+ storeDictionaryMapper.updateById(storeDictionary);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public List<StoreDictionary> buildTreeOptimized(List<StoreDictionary> flatList) {
|
|
|
// 创建三个存储结构
|
|
|
Map<Integer, StoreDictionary> nodeMap = new HashMap<>(); // ID到节点的映射
|