UsersAvatarMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.juxiao.xchat.module.xbd.mapper.users.UsersAvatarMapper" >
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.users.UsersAvatar" >
  5. <id column="uid" property="uid" jdbcType="BIGINT" />
  6. <result column="avatar" property="avatar" jdbcType="VARCHAR" />
  7. <result column="avatar_status" property="avatarStatus" jdbcType="TINYINT" />
  8. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  9. <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
  10. <result column="admin_id" property="adminId" jdbcType="INTEGER" />
  11. </resultMap>
  12. <sql id="Base_Column_List" >
  13. uid, avatar, avatar_status, create_time, update_time, admin_id
  14. </sql>
  15. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
  16. select
  17. <include refid="Base_Column_List" />
  18. from users_avatar
  19. where uid = #{uid,jdbcType=BIGINT}
  20. </select>
  21. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
  22. delete from users_avatar
  23. where uid = #{uid,jdbcType=BIGINT}
  24. </delete>
  25. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.users.UsersAvatar" >
  26. insert into users_avatar (uid, avatar, avatar_status,
  27. create_time, update_time, admin_id
  28. )
  29. values (#{uid,jdbcType=BIGINT}, #{avatar,jdbcType=VARCHAR}, #{avatarStatus,jdbcType=TINYINT},
  30. #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{adminId,jdbcType=INTEGER}
  31. )
  32. </insert>
  33. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.UsersAvatar" >
  34. insert into users_avatar
  35. <trim prefix="(" suffix=")" suffixOverrides="," >
  36. <if test="uid != null" >
  37. uid,
  38. </if>
  39. <if test="avatar != null" >
  40. avatar,
  41. </if>
  42. <if test="avatarStatus != null" >
  43. avatar_status,
  44. </if>
  45. <if test="createTime != null" >
  46. create_time,
  47. </if>
  48. <if test="updateTime != null" >
  49. update_time,
  50. </if>
  51. <if test="adminId != null" >
  52. admin_id,
  53. </if>
  54. </trim>
  55. <trim prefix="values (" suffix=")" suffixOverrides="," >
  56. <if test="uid != null" >
  57. #{uid,jdbcType=BIGINT},
  58. </if>
  59. <if test="avatar != null" >
  60. #{avatar,jdbcType=VARCHAR},
  61. </if>
  62. <if test="avatarStatus != null" >
  63. #{avatarStatus,jdbcType=TINYINT},
  64. </if>
  65. <if test="createTime != null" >
  66. #{createTime,jdbcType=TIMESTAMP},
  67. </if>
  68. <if test="updateTime != null" >
  69. #{updateTime,jdbcType=TIMESTAMP},
  70. </if>
  71. <if test="adminId != null" >
  72. #{adminId,jdbcType=INTEGER},
  73. </if>
  74. </trim>
  75. </insert>
  76. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.UsersAvatar" >
  77. update users_avatar
  78. <set >
  79. <if test="avatar != null" >
  80. avatar = #{avatar,jdbcType=VARCHAR},
  81. </if>
  82. <if test="avatarStatus != null" >
  83. avatar_status = #{avatarStatus,jdbcType=TINYINT},
  84. </if>
  85. <if test="createTime != null" >
  86. create_time = #{createTime,jdbcType=TIMESTAMP},
  87. </if>
  88. <if test="updateTime != null" >
  89. update_time = #{updateTime,jdbcType=TIMESTAMP},
  90. </if>
  91. <if test="adminId != null" >
  92. admin_id = #{adminId,jdbcType=INTEGER},
  93. </if>
  94. </set>
  95. where uid = #{uid,jdbcType=BIGINT}
  96. </update>
  97. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.users.UsersAvatar" >
  98. update users_avatar
  99. set avatar = #{avatar,jdbcType=VARCHAR},
  100. avatar_status = #{avatarStatus,jdbcType=TINYINT},
  101. create_time = #{createTime,jdbcType=TIMESTAMP},
  102. update_time = #{updateTime,jdbcType=TIMESTAMP},
  103. admin_id = #{adminId,jdbcType=INTEGER}
  104. where uid = #{uid,jdbcType=BIGINT}
  105. </update>
  106. <select id="selectUsersAvatarByList" resultType="com.juxiao.xchat.module.xbd.vo.UsersAvatarVO">
  107. SELECT u.uid, u.erban_no as erBanNo, u.nick, u.avatar, ua.avatar as newAvatar, ua.avatar_status as avatarStatus, ua.create_time as createTime, ua.update_time as updateTime,ua.admin_id as adminId
  108. from users u
  109. INNER JOIN users_avatar ua on u.uid = ua.uid
  110. left join sys_user su on ua.admin_id = su.user_id
  111. <where>
  112. <if test="erBanNo != null">
  113. AND u.erban_no = #{erBanNo}
  114. </if>
  115. <if test="status != null">
  116. AND ua.avatar_status = #{status}
  117. </if>
  118. <if test="adminName != null and adminName != ''">
  119. AND su.user_name = #{adminName}
  120. </if>
  121. <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
  122. AND ua.update_time between #{beginTime} and #{endTime}
  123. </if>
  124. </where>
  125. ORDER BY ua.create_time desc , ua.update_time desc
  126. </select>
  127. </mapper>