SysUserMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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="com.yonge.cooleshow.biz.dal.mapper.SysUserMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.SysUser">
  6. <id column="id_" property="id" />
  7. <result column="username_" property="username" />
  8. <result column="password_" property="password" />
  9. <result column="salt_" property="salt" />
  10. <result column="phone_" property="phone" />
  11. <result column="avatar_" property="avatar" />
  12. <result column="create_time_" property="createTime" />
  13. <result column="update_time_" property="updateTime" />
  14. <result column="lock_flag_" property="lockFlag" />
  15. <result column="wx_openid_" property="wxOpenid" />
  16. <result column="qq_openid_" property="qqOpenid" />
  17. <result column="user_type_" property="userType" />
  18. <result column="gender_" property="gender" />
  19. <result column="nation_" property="nation" />
  20. <result column="birthdate_" property="birthdate" />
  21. <result column="email_" property="email" />
  22. <result column="im_token_" property="imToken" />
  23. <result column="real_name_" property="realName" />
  24. <result column="id_card_no_" property="idCardNo" />
  25. <result column="certificate_type_" property="certificateType" />
  26. <result column="is_super_admin_" property="superAdmin" />
  27. <result column="wechat_id_" property="wechatId" />
  28. <result column="del_flag_" property="delFlag" />
  29. <result column="last_username_time_" property="lastUsernameTime" />
  30. </resultMap>
  31. <!-- 通用查询结果列 -->
  32. <sql id="Base_Column_List">
  33. id_, username_, password_, salt_, phone_, avatar_, create_time_, update_time_, lock_flag_, wx_openid_, qq_openid_, user_type_, gender_, nation_, birthdate_, email_, im_token_, real_name_, id_card_no_, certificate_type_, is_super_admin_, wechat_id_, del_flag_, last_username_time_
  34. </sql>
  35. <select id="queryCouponIssueUser" resultType="com.yonge.cooleshow.biz.dal.vo.CouponIssueUserVo">
  36. select
  37. su.id_ as userId,
  38. su.username_ as username,
  39. su.real_name_ as realName,
  40. #{client} as clientType,
  41. su.phone_ as phone
  42. from
  43. <choose>
  44. <when test="client.code == 'TEACHER'">
  45. teacher t
  46. </when>
  47. <when test="client.code == 'STUDENT'">
  48. student t
  49. </when>
  50. </choose>
  51. left join sys_user su on su.id_ = t.user_id_
  52. <where>
  53. t.lock_flag_ = 0 and su.del_flag_ = 0 AND t.tenant_id_ != -1
  54. <if test="keyword != null and keyword != ''">
  55. and (
  56. su.real_name_ like concat('%',#{keyword},'%')
  57. or su.username_ like concat('%',#{keyword},'%')
  58. or su.phone_ like concat('%',#{keyword},'%')
  59. or su.id_ like concat('%',#{keyword},'%')
  60. )
  61. </if>
  62. </where>
  63. </select>
  64. <update id="updateUserCard">
  65. UPDATE sys_user
  66. set
  67. <if test="param.realName != null and param.realName != ''">
  68. real_name_ = #{param.realName},
  69. </if>
  70. <if test="param.idCardNo != null and param.idCardNo != ''">
  71. id_card_no_ = #{param.idCardNo},
  72. </if>
  73. <if test="param.gender != null">
  74. gender_ = #{param.gender},
  75. </if>
  76. <if test="param.birthday != null">
  77. birthdate_ = #{param.birthday},
  78. </if>
  79. update_time_ = now()
  80. WHERE del_flag_ = 0 and id_ = #{param.userId}
  81. </update>
  82. <!--客服消息接收者-->
  83. <select id="selectMessageReceives"
  84. resultType="com.yonge.cooleshow.biz.dal.wrapper.im.CustomerService$MessageReceives">
  85. SELECT t1.id_ AS userId, t1.username_ FROM sys_user t1
  86. <if test="param.clientType != null">
  87. <if test="param.clientType.code == 'TEACHER'"> LEFT JOIN teacher t2 ON (t1.id_ = t2.user_id_)</if>
  88. <if test="param.clientType.code == 'STUDENT'"> LEFT JOIN student t2 ON (t1.id_ = t2.user_id_)</if>
  89. </if>
  90. <where>
  91. <if test="param.receives != null">
  92. AND t1.phone_ IN (<foreach collection="param.receives" separator="," item="item">#{item}</foreach>)
  93. </if>
  94. <if test="param.subjectId != null">
  95. AND FIND_IN_SET(#{param.subjectId}, t2.subject_id_)
  96. </if>
  97. </where>
  98. LIMIT 1500
  99. </select>
  100. <!--客服消息接收者-->
  101. </mapper>