UserMapper.xml 12 KB

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