mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
系统配置:自定义板编号处理类分页查询补充
This commit is contained in:
+22
-1
@@ -10,6 +10,7 @@ import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
|||||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||||
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigDeleteReqVO;
|
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigDeleteReqVO;
|
||||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigPageReqVO;
|
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigPageReqVO;
|
||||||
@@ -33,6 +34,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -78,7 +80,26 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SystemConfigDO> selectList(ConfigPageReqVO pageReqVO) {
|
public List<SystemConfigDO> selectList(ConfigPageReqVO pageReqVO) {
|
||||||
return null;
|
SystemConfigTypeEnum customPlateNoEnum = SystemConfigTypeEnum.CUSTOM_PLATE_NO;
|
||||||
|
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectList(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||||
|
.eq(SystemConfigDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
|
||||||
|
.eq(SystemConfigDO::getType, pageReqVO.getType())
|
||||||
|
.eqIfPresent(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||||
|
.select(SystemConfigDO::getId, SystemConfigDO::getName, SystemConfigDO::getStatus, SystemConfigDO::getType)
|
||||||
|
.orderByAsc(SystemConfigDO::getId));
|
||||||
|
if (systemConfigDOS.isEmpty()) {
|
||||||
|
SystemConfigDO initCustomPlateNoConfig = new SystemConfigDO().builder().id(null).name(customPlateNoEnum.getName()).type(customPlateNoEnum.getType()).build();
|
||||||
|
return List.of(initCustomPlateNoConfig);
|
||||||
|
} else {
|
||||||
|
// configDOPageResult下的自定义板编号配置只保留version最大的一项
|
||||||
|
Optional<SystemConfigDO> maxVersionCustPlateNoConfigOptinal = systemConfigDOS.stream()
|
||||||
|
.filter(s -> ObjectUtil.equal(customPlateNoEnum.getType(), s.getType()))
|
||||||
|
.max(Comparator.comparing(SystemConfigDO::getVersion));
|
||||||
|
if (maxVersionCustPlateNoConfigOptinal.isPresent()) {
|
||||||
|
systemConfigDOS.removeIf(s -> ObjectUtil.equal(customPlateNoEnum.getType(), s.getType()) && ObjectUtil.notEqual(s.getId(), maxVersionCustPlateNoConfigOptinal.get().getId()));
|
||||||
|
}
|
||||||
|
return systemConfigDOS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user