Commit 9c56ffa8 authored by wujipeng's avatar wujipeng
Browse files

道路详情优化

parent 58730fff
...@@ -3,6 +3,9 @@ package com.example.pipelinenetwork.mapper; ...@@ -3,6 +3,9 @@ package com.example.pipelinenetwork.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.pipelinenetwork.pojo.entity.DefectEntity; import com.example.pipelinenetwork.pojo.entity.DefectEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @Author: wujipeng * @Author: wujipeng
...@@ -12,4 +15,6 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -12,4 +15,6 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface DefectMapper extends BaseMapper<DefectEntity> { public interface DefectMapper extends BaseMapper<DefectEntity> {
List<DefectEntity> roadDetail(@Param("relIds") List<String> relIds, @Param("defectType") String defectType, @Param("lev") String lev);
} }
...@@ -3,6 +3,9 @@ package com.example.pipelinenetwork.mapper; ...@@ -3,6 +3,9 @@ package com.example.pipelinenetwork.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.pipelinenetwork.pojo.entity.RepairEntity; import com.example.pipelinenetwork.pojo.entity.RepairEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @Author: wujipeng * @Author: wujipeng
...@@ -12,4 +15,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -12,4 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface RepairMapper extends BaseMapper<RepairEntity> { public interface RepairMapper extends BaseMapper<RepairEntity> {
List<RepairEntity> roadDetail(@Param("relIds") List<String> relIds, @Param("defectType") String defectType, @Param("lev") String lev);
} }
...@@ -2,9 +2,11 @@ package com.example.pipelinenetwork.service; ...@@ -2,9 +2,11 @@ package com.example.pipelinenetwork.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.example.pipelinenetwork.pojo.entity.DefectEntity; import com.example.pipelinenetwork.pojo.entity.DefectEntity;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.util.List;
/** /**
* @Author: wujipeng * @Author: wujipeng
...@@ -15,4 +17,6 @@ import java.io.IOException; ...@@ -15,4 +17,6 @@ import java.io.IOException;
public interface DefectService extends IService<DefectEntity> { public interface DefectService extends IService<DefectEntity> {
Boolean importDefectData(MultipartFile file) throws IOException; Boolean importDefectData(MultipartFile file) throws IOException;
List<DefectEntity> roadDetail(@Param("relIds") List<String> relIds, @Param("defectType") String defectType, @Param("lev") String lev);
} }
...@@ -5,6 +5,7 @@ import com.example.pipelinenetwork.pojo.entity.RepairEntity; ...@@ -5,6 +5,7 @@ import com.example.pipelinenetwork.pojo.entity.RepairEntity;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.util.List;
/** /**
* @Author: wujipeng * @Author: wujipeng
...@@ -16,4 +17,6 @@ public interface RepairService extends IService<RepairEntity> { ...@@ -16,4 +17,6 @@ public interface RepairService extends IService<RepairEntity> {
Boolean importDefectData(MultipartFile file) throws IOException; Boolean importDefectData(MultipartFile file) throws IOException;
List<RepairEntity> roadDetail(List<String> relIds, String defectType, String lev);
} }
...@@ -37,10 +37,7 @@ public class BasicServiceImpl extends ServiceImpl<BasicMapper, BasicEntity> impl ...@@ -37,10 +37,7 @@ public class BasicServiceImpl extends ServiceImpl<BasicMapper, BasicEntity> impl
//获取relId //获取relId
List<String> relIds = baseMapper.getRelIdsByRegion(roadDTO.getRegion()); List<String> relIds = baseMapper.getRelIdsByRegion(roadDTO.getRegion());
if ("检测".equals(roadDTO.getType())) { if ("检测".equals(roadDTO.getType())) {
List<DefectEntity> defectList = defectService.list(new LambdaQueryWrapper<DefectEntity>() List<DefectEntity> defectList = defectService.roadDetail(relIds, roadDTO.getDefectType(), roadDTO.getLev());
.in(DefectEntity::getRelId, relIds).eq(DefectEntity::getType, roadDTO.getDefectType())
.eq(DefectEntity::getLevel, roadDTO.getLev())
);
for (DefectEntity defectEntity : defectList) { for (DefectEntity defectEntity : defectList) {
if (result.containsKey(defectEntity.getName())) { if (result.containsKey(defectEntity.getName())) {
result.put(defectEntity.getName(), result.get(defectEntity.getName()) + defectEntity.getNum()); result.put(defectEntity.getName(), result.get(defectEntity.getName()) + defectEntity.getNum());
...@@ -49,10 +46,7 @@ public class BasicServiceImpl extends ServiceImpl<BasicMapper, BasicEntity> impl ...@@ -49,10 +46,7 @@ public class BasicServiceImpl extends ServiceImpl<BasicMapper, BasicEntity> impl
} }
} }
} else if ("修复".equals(roadDTO.getType())) { } else if ("修复".equals(roadDTO.getType())) {
List<RepairEntity> repairList = repairService.list(new LambdaQueryWrapper<RepairEntity>() List<RepairEntity> repairList = repairService.roadDetail(relIds, roadDTO.getDefectType(), roadDTO.getLev());
.in(RepairEntity::getRelId, relIds).eq(RepairEntity::getType, roadDTO.getDefectType())
.eq(RepairEntity::getLevel, roadDTO.getLev())
);
for (RepairEntity repairEntity : repairList) { for (RepairEntity repairEntity : repairList) {
if (result.containsKey(repairEntity.getName())) { if (result.containsKey(repairEntity.getName())) {
result.put(repairEntity.getName(), result.get(repairEntity.getName()) + repairEntity.getNum()); result.put(repairEntity.getName(), result.get(repairEntity.getName()) + repairEntity.getNum());
......
...@@ -42,6 +42,11 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i ...@@ -42,6 +42,11 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i
} }
} }
@Override
public List<DefectEntity> roadDetail(List<String> relIds, String defectType, String lev) {
return baseMapper.roadDetail(relIds, defectType, lev);
}
/** /**
* 安全获取字符串单元格值 * 安全获取字符串单元格值
*/ */
......
...@@ -43,6 +43,11 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, RepairEntity> i ...@@ -43,6 +43,11 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, RepairEntity> i
} }
} }
@Override
public List<RepairEntity> roadDetail(List<String> relIds, String defectType, String lev) {
return baseMapper.roadDetail(relIds, defectType, lev);
}
/** /**
* 安全获取字符串单元格值 * 安全获取字符串单元格值
*/ */
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.pipelinenetwork.mapper.DefectMapper">
<select id="roadDetail" resultType="com.example.pipelinenetwork.pojo.entity.DefectEntity">
select
id,
type,
name,
level,
num,
rel_id
from
defect
where
rel_id
in
<foreach item="item" index="index" collection="relIds" open="(" separator="," close=")">
#{item}
</foreach>
<if test="defectType != null and defectType != ''">
and type = #{defectType}
</if>
<if test="lev != null and lev != ''">
and level = #{lev}
</if>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.pipelinenetwork.mapper.RepairMapper">
<select id="roadDetail" resultType="com.example.pipelinenetwork.pojo.entity.RepairEntity">
select
id,
type,
name,
level,
num,
rel_id
from
repair
where
rel_id
in
<foreach item="item" index="index" collection="relIds" open="(" separator="," close=")">
#{item}
</foreach>
<if test="defectType != null and defectType != ''">
and type = #{defectType}
</if>
<if test="lev != null and lev != ''">
and level = #{lev}
</if>
</select>
</mapper>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment