Commit 1a5fdc28 authored by luben's avatar luben

Merge branch 'dev-lb' into 'dev'

Dev lb

See merge request !226
parents b5075374 6da926e7
Pipeline #145536 canceled with stages
...@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.grid; ...@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.grid;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
...@@ -1041,4 +1042,37 @@ public class RegionController extends BaseController { ...@@ -1041,4 +1042,37 @@ public class RegionController extends BaseController {
} }
} }
@RequestMapping(value = "/getThreeByUser", method = RequestMethod.GET)
@ResponseBody
public AjaxResult getThreeByUser(@RequestParam("wgType") String wgType
,@RequestParam("pageNum") Integer pageNum,
@RequestParam("pageSize") Integer pageSize) {
AjaxResult result = new AjaxResult();
SysUser user = SecurityUtils.getLoginUser().getUser();
//网格
GridRegionUserExample example = new GridRegionUserExample();
GridRegionUserExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(user.getUserId());
criteria.andIsValidEqualTo("1");
List<GridRegionUser> relationship = gridRegionUserService.selectByExample(example);
String region = relationship.stream().map(GridRegionUser::getWgId).collect(Collectors.joining(","));
List<String> regions = Arrays.asList(region.split(","));
List<String> regionList = new ArrayList<>();
List<GridRegion> gridRegions = new ArrayList<>();
PageHelper.startPage(pageNum, pageSize);
//3.20权限bug
if(regions.get(0).equals("320282001")){
// regionList.add("320282001");
gridRegions = gridRegionMapper.getAllLevelThree(null,wgType);
}else{
regionList.addAll(regions);
gridRegions = gridRegionMapper.getAllLevelThree(regionList,wgType);
}
PageInfo<GridRegion> pageInfo = new PageInfo<>(gridRegions);
return AjaxResult.success(pageInfo);
}
} }
...@@ -96,4 +96,6 @@ public interface GridRegionMapper { ...@@ -96,4 +96,6 @@ public interface GridRegionMapper {
int selectMaxPosition(); int selectMaxPosition();
GridRegion selectByWgName(@Param("wgName") String wgName); GridRegion selectByWgName(@Param("wgName") String wgName);
List<GridRegion> getAllLevelThree(@Param("wgCodeLikes")List<String> wgCodeLikes, @Param("wgType")String wgType);
} }
...@@ -798,4 +798,20 @@ ...@@ -798,4 +798,20 @@
where wg_name = #{wgName} and is_valid = '1' limit 1 where wg_name = #{wgName} and is_valid = '1' limit 1
</select> </select>
<select id="getAllLevelThree" resultType="com.ruoyi.system.domain.grid.GridRegion">
select
<include refid="Base_Column_List" />
from grid_region where is_valid = '1'
and wg_type = #{wgType}
<if test="wgCodeLikes != null and wgCodeLikes.size() > 0">
and (
<foreach collection="wgCodeLikes" item="wgCode" open="(" close=")" separator="or">
wg_parent_id = #{wgCode}
</foreach>
)
</if>
and level = 3
order by position asc
</select>
</mapper> </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