select sdDept.id from ( select sd.id dept_id, sd.dept_index from sys_dept_emp sde left join sys_dept sd on (sd.id = sde.dept_id and sd.del_state = 0 and sd.dept_state = 0) where sde.emp_id = #{nowUserId} and sde.company_id = #{companyId} ) temp left join sys_dept sdDept ON (sdDept.dept_index like CONCAT('%',temp.dept_index,'%') and sdDept.del_state = 0 and sdDept.dept_state = 0) where sdDept.company_id = #{companyId}
SQL案例自用
最新推荐文章于 2024-06-24 12:04:20 发布