SysUsersMapper.xml 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.ubitech.ttc.dao.SysUsersMapper">
  4. <!-- 开启二级缓存 -->
  5. <!--<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>-->
  6. <select id="getSysUsersByAuthorityId" resultType="cn.ubitech.ttc.entity.SysUsers">
  7. select * from sys_users su,cloudauthoritygroup cg,cloudauthoritygroupuser cgu where cg.id = cgu.gid and cgu.userid =
  8. su.userid and cgu.isenabled = 1 and cg.id = #{gid}
  9. </select>
  10. <select id="getUserFocus" resultType="cn.ubitech.ttc.model.user.UserModel">
  11. SELECT DISTINCT su.UserId,IFNULL(su.userName,'') userName,IFNULL(su.photo,'') photo,su.mobile FROM click_record c,sys_users su WHERE
  12. c.clicktype = #{clicktype} and c.`status` = 1 and c.moduleid = #{moduleid}
  13. <if test='type == "0"'>
  14. AND c.userid = #{userid} AND su.userid = c.targetid
  15. </if>
  16. <if test='type == "1"'>
  17. AND c.targetid = #{userid} AND su.userid = c.userid
  18. </if>
  19. </select>
  20. <select id="getuserlist_1" resultType="cn.ubitech.ttc.model.user.UserModel">
  21. SELECT DISTINCT
  22. su.userid,
  23. su.username,
  24. IFNULL(su.photo, '') photo
  25. FROM click_record c,
  26. sys_users su
  27. WHERE c.userid = #{userid} and c.clicktype = 2617 and c.`status` = 1 AND su.userid = c.targetid
  28. AND (su.username like #{keyword} or su.mobile like #{keyword})
  29. </select>
  30. <select id="getuserlist_2" resultType="cn.ubitech.ttc.model.user.UserModel">
  31. SELECT DISTINCT
  32. su.userid,
  33. su.username,
  34. IFNULL(su.photo, '') photo
  35. FROM click_record c,
  36. sys_users su
  37. WHERE c.targetid = #{userid} and c.clicktype = 2617 and c.`status` = 1 AND su.userid = c.userid
  38. AND (su.username like #{keyword} or su.mobile like #{keyword})
  39. </select>
  40. <select id="getuserlist_3" resultType="cn.ubitech.ttc.model.user.UserModel">
  41. SELECT
  42. su.userid,
  43. su.username,
  44. IFNULL(su.photo, '') photo
  45. FROM (SELECT a.reciverid
  46. FROM
  47. (SELECT reciverid
  48. FROM im_user_topic iut
  49. WHERE iut.isactive = 1 AND iut.TYPE = 6202 AND iut.userid =
  50. #{userid}
  51. ) AS a LEFT JOIN (SELECT DISTINCT *
  52. from (SELECT DISTINCT cr.targetid AS userid
  53. FROM click_record cr
  54. WHERE cr.userid = #{userid} AND cr.clicktype = 2617
  55. AND cr.`status` = 1
  56. UNION ALL SELECT DISTINCT cr.userid AS userid
  57. FROM click_record cr
  58. WHERE cr.targetid = #{userid} AND cr.clicktype = 2617
  59. AND cr.`status` = 1) u) b
  60. on a.reciverid = b.userid
  61. where b.userid IS NULL) c, sys_users su
  62. WHERE su.userid = c.reciverid AND
  63. (su.username like #{keyword} or su.mobile like #{keyword})
  64. </select>
  65. <select id="selectUser" resultType="cn.ubitech.ttc.model.user.UserModel">
  66. select
  67. su.userid,
  68. su.username,
  69. IFNULL(su.photo, '') photo
  70. FROM sys_users su
  71. where (su.username like #{keyword} or su.mobile like #{keyword}) and su.IsEnabled != 2
  72. </select>
  73. <select id="getUsernameByOrgname" resultType="java.lang.String">
  74. select s.username
  75. from sys_users s
  76. left JOIN resourcelibrary r on s.userid = r.creator
  77. where r.title = #{orgName}
  78. </select>
  79. </mapper>