Java 根据组织ID查询对应的人员信息
controller:
@AutoLog(value = "根据组织查人") @PostMapping(value = "/getPerson") public Result<Object> getPerson(@RequestBody Map<String, Object> params) { Integer pageNo = Integer.parseInt(params.getOrDefault("pageNo", "1").toString()); Integer pageSize = Integer.parseInt(params.getOrDefault("pageSize", "10").toString()); Page<Map<String, Object>> page = new Page<>(pageNo, pageSize); IPage<Map<String, Object>> pageList = workOrgService.getPerson(page, params); return Result.OK(pageList); }
xml文件:
keyWords 为关键字模糊查询
<select id="getPerson" parameterType="java.util.Map" resultType="java.util.Map"> with recursive ag_tree as (select id, name, parent_id,is_audit_department from work_org where id=#{param.id,jdbcType=VARCHAR} union all select a.id,a.name,a.parent_id,A.is_audit_department from work_org a join ag_tree at on a.parent_id = at.id where a.parent_id is not null) select t.login_id as "code",t.user_name as "text",id as "orgId",name as "orgName" from ag_tree,E_user t where t.ext18=id and t.state='1' <if test="param.keyWords != null and param.keyWords != ''"> and (t.user_id like concat('%',#{param.keyWords},'%') or t.user_name like concat('%',#{param.keyWords},'%')) </if> </select>

浙公网安备 33010602011771号