Commit 169b6f70 authored by liuzeheng's avatar liuzeheng

目的仓筛选

parent 6041c564
......@@ -133,4 +133,31 @@ public interface WarehouseMapper extends BaseMapperX<WarehouseDO> {
"WHERE w.deleted = 0 AND w.`status` =0 AND trade_type =#{tradeType}"
})
List<WarehouseTreeRegionVO> getWarehouseTreeRegionList(@Param("tradeType") Integer tradeType);
@ResultType(List.class)
@Select({
"<script>",
"SELECT w.*, ",
"r1.title_zh as guojiaName,",
"r2.title_zh as shiName ",
"FROM ecw_warehouse w ",
"LEFT JOIN ecw_region r1 ",
"ON w.guojia = r1.id ",
"LEFT JOIN ecw_region r2 ",
"ON w.shi = r2.id ",
"WHERE w.deleted = 0 AND w.`status` =0 AND trade_type =1 ",
"<when test = 'type == 1'>",
"GROUP BY r1.title_zh",
"</when>",
"<when test = 'type == 2'>",
"AND w.guojia=#{regionId}",
"GROUP BY w.shi",
"</when>",
"<when test = 'type == 3'>",
"AND w.shi=#{regionId}",
"GROUP BY w.title_zh",
"</when>",
"</script>"
})
List<WarehouseTreeRegionVO> getRegionList(@Param("type") Integer type, @Param("regionId") Integer regionId);
}
......@@ -170,4 +170,6 @@ public interface WarehouseService {
LogisticsInfoDto getStartInfoAndDestInfoByLineId(Long lineId);
List<WarehouseTreeRegionVO> getWarehouseTreeRegionList(Integer tradeType);
List<WarehouseTreeRegionVO> getRegionList(Integer type, Integer regionId);
}
......@@ -495,21 +495,27 @@ public class WarehouseServiceImpl implements WarehouseService {
@Override
public List<WarehouseTreeRegionVO> getWarehouseTreeRegionList(Integer tradeType) {
List<WarehouseTreeRegionVO> list =warehouseMapper.getWarehouseTreeRegionList(tradeType);
List<WarehouseTreeRegionVO> list = warehouseMapper.getWarehouseTreeRegionList(tradeType);
list.stream().forEach(s->s.getGuojiaName().replaceAll("\t",""));
Map<String,List<WarehouseTreeRegionVO>> map = (HashMap<String, List<WarehouseTreeRegionVO>>) list.stream()
list.stream().forEach(s -> s.getGuojiaName().replaceAll("\t", ""));
Map<String, List<WarehouseTreeRegionVO>> map = (HashMap<String, List<WarehouseTreeRegionVO>>) list.stream()
.collect(Collectors.groupingBy(WarehouseTreeRegionVO::getGuojiaName));
List<WarehouseTreeRegionVO> regionVOList = new ArrayList<>() ;
for (Map.Entry<String, List<WarehouseTreeRegionVO>> m:map.entrySet()){
WarehouseTreeRegionVO v = new WarehouseTreeRegionVO();
v.setGuojiaName(m.getKey());
v.setChildren(m.getValue());
v.setGuojia(m.getValue().get(0).getGuojia());
v.setId(m.getValue().get(0).getGuojia());
regionVOList.add(v);
}
List<WarehouseTreeRegionVO> regionVOList = new ArrayList<>();
for (Map.Entry<String, List<WarehouseTreeRegionVO>> m : map.entrySet()) {
WarehouseTreeRegionVO v = new WarehouseTreeRegionVO();
v.setGuojiaName(m.getKey());
v.setChildren(m.getValue());
v.setGuojia(m.getValue().get(0).getGuojia());
v.setId(m.getValue().get(0).getGuojia());
regionVOList.add(v);
}
return regionVOList;
}
@Override
public List<WarehouseTreeRegionVO> getRegionList(Integer type, Integer regionId) {
List<WarehouseTreeRegionVO> list = warehouseMapper.getRegionList(type,regionId);
return list;
}
}
......@@ -100,6 +100,12 @@ public class WarehouseController {
return success(list);
}
@GetMapping("/getRegionList")
public CommonResult<List<WarehouseTreeRegionVO>> getRegionList(@RequestParam(value = "type", required = false) Integer type,Integer regionId){
List<WarehouseTreeRegionVO> list = warehouseService.getRegionList(type,regionId);
return success(list);
}
@GetMapping("/page")
@ApiOperation("获得仓库分页")
// @PreAuthorize("@ss.hasPermission('ecw:warehouse:query')")
......
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