# 点击机构查询 ## 功能操作 常规查询方式,点击机构进行数据查询。 ## 基本操作 * 数据默认查询 * 排序垃圾数据 * 现职人员 * 人员类别(公务员) * 报表条件(如:统计中央一级) * 统计范围(按照统计关系所在单位,,默认包含下级) * 操作用户的权限脚本 ```sql -- 默认点击查询 select tmp.a0000, '0A9E21F1CBA1276AE0743D859E081777' sessionid, (@i := @i + 1) as i from (select @i := 0) as it, (select a01.a0000, '0A9E21F1CBA1276AE0743D859E081777' sessionid from A01 a01 where 1 = 1 and a01.status != '4' -- 排序垃圾数据 and a0163 = '1' -- 现职人员 and exists(select 1 from a02 a02, competence_userdept cu where cu.userid = '1' and a02.A0201B = b0111 and a01.a0000 = a02.a0000 and a0281 = 'true' -- 职务输出 and a02.a0201b like '001.001.007%') -- 权限脚本 order by length(torgid), (select concat(LPAD(SORTID, 6, 0), torgid ) from b01 where B0111 = torgid) asc, -- 数据排序 torder asc, a0000 asc) tmp -- 点击“其他人员”机构 select tmp.a0000, '0A9E21F1CBA1276AE0743D859E081777' sessionid, (@i := @i + 1) as i from (select @i := 0) as it, (select a01.a0000, '0A9E21F1CBA1276AE0743D859E081777' sessionid from A01 a01 where 1 = 1 and a01.status != '4' -- 排序垃圾数据 and not exists (select 1 from a02, b01 where a02.a0000 = a01.a0000 and b0111 = a0201b and a0281 = 'true' -- 职务输出 and b0111 != '-1') -- 权限脚本 and a0163 = '1' order by length(torgid), (select concat(LPAD(SORTID, 6, 0), torgid) from b01 where B0111 = torgid) asc, -- 数据排序 torder asc, a0000 asc) tmp ```