| | |
| | | return R.data(regionService.getTree(region)); |
| | | } |
| | | |
| | | /** |
| | | * 树列表-查询到社区的树 |
| | | * @return |
| | | */ |
| | | @GetMapping("/treeToCommunity") |
| | | @ApiOperation(value = "树列表-查询到社区的树", notes = "传入menu") |
| | | public R treeToCommunity() { |
| | | return R.data(regionService.treeToCommunity()); |
| | | } |
| | | |
| | | /** |
| | | * 树列表(获取当前树) |
| | |
| | | * @return |
| | | */ |
| | | List<String> getAllCommunityNameListString(@Param("articleRange") String articleRange); |
| | | |
| | | /** |
| | | * 树列表-查询到社区的树 |
| | | * @param regionChildCodesList |
| | | * @param isAdministrator |
| | | * @return |
| | | */ |
| | | @MapKey(value = "id") |
| | | Map<String, TreeStringNode> treeToCommunity(List<String> regionChildCodesList, Integer isAdministrator); |
| | | } |
| | |
| | | #{item} |
| | | </foreach> |
| | | ) |
| | | </select> |
| | | |
| | | |
| | | <!--根据父编号查询所有的下级--> |
| | | <select id="treeToCommunity" resultType="org.springblade.common.node.TreeStringNode"> |
| | | select |
| | | br.code as id, |
| | | br.parent_code as parentId, |
| | | br.name as name, |
| | | br.sort |
| | | FROM blade_region br |
| | | left join jczz_grid jg on br.village_code = jg.community_code and jg.is_deleted = 0 and br.region_level = 5 |
| | | where 1=1 and (br.ancestors like '%361102%' or br.code = '361102') |
| | | <if test="isAdministrator==2"> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and jg.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jg.community_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | String getAllCommunityNameListString(String articleRange); |
| | | |
| | | /** |
| | | * 树列表-查询到社区的树 |
| | | * @return |
| | | */ |
| | | List<TreeStringNode> treeToCommunity(); |
| | | } |
| | |
| | | // 分割后es搜索才有效果,不能用逗号分割 |
| | | return String.join("\\",baseMapper.getAllCommunityNameListString(articleRange)); |
| | | } |
| | | |
| | | /** |
| | | * 树列表-查询到社区的树 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<TreeStringNode> treeToCommunity() { |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId(), null); |
| | | Integer isAdministrator = AuthUtils.isAdministratorOrAdmin(AuthUtil.getUserRole()) == true ? 1 : 2; |
| | | // 查询 |
| | | Map<String, TreeStringNode> treeList = baseMapper.treeToCommunity(regionChildCodesList, isAdministrator); |
| | | return NodeTreeUtil.getStringNodeTree(treeList); |
| | | } |
| | | } |