UserIdentityMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  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.UserIdentityMapper" >
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserIdentity" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="uid" property="uid" jdbcType="VARCHAR" />
  7. <result column="username" property="username" jdbcType="VARCHAR" />
  8. <result column="sex" property="sex" jdbcType="VARCHAR" />
  9. <result column="date_of_birth_year" property="dateOfBirthYear" jdbcType="VARCHAR" />
  10. <result column="date_of_birth_month" property="dateOfBirthMonth" jdbcType="VARCHAR" />
  11. <result column="id_number" property="idNumber" jdbcType="VARCHAR" />
  12. <result column="positive_id_url" property="positiveIdUrl" jdbcType="VARCHAR" />
  13. <result column="opposite_id_url" property="oppositeIdUrl" jdbcType="VARCHAR" />
  14. <result column="aft_username" property="aftUsername" jdbcType="VARCHAR" />
  15. <result column="province" property="province" jdbcType="INTEGER" />
  16. <result column="city" property="city" jdbcType="INTEGER" />
  17. <result column="area" property="area" jdbcType="INTEGER" />
  18. <result column="contact_mobile" property="contactMobile" jdbcType="VARCHAR" />
  19. <result column="bank_name" property="bankName" jdbcType="VARCHAR" />
  20. <result column="bank_account" property="bankAccount" jdbcType="VARCHAR" />
  21. <result column="bank_card_number" property="bankCardNumber" jdbcType="VARCHAR" />
  22. <result column="amount_money" property="amountMoney" jdbcType="DECIMAL" />
  23. <result column="audit_status" property="auditStatus" jdbcType="INTEGER" />
  24. <result column="process" property="process" jdbcType="INTEGER" />
  25. <result column="wrong_count" property="wrongCount" jdbcType="INTEGER" />
  26. <result column="payment_date" property="paymentDate" jdbcType="TIMESTAMP" />
  27. <result column="expert" property="expert" jdbcType="INTEGER" />
  28. <result column="celebrity" property="celebrity" jdbcType="INTEGER" />
  29. </resultMap>
  30. <sql id="Base_Column_List" >
  31. id, uid, username, sex, date_of_birth_year, date_of_birth_month, id_number, positive_id_url,
  32. opposite_id_url, aft_username, province, city, area, contact_mobile, bank_name, bank_account,
  33. bank_card_number, amount_money, audit_status, process , wrong_count, payment_date,
  34. expert, celebrity
  35. </sql>
  36. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  37. select
  38. <include refid="Base_Column_List" />
  39. from user_identity
  40. where id = #{id,jdbcType=VARCHAR}
  41. </select>
  42. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  43. delete from user_identity
  44. where id = #{id,jdbcType=VARCHAR}
  45. </delete>
  46. <insert id="insert" parameterType="com.goafanti.common.model.UserIdentity" >
  47. insert into user_identity (id, uid, username,
  48. sex, date_of_birth_year, date_of_birth_month,
  49. id_number, positive_id_url, opposite_id_url,
  50. aft_username, province, city,
  51. area, contact_mobile, bank_name,
  52. bank_account, bank_card_number, amount_money,
  53. audit_status, process, wrong_count, payment_date,
  54. expert, celebrity)
  55. values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR},
  56. #{sex,jdbcType=VARCHAR}, #{dateOfBirthYear,jdbcType=VARCHAR}, #{dateOfBirthMonth,jdbcType=VARCHAR},
  57. #{idNumber,jdbcType=VARCHAR}, #{positiveIdUrl,jdbcType=VARCHAR}, #{oppositeIdUrl,jdbcType=VARCHAR},
  58. #{aftUsername,jdbcType=VARCHAR}, #{province,jdbcType=INTEGER}, #{city,jdbcType=INTEGER},
  59. #{area,jdbcType=INTEGER}, #{contactMobile,jdbcType=VARCHAR}, #{bankName,jdbcType=VARCHAR},
  60. #{bankAccount,jdbcType=VARCHAR}, #{bankCardNumber,jdbcType=VARCHAR}, #{amountMoney,jdbcType=DECIMAL},
  61. #{auditStatus,jdbcType=INTEGER}, #{process,jdbcType=INTEGER}, #{wrongCount,jdbcType=INTEGER}, #{paymentDate,jdbcType=TIMESTAMP},
  62. #{expert,jdbcType=INTEGER}, #{celebrity,jdbcType=INTEGER})
  63. </insert>
  64. <insert id="insertSelective" parameterType="com.goafanti.common.model.UserIdentity" >
  65. insert into user_identity
  66. <trim prefix="(" suffix=")" suffixOverrides="," >
  67. <if test="id != null" >
  68. id,
  69. </if>
  70. <if test="uid != null" >
  71. uid,
  72. </if>
  73. <if test="username != null" >
  74. username,
  75. </if>
  76. <if test="sex != null" >
  77. sex,
  78. </if>
  79. <if test="dateOfBirthYear != null" >
  80. date_of_birth_year,
  81. </if>
  82. <if test="dateOfBirthMonth != null" >
  83. date_of_birth_month,
  84. </if>
  85. <if test="idNumber != null" >
  86. id_number,
  87. </if>
  88. <if test="positiveIdUrl != null" >
  89. positive_id_url,
  90. </if>
  91. <if test="oppositeIdUrl != null" >
  92. opposite_id_url,
  93. </if>
  94. <if test="aftUsername != null" >
  95. aft_username,
  96. </if>
  97. <if test="province != null" >
  98. province,
  99. </if>
  100. <if test="city != null" >
  101. city,
  102. </if>
  103. <if test="area != null" >
  104. area,
  105. </if>
  106. <if test="contactMobile != null" >
  107. contact_mobile,
  108. </if>
  109. <if test="bankName != null" >
  110. bank_name,
  111. </if>
  112. <if test="bankAccount != null" >
  113. bank_account,
  114. </if>
  115. <if test="bankCardNumber != null" >
  116. bank_card_number,
  117. </if>
  118. <if test="amountMoney != null" >
  119. amount_money,
  120. </if>
  121. <if test="auditStatus != null" >
  122. audit_status,
  123. </if>
  124. <if test="process != null" >
  125. process,
  126. </if>
  127. <if test="wrongCount != null" >
  128. wrong_count,
  129. </if>
  130. <if test="paymentDate != null" >
  131. payment_date,
  132. </if>
  133. <if test="expert != null" >
  134. expert,
  135. </if>
  136. <if test="celebrity != null" >
  137. celebrity,
  138. </if>
  139. </trim>
  140. <trim prefix="values (" suffix=")" suffixOverrides="," >
  141. <if test="id != null" >
  142. #{id,jdbcType=VARCHAR},
  143. </if>
  144. <if test="uid != null" >
  145. #{uid,jdbcType=VARCHAR},
  146. </if>
  147. <if test="username != null" >
  148. #{username,jdbcType=VARCHAR},
  149. </if>
  150. <if test="sex != null" >
  151. #{sex,jdbcType=VARCHAR},
  152. </if>
  153. <if test="dateOfBirthYear != null" >
  154. #{dateOfBirthYear,jdbcType=VARCHAR},
  155. </if>
  156. <if test="dateOfBirthMonth != null" >
  157. #{dateOfBirthMonth,jdbcType=VARCHAR},
  158. </if>
  159. <if test="idNumber != null" >
  160. #{idNumber,jdbcType=VARCHAR},
  161. </if>
  162. <if test="positiveIdUrl != null" >
  163. #{positiveIdUrl,jdbcType=VARCHAR},
  164. </if>
  165. <if test="oppositeIdUrl != null" >
  166. #{oppositeIdUrl,jdbcType=VARCHAR},
  167. </if>
  168. <if test="aftUsername != null" >
  169. #{aftUsername,jdbcType=VARCHAR},
  170. </if>
  171. <if test="province != null" >
  172. #{province,jdbcType=INTEGER},
  173. </if>
  174. <if test="city != null" >
  175. #{city,jdbcType=INTEGER},
  176. </if>
  177. <if test="area != null" >
  178. #{area,jdbcType=INTEGER},
  179. </if>
  180. <if test="contactMobile != null" >
  181. #{contactMobile,jdbcType=VARCHAR},
  182. </if>
  183. <if test="bankName != null" >
  184. #{bankName,jdbcType=VARCHAR},
  185. </if>
  186. <if test="bankAccount != null" >
  187. #{bankAccount,jdbcType=VARCHAR},
  188. </if>
  189. <if test="bankCardNumber != null" >
  190. #{bankCardNumber,jdbcType=VARCHAR},
  191. </if>
  192. <if test="amountMoney != null" >
  193. #{amountMoney,jdbcType=DECIMAL},
  194. </if>
  195. <if test="auditStatus != null" >
  196. #{auditStatus,jdbcType=INTEGER},
  197. </if>
  198. <if test="process != null" >
  199. #{process,jdbcType=INTEGER},
  200. </if>
  201. <if test="wrongCount != null" >
  202. #{wrongCount,jdbcType=INTEGER},
  203. </if>
  204. <if test="paymentDate != null" >
  205. #{paymentDate,jdbcType=TIMESTAMP},
  206. </if>
  207. <if test="expert != null" >
  208. #{expert,jdbcType=INTEGER},
  209. </if>
  210. <if test="celebrity != null" >
  211. #{celebrity,jdbcType=INTEGER},
  212. </if>
  213. </trim>
  214. </insert>
  215. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserIdentity" >
  216. update user_identity
  217. <set >
  218. <if test="uid != null" >
  219. uid = #{uid,jdbcType=VARCHAR},
  220. </if>
  221. <if test="username != null" >
  222. username = #{username,jdbcType=VARCHAR},
  223. </if>
  224. <if test="sex != null" >
  225. sex = #{sex,jdbcType=VARCHAR},
  226. </if>
  227. <if test="dateOfBirthYear != null" >
  228. date_of_birth_year = #{dateOfBirthYear,jdbcType=VARCHAR},
  229. </if>
  230. <if test="dateOfBirthMonth != null" >
  231. date_of_birth_month = #{dateOfBirthMonth,jdbcType=VARCHAR},
  232. </if>
  233. <if test="idNumber != null" >
  234. id_number = #{idNumber,jdbcType=VARCHAR},
  235. </if>
  236. <if test="positiveIdUrl != null" >
  237. positive_id_url = #{positiveIdUrl,jdbcType=VARCHAR},
  238. </if>
  239. <if test="oppositeIdUrl != null" >
  240. opposite_id_url = #{oppositeIdUrl,jdbcType=VARCHAR},
  241. </if>
  242. <if test="aftUsername != null" >
  243. aft_username = #{aftUsername,jdbcType=VARCHAR},
  244. </if>
  245. <if test="province != null" >
  246. province = #{province,jdbcType=INTEGER},
  247. </if>
  248. <if test="city != null" >
  249. city = #{city,jdbcType=INTEGER},
  250. </if>
  251. <if test="area != null" >
  252. area = #{area,jdbcType=INTEGER},
  253. </if>
  254. <if test="contactMobile != null" >
  255. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  256. </if>
  257. <if test="bankName != null" >
  258. bank_name = #{bankName,jdbcType=VARCHAR},
  259. </if>
  260. <if test="bankAccount != null" >
  261. bank_account = #{bankAccount,jdbcType=VARCHAR},
  262. </if>
  263. <if test="bankCardNumber != null" >
  264. bank_card_number = #{bankCardNumber,jdbcType=VARCHAR},
  265. </if>
  266. <if test="amountMoney != null" >
  267. amount_money = #{amountMoney,jdbcType=DECIMAL},
  268. </if>
  269. <if test="auditStatus != null" >
  270. audit_status = #{auditStatus,jdbcType=INTEGER},
  271. </if>
  272. <if test="process != null" >
  273. process = #{process,jdbcType=INTEGER},
  274. </if>
  275. <if test="wrongCount != null" >
  276. wrong_count = #{wrongCount,jdbcType=INTEGER},
  277. </if>
  278. <if test="paymentDate != null" >
  279. payment_date = #{paymentDate,jdbcType=TIMESTAMP},
  280. </if>
  281. <if test="expert != null" >
  282. expert = #{expert,jdbcType=INTEGER},
  283. </if>
  284. <if test="celebrity != null" >
  285. celebrity = #{celebrity,jdbcType=INTEGER},
  286. </if>
  287. </set>
  288. where id = #{id,jdbcType=VARCHAR}
  289. </update>
  290. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserIdentity" >
  291. update user_identity
  292. set uid = #{uid,jdbcType=VARCHAR},
  293. username = #{username,jdbcType=VARCHAR},
  294. sex = #{sex,jdbcType=VARCHAR},
  295. date_of_birth_year = #{dateOfBirthYear,jdbcType=VARCHAR},
  296. date_of_birth_month = #{dateOfBirthMonth,jdbcType=VARCHAR},
  297. id_number = #{idNumber,jdbcType=VARCHAR},
  298. positive_id_url = #{positiveIdUrl,jdbcType=VARCHAR},
  299. opposite_id_url = #{oppositeIdUrl,jdbcType=VARCHAR},
  300. aft_username = #{aftUsername,jdbcType=VARCHAR},
  301. province = #{province,jdbcType=INTEGER},
  302. city = #{city,jdbcType=INTEGER},
  303. area = #{area,jdbcType=INTEGER},
  304. contact_mobile = #{contactMobile,jdbcType=VARCHAR},
  305. bank_name = #{bankName,jdbcType=VARCHAR},
  306. bank_account = #{bankAccount,jdbcType=VARCHAR},
  307. bank_card_number = #{bankCardNumber,jdbcType=VARCHAR},
  308. amount_money = #{amountMoney,jdbcType=DECIMAL},
  309. audit_status = #{auditStatus,jdbcType=INTEGER},
  310. process = #{process,jdbcType=INTEGER},
  311. wrong_count = #{wrongCount,jdbcType=INTEGER},
  312. payment_date = #{paymentDate,jdbcType=TIMESTAMP},
  313. expert = #{expert,jdbcType=INTEGER},
  314. celebrity = #{celebrity,jdbcType=INTEGER}
  315. where id = #{id,jdbcType=VARCHAR}
  316. </update>
  317. <select id="selectUserIdentityByUserId" parameterType="java.lang.String" resultMap="BaseResultMap">
  318. select
  319. <include refid="Base_Column_List" />
  320. from user_identity
  321. where uid = #{uid,jdbcType=VARCHAR}
  322. </select>
  323. <select id="selectUserIdentityBoByUserId" parameterType="java.lang.String" resultType="com.goafanti.user.bo.UserIdentityBo">
  324. select
  325. t.id, t.uid, t.username, t.sex, t.date_of_birth_year as dateOfBirthYear,
  326. t.date_of_birth_month as dateOfBirthMonth, t.id_number as idNumber, t.audit_status as auditStatus,
  327. u.mobile, u.number from user u left JOIN user_identity t
  328. on t.uid = u.id where t.uid=#{uid,jdbcType=VARCHAR}
  329. </select>
  330. <select id="selectAuditorUserIdentityByUserId" parameterType="java.lang.String" resultType="com.goafanti.user.bo.AuditorUserIdentityDetailBo">
  331. select
  332. u.aid,
  333. u.mid,
  334. ui.id,
  335. ui.uid,
  336. ui.username,
  337. ui.sex,
  338. ui.date_of_birth_year as dateOfBirthYear,
  339. ui.date_of_birth_month as dateOfBirthMonth,
  340. ui.id_number as idNumber,
  341. ui.positive_id_url as positiveIdUrl,
  342. ui.opposite_id_url as oppositeIdUrl,
  343. ui.aft_username as aftUsername,
  344. ui.province,
  345. ui.city,
  346. ui.area,
  347. ui.contact_mobile as contactMobile,
  348. ui.bank_name as bankName,
  349. ui.bank_account as bankAccount,
  350. ui.bank_card_number as bankCardNumber,
  351. ui.amount_money as amountMoney,
  352. ui.audit_status as auditStatus,
  353. ui.payment_date as paymentDate,
  354. ui.expert,
  355. ui.celebrity
  356. from user u
  357. LEFT JOIN user_identity ui on u.id = ui.uid
  358. where u.id = #{uid,jdbcType=VARCHAR}
  359. </select>
  360. <select id="selectManagerUserNames" resultType="com.goafanti.user.bo.UserNames"
  361. parameterType="java.lang.String">
  362. select u.id as uid, i.username
  363. from user u INNER JOIN
  364. user_identity i on u.id = i.uid
  365. where
  366. i.audit_status = 5 and u.lvl = 1
  367. <if test="_parameter != null">
  368. and u.mid = #{aid,jdbcType=VARCHAR}
  369. </if>
  370. </select>
  371. <select id="selectAllUserNames" resultType="com.goafanti.user.bo.UserNames"
  372. parameterType="java.lang.String">
  373. select u.id as uid, i.username
  374. from user u INNER JOIN
  375. user_identity i on u.id = i.uid
  376. where
  377. i.audit_status = 5 and u.lvl = 1
  378. <if test="_parameter != null">
  379. and u.aid = #{aid,jdbcType=VARCHAR}
  380. </if>
  381. </select>
  382. <select id="selectManagerAchievementUserOwner" resultType="com.goafanti.user.bo.UserNames">
  383. select u.id as uid, ui.username, u.mobile
  384. from user u INNER JOIN
  385. user_identity ui on u.id = ui.uid
  386. where
  387. ui.audit_status = 5 and u.lvl = 1 and ui.username like
  388. "%"#{name,jdbcType=VARCHAR}"%"
  389. <if test="aid != null">
  390. and u.mid = #{aid,jdbcType=VARCHAR}
  391. </if>
  392. </select>
  393. <select id="selectAchievementUserOwner" resultType="com.goafanti.user.bo.UserNames">
  394. select u.id as uid, ui.username, u.mobile
  395. from user u INNER JOIN
  396. user_identity ui on u.id = ui.uid
  397. where
  398. ui.audit_status = 5 and u.lvl = 1 and ui.username like
  399. "%"#{name,jdbcType=VARCHAR}"%"
  400. <if test="aid != null">
  401. and u.aid = #{aid,jdbcType=VARCHAR}
  402. </if>
  403. </select>
  404. <select id="findSearchSubscriberListByPage" parameterType="String" resultType="com.goafanti.portal.bo.UserSubscriberListBo">
  405. SELECT
  406. u.id as uid, ui.username, u.number,
  407. ui.id as identityId, ui.province,
  408. info.person_portrait_url as personPortraitUrl,
  409. adc.achievement_count as achievementNum,
  410. adc.demand_count as demandNum,
  411. uc.engaged_field as engagedField,
  412. uc.work_unit as workUnit,
  413. uc.position
  414. FROM
  415. <![CDATA[ user ]]> u
  416. LEFT JOIN user_identity ui ON ui.uid = u.id
  417. LEFT JOIN user_career uc ON uc.uid = u.id
  418. LEFT JOIN user_info info ON info.uid = u.id
  419. LEFT JOIN achievement_demand_count adc ON adc.uid = u.id
  420. WHERE
  421. u.type = 0
  422. <if test="null != level and level==1 ">
  423. AND u.lvl <![CDATA[ >= ]]> 1
  424. </if>
  425. <if test="null !=level and level==0" >
  426. AND u.lvl = 0
  427. </if>
  428. <if test="province != null">
  429. AND ui.province = #{province,jdbcType=INTEGER}
  430. </if>
  431. <if test="city != null">
  432. AND ui.city = #{city,jdbcType=INTEGER}
  433. </if>
  434. <if test="area != null">
  435. AND ui.area = #{area,jdbcType=INTEGER}
  436. </if>
  437. <if test="field != null">
  438. AND uc.engaged_field like CONCAT(#{field,jdbcType=VARCHAR}, '%')
  439. </if>
  440. <if test="name != null">
  441. AND ui.username like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
  442. </if>
  443. ORDER BY
  444. u.number
  445. <if test="page_sql!=null">
  446. ${page_sql}
  447. </if>
  448. </select>
  449. <select id="findSearchSubscriberCount" parameterType="String" resultType="java.lang.Integer">
  450. SELECT
  451. count(1)
  452. FROM
  453. <![CDATA[ user ]]> u
  454. LEFT JOIN user_identity ui ON ui.uid = u.id
  455. LEFT JOIN user_career uc ON uc.uid = u.id
  456. WHERE
  457. u.type = 0
  458. <if test="null != level and level==1 ">
  459. AND u.lvl <![CDATA[ >= ]]> 1
  460. </if>
  461. <if test="null != level and level==0" >
  462. AND u.lvl = 0
  463. </if>
  464. <if test="province != null">
  465. AND ui.province = #{province,jdbcType=INTEGER}
  466. </if>
  467. <if test="city != null">
  468. AND ui.city = #{city,jdbcType=INTEGER}
  469. </if>
  470. <if test="area != null">
  471. AND ui.area = #{area,jdbcType=INTEGER}
  472. </if>
  473. <if test="field != null">
  474. AND uc.engaged_field like CONCAT(#{field,jdbcType=VARCHAR}, '%')
  475. </if>
  476. <if test="name != null">
  477. AND ui.username like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
  478. </if>
  479. </select>
  480. <select id="selectInternationalUser" resultType="com.goafanti.portal.bo.InternationalListBo">
  481. select
  482. a.id,
  483. b.username as ownerName,
  484. c.ability_label as abilityLabel,
  485. d.person_portrait_url personPortraitUrl,
  486. e.education
  487. from user a
  488. left join user_identity b
  489. on a.id = b.uid
  490. left join user_ability c
  491. on a.id = c.uid
  492. left join user_info d
  493. on a.id = d.uid
  494. left join user_edu e
  495. on a.id = e.uid
  496. where 1=1
  497. <!-- and b.international_flag and b.audit_status = 5 and b.expert = 1 -->
  498. order by
  499. a.create_time desc
  500. limit 0,6
  501. </select>
  502. </mapper>