|
|
|
package com.supervision.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
import cn.hutool.crypto.digest.MD5;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import com.supervision.model.ConfigPhysicalTool;
|
|
|
|
import com.supervision.service.ConfigPhysicalToolService;
|
|
|
|
import com.supervision.mapper.ConfigPhysicalToolMapper;
|
|
|
|
import com.supervision.vo.ask.ConfigPhysicalToolResVO;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author flevance
|
|
|
|
* @description 针对表【vp_config_physical_tool(体格检查工具配置表)】的数据库操作Service实现
|
|
|
|
* @createDate 2023-10-20 17:19:21
|
|
|
|
*/
|
|
|
|
@Service
|
|
|
|
public class ConfigPhysicalToolServiceImpl extends ServiceImpl<ConfigPhysicalToolMapper, ConfigPhysicalTool>
|
|
|
|
implements ConfigPhysicalToolService{
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<ConfigPhysicalToolResVO> queryPhysicalToolList() {
|
|
|
|
|
|
|
|
List<ConfigPhysicalTool> list = this.lambdaQuery().list();
|
|
|
|
return list.stream().collect(Collectors.groupingBy(ConfigPhysicalTool::getType)).entrySet().stream().map(e ->{
|
|
|
|
ConfigPhysicalToolResVO tool = new ConfigPhysicalToolResVO();
|
|
|
|
tool.setToolType(e.getKey());
|
|
|
|
tool.setToolName(e.getKey());
|
|
|
|
tool.setId(new MD5().digestHex16(e.getKey()));
|
|
|
|
int priority = 999;
|
|
|
|
if (CollectionUtil.isNotEmpty(e.getValue()) && null != e.getValue().get(0).getTypePriority()) {
|
|
|
|
priority = e.getValue().get(0).getTypePriority();
|
|
|
|
}
|
|
|
|
tool.setPriority(priority);
|
|
|
|
tool.setToolList(e.getValue());
|
|
|
|
return tool;
|
|
|
|
}).sorted(Comparator.comparingInt(ConfigPhysicalToolResVO::getPriority)).collect(Collectors.toList());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|