Commit 169b6f70 authored by liuzeheng's avatar liuzeheng

目的仓筛选

parent 6041c564
...@@ -133,4 +133,31 @@ public interface WarehouseMapper extends BaseMapperX<WarehouseDO> { ...@@ -133,4 +133,31 @@ public interface WarehouseMapper extends BaseMapperX<WarehouseDO> {
"WHERE w.deleted = 0 AND w.`status` =0 AND trade_type =#{tradeType}" "WHERE w.deleted = 0 AND w.`status` =0 AND trade_type =#{tradeType}"
}) })
List<WarehouseTreeRegionVO> getWarehouseTreeRegionList(@Param("tradeType") Integer 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 { ...@@ -170,4 +170,6 @@ public interface WarehouseService {
LogisticsInfoDto getStartInfoAndDestInfoByLineId(Long lineId); LogisticsInfoDto getStartInfoAndDestInfoByLineId(Long lineId);
List<WarehouseTreeRegionVO> getWarehouseTreeRegionList(Integer tradeType); List<WarehouseTreeRegionVO> getWarehouseTreeRegionList(Integer tradeType);
List<WarehouseTreeRegionVO> getRegionList(Integer type, Integer regionId);
} }
...@@ -495,13 +495,13 @@ public class WarehouseServiceImpl implements WarehouseService { ...@@ -495,13 +495,13 @@ public class WarehouseServiceImpl implements WarehouseService {
@Override @Override
public List<WarehouseTreeRegionVO> getWarehouseTreeRegionList(Integer tradeType) { 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","")); list.stream().forEach(s -> s.getGuojiaName().replaceAll("\t", ""));
Map<String,List<WarehouseTreeRegionVO>> map = (HashMap<String, List<WarehouseTreeRegionVO>>) list.stream() Map<String, List<WarehouseTreeRegionVO>> map = (HashMap<String, List<WarehouseTreeRegionVO>>) list.stream()
.collect(Collectors.groupingBy(WarehouseTreeRegionVO::getGuojiaName)); .collect(Collectors.groupingBy(WarehouseTreeRegionVO::getGuojiaName));
List<WarehouseTreeRegionVO> regionVOList = new ArrayList<>() ; List<WarehouseTreeRegionVO> regionVOList = new ArrayList<>();
for (Map.Entry<String, List<WarehouseTreeRegionVO>> m:map.entrySet()){ for (Map.Entry<String, List<WarehouseTreeRegionVO>> m : map.entrySet()) {
WarehouseTreeRegionVO v = new WarehouseTreeRegionVO(); WarehouseTreeRegionVO v = new WarehouseTreeRegionVO();
v.setGuojiaName(m.getKey()); v.setGuojiaName(m.getKey());
v.setChildren(m.getValue()); v.setChildren(m.getValue());
...@@ -512,4 +512,10 @@ public class WarehouseServiceImpl implements WarehouseService { ...@@ -512,4 +512,10 @@ public class WarehouseServiceImpl implements WarehouseService {
return regionVOList; 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 { ...@@ -100,6 +100,12 @@ public class WarehouseController {
return success(list); 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") @GetMapping("/page")
@ApiOperation("获得仓库分页") @ApiOperation("获得仓库分页")
// @PreAuthorize("@ss.hasPermission('ecw:warehouse:query')") // @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