UserReportRecordMapper.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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.UserReportRecordMapper">
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.users.UserReportRecord">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="uid" jdbcType="BIGINT" property="uid" />
  7. <result column="report_uid" jdbcType="BIGINT" property="reportUid" />
  8. <result column="device_id" jdbcType="VARCHAR" property="deviceId" />
  9. <result column="phone_no" jdbcType="VARCHAR" property="phoneNo" />
  10. <result column="ip" jdbcType="VARCHAR" property="ip" />
  11. <result column="report_type" jdbcType="CHAR" property="reportType" />
  12. <result column="type" jdbcType="CHAR" property="type" />
  13. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  14. <result column="status" jdbcType="INTEGER" property="status" />
  15. </resultMap>
  16. <sql id="Base_Column_List">
  17. id, uid, report_uid, device_id, phone_no, ip, report_type, type, create_date, status
  18. </sql>
  19. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  20. select
  21. <include refid="Base_Column_List" />
  22. from user_report_record
  23. where id = #{id,jdbcType=BIGINT}
  24. </select>
  25. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserReportRecord" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
  26. <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
  27. SELECT LAST_INSERT_ID()
  28. </selectKey>
  29. insert into user_report_record (uid, report_uid, device_id,
  30. phone_no, ip, report_type,
  31. type, create_date, status
  32. )
  33. values (#{uid,jdbcType=BIGINT}, #{reportUid,jdbcType=BIGINT}, #{deviceId,jdbcType=VARCHAR},
  34. #{phoneNo,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}, #{reportType,jdbcType=CHAR},
  35. #{type,jdbcType=CHAR}, #{createDate,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}
  36. )
  37. </insert>
  38. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserReportRecord" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
  39. <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
  40. SELECT LAST_INSERT_ID()
  41. </selectKey>
  42. insert into user_report_record
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="uid != null">
  45. uid,
  46. </if>
  47. <if test="reportUid != null">
  48. report_uid,
  49. </if>
  50. <if test="deviceId != null">
  51. device_id,
  52. </if>
  53. <if test="phoneNo != null">
  54. phone_no,
  55. </if>
  56. <if test="ip != null">
  57. ip,
  58. </if>
  59. <if test="reportType != null">
  60. report_type,
  61. </if>
  62. <if test="type != null">
  63. type,
  64. </if>
  65. <if test="createDate != null">
  66. create_date,
  67. </if>
  68. <if test="status != null">
  69. status,
  70. </if>
  71. </trim>
  72. <trim prefix="values (" suffix=")" suffixOverrides=",">
  73. <if test="uid != null">
  74. #{uid,jdbcType=BIGINT},
  75. </if>
  76. <if test="reportUid != null">
  77. #{reportUid,jdbcType=BIGINT},
  78. </if>
  79. <if test="deviceId != null">
  80. #{deviceId,jdbcType=VARCHAR},
  81. </if>
  82. <if test="phoneNo != null">
  83. #{phoneNo,jdbcType=VARCHAR},
  84. </if>
  85. <if test="ip != null">
  86. #{ip,jdbcType=VARCHAR},
  87. </if>
  88. <if test="reportType != null">
  89. #{reportType,jdbcType=CHAR},
  90. </if>
  91. <if test="type != null">
  92. #{type,jdbcType=CHAR},
  93. </if>
  94. <if test="createDate != null">
  95. #{createDate,jdbcType=TIMESTAMP},
  96. </if>
  97. <if test="status != null">
  98. #{status,jdbcType=INTEGER},
  99. </if>
  100. </trim>
  101. </insert>
  102. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserReportRecord">
  103. update user_report_record
  104. <set>
  105. <if test="uid != null">
  106. uid = #{uid,jdbcType=BIGINT},
  107. </if>
  108. <if test="reportUid != null">
  109. report_uid = #{reportUid,jdbcType=BIGINT},
  110. </if>
  111. <if test="deviceId != null">
  112. device_id = #{deviceId,jdbcType=VARCHAR},
  113. </if>
  114. <if test="phoneNo != null">
  115. phone_no = #{phoneNo,jdbcType=VARCHAR},
  116. </if>
  117. <if test="ip != null">
  118. ip = #{ip,jdbcType=VARCHAR},
  119. </if>
  120. <if test="reportType != null">
  121. report_type = #{reportType,jdbcType=CHAR},
  122. </if>
  123. <if test="type != null">
  124. type = #{type,jdbcType=CHAR},
  125. </if>
  126. <if test="createDate != null">
  127. create_date = #{createDate,jdbcType=TIMESTAMP},
  128. </if>
  129. <if test="status != null">
  130. status = #{status,jdbcType=INTEGER},
  131. </if>
  132. <if test="adminId != null">
  133. admin_id = #{adminId,jdbcType=INTEGER},
  134. </if>
  135. </set>
  136. where id = #{id,jdbcType=BIGINT}
  137. </update>
  138. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserReportRecord">
  139. update user_report_record
  140. set uid = #{uid,jdbcType=BIGINT},
  141. report_uid = #{reportUid,jdbcType=BIGINT},
  142. device_id = #{deviceId,jdbcType=VARCHAR},
  143. phone_no = #{phoneNo,jdbcType=VARCHAR},
  144. ip = #{ip,jdbcType=VARCHAR},
  145. report_type = #{reportType,jdbcType=CHAR},
  146. type = #{type,jdbcType=CHAR},
  147. create_date = #{createDate,jdbcType=TIMESTAMP},
  148. status = #{status,jdbcType=INTEGER}
  149. where id = #{id,jdbcType=BIGINT}
  150. </update>
  151. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  152. delete from user_report_record
  153. where id = #{id,jdbcType=BIGINT}
  154. </delete>
  155. <select id="selectUserReportRecordByPage" resultType="com.juxiao.xchat.module.xbd.vo.UserReportRecordVO">
  156. select uarr.id, uarr.uid, uarr.report_uid as reportUid, uarr.device_id as deviceId, uarr.type, uarr.ip, uarr.report_type as reportType, uarr.type, uarr.create_date as createDate,uarr.status,su.user_name as adminName,
  157. u.erban_no as erBanNo,u.nick ,ru.erban_no as reportErBanNo,ru.nick as reportNick
  158. from user_report_record uarr
  159. left join sys_user su on su.user_id = uarr.admin_id
  160. left join users u on u.uid = uarr.uid
  161. left join users ru on ru.uid = uarr.report_uid
  162. where 1 = 1
  163. <if test="erBanNo != null">
  164. and u.erban_no = #{erBanNo}
  165. </if>
  166. <if test="reportErBanNo != null">
  167. and ru.erban_no = #{reportErBanNo}
  168. </if>
  169. <if test="erBanNo != null and reportErBanNo != null">
  170. and u.erban_no = #{erBanNo} or ru.erban_no = #{reportErBanNo}
  171. </if>
  172. <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
  173. and uarr.create_date between #{beginTime} and #{endTime}
  174. </if>
  175. <if test="reportType != null">
  176. and uarr.report_type = #{reportType}
  177. </if>
  178. <if test="type != null">
  179. and uarr.type = #{type}
  180. </if>
  181. <if test="adminName != null and adminName != ''">
  182. and su.user_name = #{adminName}
  183. </if>
  184. order by create_date desc
  185. </select>
  186. </mapper>