| | |
| | | |
| | | <!--查询公安相关的区域数据--> |
| | | <select id="getPoliceList" resultType="org.springblade.modules.system.entity.Region"> |
| | | SELECT id as code,parentId as parent_code,name,'' as ancestors,null as region_level,1 as sort FROM police_region |
| | | SELECT id as code,parent_id as parent_code,name,'' as ancestors,null as region_level,1 as sort FROM v_police_region |
| | | where 1=1 |
| | | <if test="communityCode!=null and communityCode!=''"> |
| | | and id like concat('%',#{communityCode},'%') |
| | |
| | | left join blade_user_dept bud on bud.user_id = bu.id |
| | | left join blade_dept bd on bud.dept_id = bd.id and bd.is_deleted = 0 |
| | | left join blade_region br on br.code = bd.region_code |
| | | where bu.is_deleted = 0 |
| | | where bu.is_deleted = 0 and bd.dept_category = 2 |
| | | and bu.id = #{userId} |
| | | union all |
| | | ( |
| | | SELECT |
| | | bu.*, |
| | | bd.id as cid,bd.parent_id,bd.ancestors,bd.dept_category,bd.dept_name,bd.full_name,bd.sort,bd.region_code, |
| | | br.level as region_level |
| | | FROM blade_user bu |
| | | left join blade_user_dept bud on bud.user_id = bu.id |
| | | left join blade_dept bd on bud.dept_id = bd.id and bd.is_deleted = 0 |
| | | left join v_police_region br on br.id = bd.region_code |
| | | where bu.is_deleted = 0 and bd.dept_category = 1 |
| | | and bu.id = #{userId} |
| | | ) |
| | | </select> |
| | | |
| | | |