mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 21:32:07 +08:00
系统配置-配置项名字查询改为字典查询
This commit is contained in:
+4
@@ -6,7 +6,9 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDataDO;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -26,4 +28,6 @@ public interface SystemConfigDataMapper extends BaseMapperX<SystemConfigDataDO>
|
||||
.orderByAsc(SystemConfigDataDO::getSort, SystemConfigDO::getCreateTime));
|
||||
}
|
||||
|
||||
@Delete("delete from system_config_data where organ_id = #{organId} and id = #{id}")
|
||||
void deleteConfig(@Param("id") Long id, @Param("organId") Long organId);
|
||||
}
|
||||
|
||||
+5
@@ -5,7 +5,9 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigFilterDO;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -27,4 +29,7 @@ public interface SystemConfigFilterMapper extends BaseMapperX<SystemConfigFilter
|
||||
}
|
||||
|
||||
|
||||
@Delete("delete from system_config_filter where organ_id = #{organId} and id = #{id}")
|
||||
void deleteConfig(@Param("id") Long id,@Param("organId") Long organId);
|
||||
|
||||
}
|
||||
|
||||
+6
@@ -6,7 +6,9 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigProcessDO;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -28,4 +30,8 @@ public interface SystemConfigProcessMapper extends BaseMapperX<SystemConfigProce
|
||||
.orderByAsc(SystemConfigProcessDO::getSort, SystemConfigDO::getCreateTime));
|
||||
}
|
||||
|
||||
|
||||
@Delete("delete from system_config_process where organ_id = #{organId} and id = #{id}")
|
||||
void deleteConfig(@Param("id") Long id, @Param("organId") Long organId);
|
||||
|
||||
}
|
||||
|
||||
+4
@@ -6,7 +6,9 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigSchemeDO;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,5 +37,7 @@ public interface SystemConfigSchemeMapper extends BaseMapperX<SystemConfigScheme
|
||||
}
|
||||
|
||||
|
||||
@Delete("delete from system_config_scheme where organ_id = #{organId} and id = #{id}")
|
||||
void deleteConfig(@Param("id") Long id, @Param("organId") Long organId);
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,9 +24,9 @@ public enum SystemConfigTypeEnum {
|
||||
INTELLIGENT_BRANCH(2, "板件筛选"),
|
||||
|
||||
/**
|
||||
* 加工分线
|
||||
* 加工筛选
|
||||
*/
|
||||
PROCESSING_SCREENING(3, "加工分线"),
|
||||
PROCESSING_SCREENING(3, "加工筛选"),
|
||||
|
||||
/**
|
||||
* 数据处理
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class SystemConfigServiceFactory {
|
||||
// 板件分线
|
||||
case INTELLIGENT_BRANCH:
|
||||
return applicationContext.getBean(IntellectBranchingService.class);
|
||||
// 加工分线
|
||||
// 加工筛选
|
||||
case PROCESSING_SCREENING:
|
||||
return applicationContext.getBean(ProcessScreeningServiceHandler.class);
|
||||
// 数据处理
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ public class DataProcessServiceHandler extends AbstractSystemConfigServiceHandle
|
||||
|
||||
validateDataConfigUsedAlready(id);
|
||||
|
||||
systemConfigDataMapper.deleteById(id);
|
||||
systemConfigDataMapper.deleteConfig(reqVO.getId(),getUserOrganId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
+25
-15
@@ -1,11 +1,14 @@
|
||||
package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.dict.DictDataDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.dict.DictDataMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
@@ -13,7 +16,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -27,33 +33,37 @@ public class DefaultSystemConfigServiceHandler extends AbstractSystemConfigServi
|
||||
@Resource
|
||||
private SystemConfigMapper systemConfigMapper;
|
||||
|
||||
@Resource
|
||||
private DictDataMapper dictDataMapper;
|
||||
|
||||
@Resource
|
||||
private CustomPlateNoServiceHandler customPlateNoServiceHandler;
|
||||
|
||||
@Override
|
||||
public List<SystemConfigDO> selectList(ConfigPageReqVO reqVO) {
|
||||
|
||||
// 查询所有的 SystemConfigTypeEnum 类型
|
||||
List<SystemConfigTypeEnum> allConfigTypes = Arrays.asList(SystemConfigTypeEnum.values());
|
||||
List<DictDataDO> dictDataDOS = dictDataMapper.selectListByStatusAndDictType(CommonStatusEnum.ENABLE.getStatus(), "system_config_type_enum");
|
||||
|
||||
// 自定义板编号、高级筛选不走通用分页查询
|
||||
// List<SystemConfigTypeEnum> list = allConfigTypes.stream()
|
||||
// .filter(f -> ObjectUtil.notEqual(SystemConfigTypeEnum.ADVANCED_SCREEN.getType(), f.getType())).toList();
|
||||
if(CollUtil.isEmpty(dictDataDOS)){
|
||||
log.error("系统配置项对应的字典被关闭或数据查询有误");
|
||||
return null;
|
||||
}
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectList(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.likeIfPresent(SystemConfigDO::getName, reqVO.getName())
|
||||
// .eq(SystemConfigDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
|
||||
.in(SystemConfigDO::getType, allConfigTypes.stream().map(SystemConfigTypeEnum::getType).toList())
|
||||
.inIfPresent(SystemConfigDO::getType, dictDataDOS.stream().map(DictDataDO::getValue).toList())
|
||||
.eqIfPresent(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.select(SystemConfigDO::getId, SystemConfigDO::getName, SystemConfigDO::getStatus, SystemConfigDO::getType,SystemConfigDO::getVersion)
|
||||
.orderByAsc(SystemConfigDO::getId));
|
||||
|
||||
// 遍历枚举
|
||||
List<SystemConfigDO> resultList = new ArrayList<>();
|
||||
for (SystemConfigTypeEnum configTypeEnum : allConfigTypes) {
|
||||
|
||||
|
||||
for (DictDataDO dictDataDO : dictDataDOS) {
|
||||
// 获取当前枚举类型的配置项列表
|
||||
List<SystemConfigDO> typeConfigs = systemConfigDOS.stream()
|
||||
.filter(c -> ObjectUtil.equal(configTypeEnum.getType(), c.getType()))
|
||||
.filter(c -> ObjectUtil.equal(dictDataDO.getValue(), c.getType()))
|
||||
.toList();
|
||||
|
||||
if (typeConfigs.isEmpty()) {
|
||||
@@ -61,12 +71,12 @@ public class DefaultSystemConfigServiceHandler extends AbstractSystemConfigServi
|
||||
SystemConfigDO initConfig = SystemConfigDO
|
||||
.builder()
|
||||
.id(null)
|
||||
.name(configTypeEnum.getName())
|
||||
.type(configTypeEnum.getType())
|
||||
.name(dictDataDO.getLabel())
|
||||
.type(Integer.parseInt(dictDataDO.getValue()))
|
||||
.build();
|
||||
|
||||
// 自定义板编号
|
||||
if(configTypeEnum.getType().equals(SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType())){
|
||||
if(Integer.parseInt(dictDataDO.getValue()) == (SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType())){
|
||||
initConfig.setStatus(CommonStatusEnum.DISABLE.getStatus());
|
||||
resultList.add(initConfig);
|
||||
continue;
|
||||
@@ -76,12 +86,12 @@ public class DefaultSystemConfigServiceHandler extends AbstractSystemConfigServi
|
||||
} else {
|
||||
// 如果存在配置,保留版本号最大的配置
|
||||
Optional<SystemConfigDO> maxVersionConfig = typeConfigs.stream()
|
||||
.map(m->m.setName(configTypeEnum.getName()))
|
||||
.map(m->m.setName(dictDataDO.getLabel()))
|
||||
.max(Comparator.comparingInt(SystemConfigDO::getVersion));
|
||||
|
||||
maxVersionConfig.ifPresent(resultList::add);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return resultList;
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ public class IntellectBranchingService extends AbstractSystemConfigServiceHandle
|
||||
|
||||
validateSystemConfigExists(reqVO.getId());
|
||||
|
||||
systemConfigFilterMapper.deleteById(reqVO.getId());
|
||||
systemConfigFilterMapper.deleteConfig(reqVO.getId(),getUserOrganId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -140,7 +140,7 @@ public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHand
|
||||
throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_IS_PLAN);
|
||||
}
|
||||
|
||||
systemConfigSchemeMapper.deleteById(reqVO.getId());
|
||||
systemConfigSchemeMapper.deleteConfig(reqVO.getId(),getUserOrganId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.ge
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* @author 加工分线服务处理器
|
||||
* @author 加工筛选服务处理器
|
||||
*/
|
||||
@Service("processScreeningServiceHandler")
|
||||
@Slf4j
|
||||
@@ -88,7 +88,7 @@ public class ProcessScreeningServiceHandler extends AbstractSystemConfigServiceH
|
||||
|
||||
validateProcessConfigUsedAlready(id);
|
||||
|
||||
systemConfigProcessMapper.deleteById(id);
|
||||
systemConfigProcessMapper.deleteConfig(reqVO.getId(),getUserOrganId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user