PrivatePhotoMapper.xml 5.7 KB

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