Commit d01a1e09 authored by luben's avatar luben

fix

parent 8de719b0
...@@ -25,6 +25,7 @@ import org.apache.poi.ss.usermodel.Row; ...@@ -25,6 +25,7 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -716,9 +717,30 @@ public class RegionController extends BaseController { ...@@ -716,9 +717,30 @@ public class RegionController extends BaseController {
if(!StringUtils.isBlank(wgCode)){ if(!StringUtils.isBlank(wgCode)){
wgCodeLikes = Arrays.asList(wgCode.split(",")); wgCodeLikes = Arrays.asList(wgCode.split(","));
} }
List<GridTreeNode> treeNodeList = new ArrayList<>();
List<GridRegion> gridRegionList = gridRegionMapper.getThirdRegion(wgType,wgCodeLikes,name); List<GridRegion> gridRegionList = gridRegionMapper.getSecondOrThirdRegion(wgType,wgCodeLikes,null,"2");
return AjaxResult.success(gridRegionList); for(GridRegion gridRegion : gridRegionList){
List<String> parent = new ArrayList<>();
parent.add(gridRegion.getWgCode());
List<GridRegion> children = gridRegionMapper.getSecondOrThirdRegion(wgType,parent,name,"3");
GridTreeNode treeNode = new GridTreeNode();
BeanUtils.copyProperties(gridRegion,treeNode);
treeNode.setName(gridRegion.getWgName());
treeNode.setId(gridRegion.getId());
treeNode.setCode(gridRegion.getWgCode());
treeNode.setParentId(gridRegion.getWgParentId());
for(GridRegion child : children){
GridTreeNode childTreeNode = new GridTreeNode();
BeanUtils.copyProperties(child,childTreeNode);
childTreeNode.setName(child.getWgName());
childTreeNode.setId(child.getId());
childTreeNode.setCode(child.getWgCode());
childTreeNode.setParentId(child.getWgParentId());
treeNode.getChild().add(childTreeNode);
}
treeNodeList.add(treeNode);
}
return AjaxResult.success(treeNodeList);
} }
@RequestMapping(value = "/getOneOrTwoRegion",method = RequestMethod.GET) @RequestMapping(value = "/getOneOrTwoRegion",method = RequestMethod.GET)
......
...@@ -46,5 +46,5 @@ public interface GridRegionMapper { ...@@ -46,5 +46,5 @@ public interface GridRegionMapper {
Integer countByParams(GridRegionSearchParam param); Integer countByParams(GridRegionSearchParam param);
List<GridRegion> getThirdRegion(@Param("wgType")String wgType,@Param("wgCodeLikes")List<String> wgCodeLikes,@Param("name")String name); List<GridRegion> getSecondOrThirdRegion(@Param("wgType")String wgType, @Param("wgCodeLikes")List<String> wgCodeLikes, @Param("name")String name, @Param("level")String level);
} }
\ No newline at end of file
...@@ -612,7 +612,7 @@ ...@@ -612,7 +612,7 @@
and level = #{level} and level = #{level}
</if> </if>
</select> </select>
<select id="getThirdRegion" resultType="com.ruoyi.system.domain.grid.GridRegion"> <select id="getSecondOrThirdRegion" resultType="com.ruoyi.system.domain.grid.GridRegion">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from grid_region where is_valid = '1' from grid_region where is_valid = '1'
...@@ -622,6 +622,8 @@ ...@@ -622,6 +622,8 @@
wg_code like CONCAT(#{wgCode}, '%') wg_code like CONCAT(#{wgCode}, '%')
</foreach> </foreach>
) )
</if>
<if test="level !=2">
and ( and (
<foreach collection="wgCodeLikes" item="wgCode" open="(" close=")" separator="and"> <foreach collection="wgCodeLikes" item="wgCode" open="(" close=")" separator="and">
wg_code != #{wgCode} wg_code != #{wgCode}
...@@ -634,6 +636,6 @@ ...@@ -634,6 +636,6 @@
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and wg_name = #{name} and wg_name = #{name}
</if> </if>
and level = 3 and level = #{level}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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