| | |
| | | blade_dept |
| | | where is_deleted = 0 |
| | | <if test="deptId!=null and deptId!=''"> |
| | | and (id = #{deptId} or ancestors like concat('%',#{deptId},'%')) |
| | | and (id = #{deptId}::bigint or ancestors like concat('%',#{deptId},'%')) |
| | | </if> |
| | | </select> |
| | | |
| | | <!--自定义详情查询-根据系统配置id--> |
| | | <select id="getDetailBySysConfigId" resultType="org.sxkj.system.vo.DeptVO"> |
| | | select bd.* from blade_dept bd |
| | | left join sys_config sc on sc.dept_id = bd.id::VARCHAR and sc.is_deleted = 0 |
| | | left join sys_config sc on sc.dept_id::VARCHAR = bd.id::VARCHAR and sc.is_deleted = 0 |
| | | where bd.is_deleted = 0 |
| | | and sc.id = #{dept.sysConfigId} |
| | | </select> |
| | |
| | | select |
| | | bd.*,sc.id as sysConfigId,sc.name as sysName |
| | | from blade_dept bd |
| | | left join sys_config sc on sc.dept_id = bd.id::VARCHAR and sc.is_deleted = 0 |
| | | left join sys_config sc on sc.dept_id::VARCHAR = bd.id::VARCHAR and sc.is_deleted = 0 |
| | | where bd.is_deleted = 0 |
| | | and ( |
| | | bd.id = #{deptId} |
| | | bd.id = #{deptId}::bigint |
| | | or bd.ancestors like concat('%',#{deptId},'%') |
| | | ) |
| | | </select> |
| | |
| | | select |
| | | bd.*,sc.name as sysName |
| | | from blade_dept bd |
| | | left join sys_config sc on sc.dept_id = bd.id::VARCHAR and sc.is_deleted = 0 |
| | | left join sys_config sc |
| | | on sc.dept_id::VARCHAR = bd.id::VARCHAR |
| | | and sc.is_deleted = 0 |
| | | where bd.is_deleted = 0 |
| | | and ( |
| | | bd.id = #{deptId} |
| | | bd.id = #{deptId}::bigint |
| | | or bd.ancestors like concat('%',#{deptId},'%') |
| | | ) |
| | | and bd.dept_category = 1 |
| | |
| | | bd.sort |
| | | FROM |
| | | blade_dept bd |
| | | left join manage_device_per_share ddps on ddps.loan_to_dept_id = bd.id::VARCHAR |
| | | left join manage_device_per_share ddps on ddps.loan_to_dept_id::VARCHAR = bd.id::VARCHAR |
| | | where bd.is_deleted = 0 |
| | | and bd.id != #{deptId} |
| | | and ifnull(device_sn,'') != #{deviceSn} |
| | | and COALESCE(device_sn,'') != #{deviceSn} |
| | | and bd.id not in ( |
| | | -- 排除当前部门的所有上级部门 |
| | | select parent_dept.id |
| | |
| | | SELECT |
| | | CONCAT(p.name, ' ', c.name, ' ', r.name) AS full_region_name |
| | | FROM blade_region r |
| | | LEFT JOIN blade_region c ON r.parent_code = c.code::VARCHAR <!-- 市级 --> |
| | | LEFT JOIN blade_region p ON c.parent_code = p.code::VARCHAR <!-- 省级 --> |
| | | LEFT JOIN blade_region c ON r.parent_code::VARCHAR = c.code::VARCHAR <!-- 市级 --> |
| | | LEFT JOIN blade_region p ON c.parent_code::VARCHAR = p.code::VARCHAR <!-- 省级 --> |
| | | WHERE r.code = #{areaCode} |
| | | </select> |
| | | <select id="getSingleRegionName" resultType="string"> |
| | |
| | | and bd.area_code like concat(concat('%', #{param2.areaCode}),'%') |
| | | </if> |
| | | <if test="param2.deptCode!=null and param2.deptCode!=''"> |
| | | and bd.dept_code = #{param2.deptCode} |
| | | and bd.dept_code like concat(concat('%', #{param2.deptCode}),'%') |
| | | </if> |
| | | ORDER BY bd.create_time DESC |
| | | </select> |