UserAndUserPersonnelMiniDao_getOnDutyUserAndUserPersonnelNoPage.sql 853 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <#-- 轮流值班人员选择页面 -->
  2. select
  3. bu.id,
  4. bu.id as userid,
  5. bu.username,
  6. bu.realname,
  7. up.in_postid,
  8. up.position_status,
  9. up.contract_stime
  10. from t_s_base_user bu
  11. LEFT JOIN t_bus_user_personnel up ON bu.ID=up.userid
  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. <#else >
  21. and bu.id=null
  22. </#if>
  23. AND bu.delete_flag = '0'
  24. <#if (userAndUserPersonnelDto.realname )?? && userAndUserPersonnelDto.realname ?length gt 0>
  25. and bu.realname like CONCAT('%', :userAndUserPersonnelDto.realname ,'%')
  26. </#if>
  27. <#--在职状态 已入职1,已转正2-->
  28. and up.position_status in ('1','2')
  29. order by convert(bu.realname using gbk) collate gbk_Chinese_ci asc