| | |
| | | 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 |
| | |
| | | left join manage_device_per_share ddps on ddps.loan_to_dept_id = 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 |