账号列表查询.sql 922 B

12345678910111213141516171819202122232425262728
  1. select t1.userid,
  2. t1.name,
  3. t1.createdate,
  4. t1.phonenumber,
  5. t1.status,
  6. t1.accountno,
  7. t2.usersiteid,
  8. t2.siteid,
  9. t2.usertype,
  10. t3.sitename,
  11. t4.departmentid,
  12. t4.hrid,
  13. t1.passwordchangedate,
  14. t1.isthirddeveloper
  15. from sys_users t1
  16. inner join sys_usersite t2 on t1.userid = t2.userid
  17. inner join sys_site t3 on t2.siteid = t3.siteid
  18. left join sys_hr t4 on t1.userid = t4.userid and t2.siteid = t4.siteid
  19. inner join sys_site_parameter t6 on t3.siteid = t6.siteid and t6.loginmode_account = 1
  20. where t1.accountno = $accountno$
  21. and ifnull(t1.accountno, '')!=''
  22. and t1.status in ('ACTIVE', 'INACTIVE')
  23. and (('cweb' = $systemclient$ and t3.magsite = 1) or ('cweb'!=$systemclient$ and t3.magsite = 0))
  24. order by case
  25. when t1.status = 'ACTIVE' then 1
  26. when t1.status = 'INACTIVE' then 2
  27. else 3
  28. end