UserAndUserPersonnelMiniDao_getUserIdByPId.sql 537 B

123456789101112131415161718192021
  1. select bu.id as userid,
  2. bu.realname as realname
  3. from t_s_base_user bu
  4. LEFT JOIN t_s_user_org uo ON uo.user_id = bu.id
  5. WHERE 1=1
  6. AND uo.org_id IN (
  7. SELECT
  8. tsd.id
  9. FROM
  10. t_s_depart tsd
  11. WHERE 1=1
  12. <#-- tsd.parentdepartid = '4028e4a55f6c84ec015f6caa0bf60007'-->
  13. <#if (userAndUserPersonnelDto.pid )?? && userAndUserPersonnelDto.pid ?length gt 0>
  14. and tsd.parentdepartid like CONCAT('%', :userAndUserPersonnelDto.pid ,'%')
  15. <#else >
  16. and tsd.parentdepartid=null
  17. </#if>
  18. AND tsd. STATUS = '0'
  19. )
  20. and bu.delete_flag='0'