UserMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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.goafanti.common.dao.UserMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.User">
  5. <id column="id" jdbcType="VARCHAR" property="id" />
  6. <result column="mobile" jdbcType="VARCHAR" property="mobile" />
  7. <result column="password" jdbcType="VARCHAR" property="password" />
  8. <result column="nickname" jdbcType="VARCHAR" property="nickname" />
  9. <result column="email" jdbcType="VARCHAR" property="email" />
  10. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  11. <result column="number" jdbcType="BIGINT" property="number" />
  12. <result column="lvl" jdbcType="INTEGER" property="lvl" />
  13. <result column="type" jdbcType="INTEGER" property="type" />
  14. <result column="aid" jdbcType="VARCHAR" property="aid" />
  15. </resultMap>
  16. <resultMap type="com.goafanti.user.bo.UserPageHomeBo" id="UserPageHomeBo">
  17. <id column="id" jdbcType="VARCHAR" property="id" />
  18. <result column="uid" jdbcType="VARCHAR" property="uid"/>
  19. <result column="lvl" jdbcType="INTEGER" property="lvl"/>
  20. <result column="nickname" jdbcType="VARCHAR" property="nickname"/>
  21. <result column="email" jdbcType="VARCHAR" property="email"/>
  22. <result column="number" jdbcType="INTEGER" property="number"/>
  23. <result column="type" jdbcType="INTEGER" property="type"/>
  24. <result column="person_portrait_url" jdbcType="VARCHAR" property="personPortraitUrl"/>
  25. </resultMap>
  26. <resultMap type="com.goafanti.user.bo.UserDownLoadBo" id="UserDownLoadBo">
  27. <id column="id" jdbcType="VARCHAR" property="id" />
  28. <result column="diploma_url" jdbcType="VARCHAR" property="diplomaUrl"/>
  29. <result column="degree_diploma_url" jdbcType="VARCHAR" property="degreeDiplomaUrl"/>
  30. <result column="professional_certificate_url" jdbcType="VARCHAR" property="professionalCertificateUrl"/>
  31. <result column="qualification_certificate_url" jdbcType="VARCHAR" property="qualificationCertificateUrl"/>
  32. <result column="positive_id_url" jdbcType="VARCHAR" property="positiveIdUrl"/>
  33. <result column="opposite_id_url" jdbcType="VARCHAR" property="oppositeIdUrl"/>
  34. </resultMap>
  35. <sql id="Base_Column_List">
  36. id, mobile, password, nickname, email, create_time, number, lvl, type, aid
  37. </sql>
  38. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  39. select
  40. <include refid="Base_Column_List" />
  41. from user
  42. where id = #{id,jdbcType=VARCHAR}
  43. </select>
  44. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  45. delete from user
  46. where id = #{id,jdbcType=VARCHAR}
  47. </delete>
  48. <insert id="insert" parameterType="com.goafanti.common.model.User">
  49. insert into user (id, mobile, password,
  50. nickname, email, create_time,
  51. number, lvl, type, aid)
  52. values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
  53. #{nickname,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  54. #{number,jdbcType=BIGINT}, #{lvl,jdbcType=INTEGER},#{type,jdbcType=INTEGER}, #{aid,jdbcType=VARCHAR})
  55. </insert>
  56. <insert id="insertSelective" parameterType="com.goafanti.common.model.User">
  57. insert into user
  58. <trim prefix="(" suffix=")" suffixOverrides=",">
  59. <if test="id != null">
  60. id,
  61. </if>
  62. <if test="mobile != null">
  63. mobile,
  64. </if>
  65. <if test="password != null">
  66. password,
  67. </if>
  68. <if test="nickname != null">
  69. nickname,
  70. </if>
  71. <if test="email != null">
  72. email,
  73. </if>
  74. <if test="createTime != null">
  75. create_time,
  76. </if>
  77. <if test="number != null">
  78. number,
  79. </if>
  80. <if test="lvl != null">
  81. lvl,
  82. </if>
  83. <if test="type != null">
  84. type,
  85. </if>
  86. <if test="aid != null">
  87. aid,
  88. </if>
  89. </trim>
  90. <trim prefix="values (" suffix=")" suffixOverrides=",">
  91. <if test="id != null">
  92. #{id,jdbcType=VARCHAR},
  93. </if>
  94. <if test="mobile != null">
  95. #{mobile,jdbcType=VARCHAR},
  96. </if>
  97. <if test="password != null">
  98. #{password,jdbcType=VARCHAR},
  99. </if>
  100. <if test="nickname != null">
  101. #{nickname,jdbcType=VARCHAR},
  102. </if>
  103. <if test="email != null">
  104. #{email,jdbcType=VARCHAR},
  105. </if>
  106. <if test="createTime != null">
  107. #{createTime,jdbcType=TIMESTAMP},
  108. </if>
  109. <if test="number != null">
  110. #{number,jdbcType=BIGINT},
  111. </if>
  112. <if test="lvl != null">
  113. #{lvl,jdbcType=BIGINT},
  114. </if>
  115. <if test="type != null">
  116. #{type,jdbcType=INTEGER},
  117. </if>
  118. <if test="aid != null">
  119. #{aid,jdbcType=VARCHAR},
  120. </if>
  121. </trim>
  122. </insert>
  123. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.User">
  124. update user
  125. <set>
  126. <if test="mobile != null">
  127. mobile = #{mobile,jdbcType=VARCHAR},
  128. </if>
  129. <if test="password != null">
  130. password = #{password,jdbcType=VARCHAR},
  131. </if>
  132. <if test="nickname != null">
  133. nickname = #{nickname,jdbcType=VARCHAR},
  134. </if>
  135. <if test="email != null">
  136. email = #{email,jdbcType=VARCHAR},
  137. </if>
  138. <if test="createTime != null">
  139. create_time = #{createTime,jdbcType=TIMESTAMP},
  140. </if>
  141. <if test="number != null">
  142. number = #{number,jdbcType=BIGINT},
  143. </if>
  144. <if test="lvl != null">
  145. lvl = #{lvl,jdbcType=INTEGER},
  146. </if>
  147. <if test="type != null">
  148. type = #{type,jdbcType=INTEGER},
  149. </if>
  150. <if test="aid != null">
  151. aid = #{aid,jdbcType=VARCHAR}
  152. </if>
  153. </set>
  154. where id = #{id,jdbcType=VARCHAR}
  155. </update>
  156. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.User">
  157. update user
  158. set mobile = #{mobile,jdbcType=VARCHAR},
  159. password = #{password,jdbcType=VARCHAR},
  160. nickname = #{nickname,jdbcType=VARCHAR},
  161. email = #{email,jdbcType=VARCHAR},
  162. create_time = #{createTime,jdbcType=TIMESTAMP},
  163. number = #{number,jdbcType=BIGINT},
  164. lvl = #{lvl,jdbcType=INTEGER},
  165. type = #{type,jdbcType=INTEGER},
  166. aid = #{aid,jdbcType=VARCHAR}
  167. where id = #{id,jdbcType=VARCHAR}
  168. </update>
  169. <select id="selectByMobieAndType" resultMap="BaseResultMap">
  170. select
  171. <include refid="Base_Column_List" />
  172. from user
  173. where mobile = #{0} and type=#{1}
  174. </select>
  175. <select id="selectUserPageHomeBoByUserId" resultMap="UserPageHomeBo" parameterType="java.lang.String">
  176. select u.lvl,u.nickname,u.email,u.number,u.type,i.person_portrait_url, o.logo_url ,i.id ,i.uid from user u LEFT JOIN user_info i
  177. on u.id = i.uid
  178. LEFT JOIN organization_info o on u.id = o.uid where u.id = #{uid,jdbcType = VARCHAR}
  179. </select>
  180. <select id="selectUserDownLoadBoByUserId" resultMap="UserDownLoadBo" parameterType="java.lang.String">
  181. select u.id,i.positive_id_url ,i.opposite_id_url,c.professional_certificate_url,c.qualification_certificate_url,
  182. e.diploma_url, e.degree_diploma_url
  183. from user u
  184. LEFT JOIN user_identity i on u.id = i.uid
  185. LEFT JOIN user_career c on u.id = c.uid
  186. LEFT JOIN user_edu e on u.id = e.uid
  187. where u.id =#{id,jdbcType=VARCHAR}
  188. </select>
  189. <select id="findUserListByPage" parameterType="String" resultType="com.goafanti.user.bo.UserListBo">
  190. select u.id ,u.mobile, u.email, u.create_time as createTime,
  191. u.number , i.aft_username as aftUsername, i.audit_status as auditStatus, a.name as adminName
  192. from user u
  193. LEFT JOIN admin a on a.id = u.aid
  194. LEFT JOIN user_identity i
  195. ON u.id = i.uid where u.type = 0
  196. <if test = "mobile != null">
  197. and u.mobile = #{mobile,jdbcType=VARCHAR}
  198. </if>
  199. <if test = "email != null">
  200. and u.email = #{email,jdbcType=VARCHAR}
  201. </if>
  202. <if test = "pStart != null" >
  203. and u.create_time <![CDATA[ > ]]> #{pStart,jdbcType=TIMESTAMP}
  204. </if>
  205. <if test = "pEnd != null">
  206. and u.create_time <![CDATA[ < ]]> #{pEnd,jdbcType=TIMESTAMP}
  207. </if>
  208. <if test=" number != null">
  209. and u.number = #{number,jdbcType=INTEGER}
  210. </if>
  211. <if test="aftUsername != null">
  212. and i.aft_username = #{aftUsername,jdbcType=VARCHAR}
  213. </if>
  214. <if test="auditStatus != null">
  215. and i.audit_status= #{auditStatus,jdbcType=INTEGER}
  216. </if>
  217. order by u.number desc
  218. <if test="page_sql!=null">
  219. ${page_sql}
  220. </if>
  221. </select>
  222. <select id="findUserCount" resultType="java.lang.Integer" parameterType="String">
  223. select count(1)
  224. from user u LEFT JOIN user_identity i
  225. ON u.id = i.uid
  226. WHERE u.type = 0
  227. <if test = "mobile != null">
  228. and u.mobile = #{mobile,jdbcType=VARCHAR}
  229. </if>
  230. <if test = "email != null">
  231. and u.email = #{email,jdbcType=VARCHAR}
  232. </if>
  233. <if test = "pStart != null" >
  234. and u.create_time <![CDATA[ > ]]> #{pStart,jdbcType=TIMESTAMP}
  235. </if>
  236. <if test = "pEnd != null">
  237. and u.create_time <![CDATA[ < ]]> #{pEnd,jdbcType=TIMESTAMP}
  238. </if>
  239. <if test="number != null">
  240. and u.number = #{number,jdbcType=INTEGER}
  241. </if>
  242. <if test="aftUsername != null">
  243. and i.aft_username = #{aftUsername,jdbcType=VARCHAR}
  244. </if>
  245. <if test="auditStatus != null">
  246. and i.audit_status= #{auditStatus,jdbcType=INTEGER}
  247. </if>
  248. </select>
  249. <select id="findOrgListByPage" parameterType="String" resultType="com.goafanti.user.bo.OrgListBo">
  250. select u.id ,u.mobile, u.email, u.create_time as createTime,
  251. u.number , o.aft_username as aftUsername, o.audit_status as auditStatus, a.name as adminName,
  252. o.unit_name as unitName
  253. from user u
  254. LEFT JOIN admin a on a.id = u.aid
  255. LEFT JOIN organization_identity o
  256. ON u.id = o.uid
  257. WHERE u.type = 1
  258. <if test = "mobile != null">
  259. and u.mobile = #{mobile,jdbcType=VARCHAR}
  260. </if>
  261. <if test = "email != null">
  262. and u.email = #{email,jdbcType=VARCHAR}
  263. </if>
  264. <if test = "pStart != null" >
  265. and u.create_time <![CDATA[ > ]]> #{pStart,jdbcType=TIMESTAMP}
  266. </if>
  267. <if test = "pEnd != null">
  268. and u.create_time <![CDATA[ < ]]> #{pEnd,jdbcType=TIMESTAMP}
  269. </if>
  270. <if test=" number != null">
  271. and u.number = #{number,jdbcType=INTEGER}
  272. </if>
  273. <if test="aftUsername != null">
  274. and o.aft_username = #{aftUsername,jdbcType=VARCHAR}
  275. </if>
  276. <if test="auditStatus != null">
  277. and o.audit_status= #{auditStatus,jdbcType=INTEGER}
  278. </if>
  279. order by u.number desc
  280. <if test="page_sql!=null">
  281. ${page_sql}
  282. </if>
  283. </select>
  284. <select id="findOrgCount" resultType="java.lang.Integer" parameterType="String">
  285. select count(1)
  286. from user u LEFT JOIN organization_identity o
  287. ON u.id = o.uid
  288. WHERE u.type = 1
  289. <if test = "mobile != null">
  290. and u.mobile = #{mobile,jdbcType=VARCHAR}
  291. </if>
  292. <if test = "email != null">
  293. and u.email = #{email,jdbcType=VARCHAR}
  294. </if>
  295. <if test = "pStart != null" >
  296. and u.create_time <![CDATA[ > ]]> #{pStart,jdbcType=TIMESTAMP}
  297. </if>
  298. <if test = "pEnd != null">
  299. and u.create_time <![CDATA[ < ]]> #{pEnd,jdbcType=TIMESTAMP}
  300. </if>
  301. <if test=" number != null">
  302. and u.number = #{number,jdbcType=INTEGER}
  303. </if>
  304. <if test="aftUsername != null">
  305. and o.aft_username = #{aftUsername,jdbcType=VARCHAR}
  306. </if>
  307. <if test="auditStatus != null">
  308. and o.audit_status= #{auditStatus,jdbcType=INTEGER}
  309. </if>
  310. </select>
  311. </mapper>