UserRealNameMapper.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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.UserRealNameMapper" >
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.users.UserRealName" >
  5. <id column="uid" property="uid" jdbcType="BIGINT" />
  6. <result column="real_name" property="realName" jdbcType="VARCHAR" />
  7. <result column="id_card_no" property="idCardNo" jdbcType="VARCHAR" />
  8. <result column="id_card_front" property="idCardFront" jdbcType="VARCHAR" />
  9. <result column="id_card_opposite" property="idCardOpposite" jdbcType="VARCHAR" />
  10. <result column="id_card_handheld" property="idCardHandheld" jdbcType="VARCHAR" />
  11. <result column="phone" property="phone" jdbcType="VARCHAR" />
  12. <result column="audit_status" property="auditStatus" jdbcType="BIT" />
  13. <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
  14. <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
  15. <result column="admin_id" property="adminId" jdbcType="INTEGER" />
  16. <result column="is_first" property="isFirst" jdbcType="BIT" />
  17. </resultMap>
  18. <sql id="Base_Column_List" >
  19. uid, real_name, id_card_no, id_card_front, id_card_opposite, id_card_handheld, phone,
  20. audit_status, create_date, update_date, admin_id, is_first
  21. </sql>
  22. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
  23. select
  24. <include refid="Base_Column_List" />
  25. from user_real_name
  26. where uid = #{uid,jdbcType=BIGINT}
  27. </select>
  28. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
  29. delete from user_real_name
  30. where uid = #{uid,jdbcType=BIGINT}
  31. </delete>
  32. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserRealName" >
  33. insert into user_real_name (uid, real_name, id_card_no,
  34. id_card_front, id_card_opposite, id_card_handheld,
  35. phone, audit_status, create_date,
  36. update_date, admin_id, is_first
  37. )
  38. values (#{uid,jdbcType=BIGINT}, #{realName,jdbcType=VARCHAR}, #{idCardNo,jdbcType=VARCHAR},
  39. #{idCardFront,jdbcType=VARCHAR}, #{idCardOpposite,jdbcType=VARCHAR}, #{idCardHandheld,jdbcType=VARCHAR},
  40. #{phone,jdbcType=VARCHAR}, #{auditStatus,jdbcType=BIT}, #{createDate,jdbcType=TIMESTAMP},
  41. #{updateDate,jdbcType=TIMESTAMP}, #{adminId,jdbcType=INTEGER}, #{isFirst,jdbcType=BIT}
  42. )
  43. </insert>
  44. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserRealName" >
  45. insert into user_real_name
  46. <trim prefix="(" suffix=")" suffixOverrides="," >
  47. <if test="uid != null" >
  48. uid,
  49. </if>
  50. <if test="realName != null" >
  51. real_name,
  52. </if>
  53. <if test="idCardNo != null" >
  54. id_card_no,
  55. </if>
  56. <if test="idCardFront != null" >
  57. id_card_front,
  58. </if>
  59. <if test="idCardOpposite != null" >
  60. id_card_opposite,
  61. </if>
  62. <if test="idCardHandheld != null" >
  63. id_card_handheld,
  64. </if>
  65. <if test="phone != null" >
  66. phone,
  67. </if>
  68. <if test="auditStatus != null" >
  69. audit_status,
  70. </if>
  71. <if test="createDate != null" >
  72. create_date,
  73. </if>
  74. <if test="updateDate != null" >
  75. update_date,
  76. </if>
  77. <if test="adminId != null" >
  78. admin_id,
  79. </if>
  80. <if test="isFirst != null" >
  81. is_first,
  82. </if>
  83. </trim>
  84. <trim prefix="values (" suffix=")" suffixOverrides="," >
  85. <if test="uid != null" >
  86. #{uid,jdbcType=BIGINT},
  87. </if>
  88. <if test="realName != null" >
  89. #{realName,jdbcType=VARCHAR},
  90. </if>
  91. <if test="idCardNo != null" >
  92. #{idCardNo,jdbcType=VARCHAR},
  93. </if>
  94. <if test="idCardFront != null" >
  95. #{idCardFront,jdbcType=VARCHAR},
  96. </if>
  97. <if test="idCardOpposite != null" >
  98. #{idCardOpposite,jdbcType=VARCHAR},
  99. </if>
  100. <if test="idCardHandheld != null" >
  101. #{idCardHandheld,jdbcType=VARCHAR},
  102. </if>
  103. <if test="phone != null" >
  104. #{phone,jdbcType=VARCHAR},
  105. </if>
  106. <if test="auditStatus != null" >
  107. #{auditStatus,jdbcType=BIT},
  108. </if>
  109. <if test="createDate != null" >
  110. #{createDate,jdbcType=TIMESTAMP},
  111. </if>
  112. <if test="updateDate != null" >
  113. #{updateDate,jdbcType=TIMESTAMP},
  114. </if>
  115. <if test="adminId != null" >
  116. #{adminId,jdbcType=INTEGER},
  117. </if>
  118. <if test="isFirst != null" >
  119. #{isFirst,jdbcType=BIT},
  120. </if>
  121. </trim>
  122. </insert>
  123. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserRealName" >
  124. update user_real_name
  125. <set >
  126. <if test="realName != null" >
  127. real_name = #{realName,jdbcType=VARCHAR},
  128. </if>
  129. <if test="idCardNo != null" >
  130. id_card_no = #{idCardNo,jdbcType=VARCHAR},
  131. </if>
  132. <if test="idCardFront != null" >
  133. id_card_front = #{idCardFront,jdbcType=VARCHAR},
  134. </if>
  135. <if test="idCardOpposite != null" >
  136. id_card_opposite = #{idCardOpposite,jdbcType=VARCHAR},
  137. </if>
  138. <if test="idCardHandheld != null" >
  139. id_card_handheld = #{idCardHandheld,jdbcType=VARCHAR},
  140. </if>
  141. <if test="phone != null" >
  142. phone = #{phone,jdbcType=VARCHAR},
  143. </if>
  144. <if test="auditStatus != null" >
  145. audit_status = #{auditStatus,jdbcType=BIT},
  146. </if>
  147. <if test="createDate != null" >
  148. create_date = #{createDate,jdbcType=TIMESTAMP},
  149. </if>
  150. <if test="updateDate != null" >
  151. update_date = #{updateDate,jdbcType=TIMESTAMP},
  152. </if>
  153. <if test="adminId != null" >
  154. admin_id = #{adminId,jdbcType=INTEGER},
  155. </if>
  156. <if test="isFirst != null" >
  157. is_first = #{isFirst,jdbcType=BIT},
  158. </if>
  159. </set>
  160. where uid = #{uid,jdbcType=BIGINT}
  161. </update>
  162. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.users.UserRealName" >
  163. update user_real_name
  164. set real_name = #{realName,jdbcType=VARCHAR},
  165. id_card_no = #{idCardNo,jdbcType=VARCHAR},
  166. id_card_front = #{idCardFront,jdbcType=VARCHAR},
  167. id_card_opposite = #{idCardOpposite,jdbcType=VARCHAR},
  168. id_card_handheld = #{idCardHandheld,jdbcType=VARCHAR},
  169. phone = #{phone,jdbcType=VARCHAR},
  170. audit_status = #{auditStatus,jdbcType=BIT},
  171. create_date = #{createDate,jdbcType=TIMESTAMP},
  172. update_date = #{updateDate,jdbcType=TIMESTAMP},
  173. admin_id = #{adminId,jdbcType=INTEGER},
  174. is_first = #{isFirst,jdbcType=BIT}
  175. where uid = #{uid,jdbcType=BIGINT}
  176. </update>
  177. <select id="selectUsersRealNameByList" resultType="com.juxiao.xchat.module.xbd.vo.UserRealNameInfoVO">
  178. SELECT
  179. urn.uid AS uid,
  180. urn.real_name AS realName,
  181. urn.id_card_no AS idCardNo,
  182. urn.id_card_front AS idCardFront,
  183. urn.id_card_opposite AS idCardOpposite,
  184. urn.id_card_handheld AS idCardHandheld,
  185. urn.audit_status AS auditStatus,
  186. urn.create_date AS createDate,
  187. urn.update_date AS updateDate,
  188. urn.phone,
  189. u.erban_no AS erbanNo,
  190. urn.admin_id as adminId,
  191. su.user_name as adminName
  192. FROM
  193. user_real_name urn
  194. LEFT JOIN users u ON urn.uid = u.uid
  195. left join sys_user su on su.user_id = urn.admin_id
  196. <where>
  197. 1=1
  198. <if test="erBanNo != null">
  199. AND u.erban_no = #{erBanNo}
  200. </if>
  201. <if test="status != null">
  202. AND urn.audit_status = #{status}
  203. </if>
  204. <if test="idCard != null and idCard != ''">
  205. AND urn.id_card_no = #{idCard}
  206. </if>
  207. <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
  208. AND urn.create_date between #{beginTime} and #{endTime}
  209. </if>
  210. <if test="adminName != null and adminName != ''">
  211. AND su.user_name = #{adminName}
  212. </if>
  213. </where>
  214. ORDER BY createDate desc
  215. </select>
  216. <select id="countByIdCardNoOrIsFirst" resultType="java.lang.Integer">
  217. select count(*) from user_real_name where id_card_no = #{idCardNo} and is_first = #{isFirst}
  218. </select>
  219. </mapper>