WeeklyScheduleMiniDao_getUserAndUserPersonnelNoPage.sql 873 B

12345678910111213141516171819202122232425262728293031
  1. select
  2. bu.id,
  3. bu.id as userid,
  4. bu.username,
  5. bu.realname,
  6. up.in_postid,
  7. up.position_status,
  8. up.contract_stime
  9. from t_s_base_user bu
  10. LEFT JOIN t_bus_user_personnel up ON bu.ID=up.userid
  11. LEFT JOIN t_s_user_org uo ON uo.user_id = bu.id
  12. WHERE 1=1
  13. <#if ( userAndUserPersonnelDto.userIdList )?? && userAndUserPersonnelDto.userIdList ?size gt 0>
  14. and bu.id in(
  15. <#list userAndUserPersonnelDto.userIdList as item>
  16. '${item}'
  17. <#if item_has_next>,</#if>
  18. </#list>
  19. )
  20. </#if>
  21. <#if (userAndUserPersonnelDto.realname )?? && userAndUserPersonnelDto.realname ?length gt 0>
  22. and bu.realname like CONCAT('%', :userAndUserPersonnelDto.realname ,'%')
  23. </#if>
  24. AND bu.delete_flag = '0'
  25. AND uo. STATUS = '0'
  26. AND uo.ifpluralism = '0'
  27. <#--在职状态 已入职1,已转正2-->
  28. and up.position_status in ('1','2')
  29. order by convert(bu.realname using gbk) collate gbk_Chinese_ci asc