UserMapper.xml 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939
  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. <result column="mid" jdbcType="VARCHAR" property="mid" />
  16. </resultMap>
  17. <resultMap type="com.goafanti.user.bo.UserPageHomeBo" id="UserPageHomeBo">
  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. <result column="grade_name" jdbcType="VARCHAR" property="gradeName"/>
  27. </resultMap>
  28. <resultMap type="com.goafanti.user.bo.UserDownLoadBo" id="UserDownLoadBo">
  29. <id column="id" jdbcType="VARCHAR" property="id" />
  30. <result column="diploma_url" jdbcType="VARCHAR" property="diplomaUrl"/>
  31. <result column="degree_diploma_url" jdbcType="VARCHAR" property="degreeDiplomaUrl"/>
  32. <result column="professional_certificate_url" jdbcType="VARCHAR" property="professionalCertificateUrl"/>
  33. <result column="qualification_certificate_url" jdbcType="VARCHAR" property="qualificationCertificateUrl"/>
  34. <result column="positive_id_url" jdbcType="VARCHAR" property="positiveIdUrl"/>
  35. <result column="opposite_id_url" jdbcType="VARCHAR" property="oppositeIdUrl"/>
  36. </resultMap>
  37. <sql id="Base_Column_List">
  38. id, mobile, password, nickname, email, create_time, number, lvl, type, aid, mid
  39. </sql>
  40. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  41. select
  42. <include refid="Base_Column_List" />
  43. from user
  44. where id = #{id,jdbcType=VARCHAR}
  45. </select>
  46. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  47. delete from user
  48. where id = #{id,jdbcType=VARCHAR}
  49. </delete>
  50. <insert id="insert" parameterType="com.goafanti.common.model.User">
  51. insert into user (id, mobile, password,
  52. nickname, email, create_time,
  53. number, lvl, type, aid, mid)
  54. values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
  55. #{nickname,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
  56. #{number,jdbcType=BIGINT}, #{lvl,jdbcType=INTEGER},#{type,jdbcType=INTEGER}, #{aid,jdbcType=VARCHAR},
  57. #{mid,jdbcType=VARCHAR}
  58. )
  59. </insert>
  60. <insert id="insertSelective" parameterType="com.goafanti.common.model.User">
  61. insert into user
  62. <trim prefix="(" suffix=")" suffixOverrides=",">
  63. <if test="id != null">
  64. id,
  65. </if>
  66. <if test="mobile != null">
  67. mobile,
  68. </if>
  69. <if test="password != null">
  70. password,
  71. </if>
  72. <if test="nickname != null">
  73. nickname,
  74. </if>
  75. <if test="email != null">
  76. email,
  77. </if>
  78. <if test="createTime != null">
  79. create_time,
  80. </if>
  81. <if test="number != null">
  82. number,
  83. </if>
  84. <if test="lvl != null">
  85. lvl,
  86. </if>
  87. <if test="type != null">
  88. type,
  89. </if>
  90. <if test="aid != null">
  91. aid,
  92. </if>
  93. <if test="mid != null">
  94. mid,
  95. </if>
  96. </trim>
  97. <trim prefix="values (" suffix=")" suffixOverrides=",">
  98. <if test="id != null">
  99. #{id,jdbcType=VARCHAR},
  100. </if>
  101. <if test="mobile != null">
  102. #{mobile,jdbcType=VARCHAR},
  103. </if>
  104. <if test="password != null">
  105. #{password,jdbcType=VARCHAR},
  106. </if>
  107. <if test="nickname != null">
  108. #{nickname,jdbcType=VARCHAR},
  109. </if>
  110. <if test="email != null">
  111. #{email,jdbcType=VARCHAR},
  112. </if>
  113. <if test="createTime != null">
  114. #{createTime,jdbcType=TIMESTAMP},
  115. </if>
  116. <if test="number != null">
  117. #{number,jdbcType=BIGINT},
  118. </if>
  119. <if test="lvl != null">
  120. #{lvl,jdbcType=BIGINT},
  121. </if>
  122. <if test="type != null">
  123. #{type,jdbcType=INTEGER},
  124. </if>
  125. <if test="aid != null">
  126. #{aid,jdbcType=VARCHAR},
  127. </if>
  128. <if test="mid != null">
  129. #{mid,jdbcType=VARCHAR},
  130. </if>
  131. </trim>
  132. </insert>
  133. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.User">
  134. update user
  135. <set>
  136. <if test="mobile != null">
  137. mobile = #{mobile,jdbcType=VARCHAR},
  138. </if>
  139. <if test="password != null">
  140. password = #{password,jdbcType=VARCHAR},
  141. </if>
  142. <if test="nickname != null">
  143. nickname = #{nickname,jdbcType=VARCHAR},
  144. </if>
  145. <if test="email != null">
  146. email = #{email,jdbcType=VARCHAR},
  147. </if>
  148. <if test="createTime != null">
  149. create_time = #{createTime,jdbcType=TIMESTAMP},
  150. </if>
  151. <if test="number != null">
  152. number = #{number,jdbcType=BIGINT},
  153. </if>
  154. <if test="lvl != null">
  155. lvl = #{lvl,jdbcType=INTEGER},
  156. </if>
  157. <if test="type != null">
  158. type = #{type,jdbcType=INTEGER},
  159. </if>
  160. <if test="aid != null">
  161. aid = #{aid,jdbcType=VARCHAR},
  162. </if>
  163. <if test="mid != null">
  164. mid = #{mid,jdbcType=VARCHAR},
  165. </if>
  166. </set>
  167. where id = #{id,jdbcType=VARCHAR}
  168. </update>
  169. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.User">
  170. update user
  171. set mobile = #{mobile,jdbcType=VARCHAR},
  172. password = #{password,jdbcType=VARCHAR},
  173. nickname = #{nickname,jdbcType=VARCHAR},
  174. email = #{email,jdbcType=VARCHAR},
  175. create_time = #{createTime,jdbcType=TIMESTAMP},
  176. number = #{number,jdbcType=BIGINT},
  177. lvl = #{lvl,jdbcType=INTEGER},
  178. type = #{type,jdbcType=INTEGER},
  179. aid = #{aid,jdbcType=VARCHAR},
  180. mid = #{mid,jdbcType=VARCHAR}
  181. where id = #{id,jdbcType=VARCHAR}
  182. </update>
  183. <select id="selectByMobieAndType" resultMap="BaseResultMap">
  184. select
  185. <include refid="Base_Column_List" />
  186. from user
  187. where mobile = #{0} and type=#{1}
  188. </select>
  189. <select id="selectUserPageHomeBoByUserId" resultMap="UserPageHomeBo" parameterType="java.lang.String">
  190. select
  191. u.lvl, mg.grade_name , u.nickname, u.email,
  192. u.number, u.type, i.person_portrait_url,
  193. o.logo_url , u.id as uid, adc.achievement_count as achievementNum,
  194. adc.demand_count as demandNum
  195. from user u
  196. LEFT JOIN user_info i on u.id = i.uid
  197. LEFT JOIN organization_info o on u.id = o.uid
  198. LEFT JOIN achievement_demand_count adc on adc.uid = u.id
  199. LEFT JOIN member_grade mg ON mg.member_rank=u.lvl
  200. where u.id = #{uid,jdbcType = VARCHAR}
  201. </select>
  202. <select id="selectUserDownLoadBoByUserId" resultMap="UserDownLoadBo" parameterType="java.lang.String">
  203. select u.id,i.positive_id_url ,i.opposite_id_url,c.professional_certificate_url,c.qualification_certificate_url,
  204. e.diploma_url, e.degree_diploma_url
  205. from user u
  206. LEFT JOIN user_identity i on u.id = i.uid
  207. LEFT JOIN user_career c on u.id = c.uid
  208. LEFT JOIN user_edu e on u.id = e.uid
  209. where u.id =#{id,jdbcType=VARCHAR}
  210. </select>
  211. <select id="findUserListByPage" parameterType="String" resultType="com.goafanti.user.bo.UserListBo">
  212. select
  213. u.id ,
  214. u.mobile,
  215. u.email,
  216. u.create_time as createTime,
  217. u.number ,
  218. i.aft_username as aftUsername,
  219. i.username,
  220. i.audit_status as auditStatus,
  221. a.name as adminName,
  222. ad.name as managerName
  223. from user u
  224. LEFT JOIN admin a on a.id = u.aid
  225. LEFT JOIN admin ad on ad.id = u.mid
  226. LEFT JOIN user_identity i
  227. ON u.id = i.uid where u.type = 0
  228. <if test = "mobile != null">
  229. and u.mobile = #{mobile,jdbcType=VARCHAR}
  230. </if>
  231. <if test = "email != null">
  232. and u.email = #{email,jdbcType=VARCHAR}
  233. </if>
  234. <if test = "pStart != null" >
  235. and u.create_time <![CDATA[ > ]]> #{pStart,jdbcType=TIMESTAMP}
  236. </if>
  237. <if test = "pEnd != null">
  238. and u.create_time <![CDATA[ < ]]> #{pEnd,jdbcType=TIMESTAMP}
  239. </if>
  240. <if test=" number != null">
  241. and u.number = #{number,jdbcType=INTEGER}
  242. </if>
  243. <if test="username != null">
  244. and i.username like CONCAT ('%',#{username,jdbcType=VARCHAR},'%')
  245. </if>
  246. <if test="auditStatus != null">
  247. and i.audit_status= #{auditStatus,jdbcType=INTEGER}
  248. </if>
  249. order by u.number desc
  250. <if test="page_sql!=null">
  251. ${page_sql}
  252. </if>
  253. </select>
  254. <select id="findUserCount" resultType="java.lang.Integer" parameterType="String">
  255. select count(1)
  256. from user u LEFT JOIN user_identity i
  257. ON u.id = i.uid
  258. WHERE u.type = 0
  259. <if test = "mobile != null">
  260. and u.mobile = #{mobile,jdbcType=VARCHAR}
  261. </if>
  262. <if test = "email != null">
  263. and u.email = #{email,jdbcType=VARCHAR}
  264. </if>
  265. <if test = "pStart != null" >
  266. and u.create_time <![CDATA[ > ]]> #{pStart,jdbcType=TIMESTAMP}
  267. </if>
  268. <if test = "pEnd != null">
  269. and u.create_time <![CDATA[ < ]]> #{pEnd,jdbcType=TIMESTAMP}
  270. </if>
  271. <if test="number != null">
  272. and u.number = #{number,jdbcType=INTEGER}
  273. </if>
  274. <if test="username != null">
  275. and i.username like CONCAT ('%',#{username,jdbcType=VARCHAR},'%')
  276. </if>
  277. <if test="auditStatus != null">
  278. and i.audit_status= #{auditStatus,jdbcType=INTEGER}
  279. </if>
  280. </select>
  281. <select id="findOrgListByPage" parameterType="String" resultType="com.goafanti.user.bo.OrgListBo">
  282. select u.id ,u.mobile, u.email, u.create_time as createTime,
  283. u.number , o.aft_username as aftUsername, o.audit_status as orgAuditStatus, a.name as adminName,
  284. o.unit_name as unitName, ad.name as managerName
  285. from user u
  286. LEFT JOIN admin a on a.id = u.aid
  287. LEFT JOIN admin ad on ad.id = u.mid
  288. LEFT JOIN organization_identity o
  289. ON u.id = o.uid
  290. WHERE u.type = 1
  291. <if test = "mobile != null">
  292. and u.mobile = #{mobile,jdbcType=VARCHAR}
  293. </if>
  294. <if test = "uid != null">
  295. and u.id = #{uid,jdbcType=VARCHAR}
  296. </if>
  297. <if test = "email != null">
  298. and u.email = #{email,jdbcType=VARCHAR}
  299. </if>
  300. <if test = "pStart != null" >
  301. and u.create_time <![CDATA[ >= ]]> #{pStart,jdbcType=TIMESTAMP}
  302. </if>
  303. <if test = "pEnd != null">
  304. and u.create_time <![CDATA[ < ]]> #{pEnd,jdbcType=TIMESTAMP}
  305. </if>
  306. <if test=" number != null">
  307. and u.number = #{number,jdbcType=INTEGER}
  308. </if>
  309. <if test="unitName != null">
  310. and o.unit_name = #{unitName,jdbcType=VARCHAR}
  311. </if>
  312. <if test="auditStatus != null">
  313. and o.audit_status= #{auditStatus,jdbcType=INTEGER}
  314. </if>
  315. order by u.number desc
  316. <if test="page_sql!=null">
  317. ${page_sql}
  318. </if>
  319. </select>
  320. <select id="findOrgCount" resultType="java.lang.Integer" parameterType="String">
  321. select count(1)
  322. from user u LEFT JOIN organization_identity o
  323. ON u.id = o.uid
  324. WHERE u.type = 1
  325. <if test = "uid != null">
  326. and u.id = #{uid,jdbcType=VARCHAR}
  327. </if>
  328. <if test = "mobile != null">
  329. and u.mobile = #{mobile,jdbcType=VARCHAR}
  330. </if>
  331. <if test = "email != null">
  332. and u.email = #{email,jdbcType=VARCHAR}
  333. </if>
  334. <if test = "pStart != null" >
  335. and u.create_time <![CDATA[ >= ]]> #{pStart,jdbcType=TIMESTAMP}
  336. </if>
  337. <if test = "pEnd != null">
  338. and u.create_time <![CDATA[ < ]]> #{pEnd,jdbcType=TIMESTAMP}
  339. </if>
  340. <if test=" number != null">
  341. and u.number = #{number,jdbcType=INTEGER}
  342. </if>
  343. <if test="unitName != null">
  344. and o.unit_name = #{unitName,jdbcType=VARCHAR}
  345. </if>
  346. <if test="auditStatus != null">
  347. and o.audit_status= #{auditStatus,jdbcType=INTEGER}
  348. </if>
  349. </select>
  350. <select id="findUserByAidWithParamsListByPage" parameterType="java.lang.String" resultType="com.goafanti.user.bo.OrgListBo">
  351. select
  352. u.id ,
  353. u.mobile,
  354. u.email,
  355. u.create_time as createTime,
  356. u.number ,
  357. a.name as adminName,
  358. ma.name as managerName,
  359. u.type,
  360. i.username,
  361. i.audit_status as userAuditStatus,
  362. i.aft_username as aftUsername
  363. from user u
  364. LEFT JOIN admin a on a.id = u.aid
  365. LEFT JOIN admin ma on ma.id = u.mid
  366. LEFT JOIN user_identity i on u.id = i.uid
  367. where u.type = 0
  368. <if test="aid != null">
  369. and u.aid = #{aid,jdbcType=VARCHAR}
  370. </if>
  371. <if test="number !=null">
  372. and u.number = #{number,jdbcType=INTEGER}
  373. </if>
  374. <if test="mobile !=null">
  375. and u.mobile= #{mobile,jdbcType=VARCHAR}
  376. </if>
  377. <if test="auditStatus !=null">
  378. and i.audit_status = #{auditStatus,jdbcType=INTEGER}
  379. </if>
  380. <if test="auditName !=null">
  381. and i.username like CONCAT('%',#{auditName,jdbcType=VARCHAR},'%')
  382. </if>
  383. <if test="email !=null">
  384. and u.email = #{email,jdbcType=VARCHAR}
  385. </if>
  386. <if test="startCreateTime !=null">
  387. and u.create_time <![CDATA[ >= ]]> #{startCreateTime,jdbcType=TIMESTAMP}
  388. </if>
  389. <if test="endCreateTime !=null">
  390. and u.create_time <![CDATA[ < ]]> #{endCreateTime,jdbcType=TIMESTAMP}
  391. </if>
  392. order by u.number desc
  393. <if test="page_sql!=null">
  394. ${page_sql}
  395. </if>
  396. </select>
  397. <select id="findUserByAidWithParamsCount" parameterType="String" resultType="java.lang.Integer">
  398. select
  399. count(1)
  400. from user u
  401. LEFT JOIN admin a on a.id = u.aid
  402. LEFT JOIN user_identity i on u.id = i.uid
  403. where u.type = 0
  404. <if test="aid != null">
  405. and u.aid = #{aid,jdbcType=VARCHAR}
  406. </if>
  407. <if test="number !=null">
  408. and u.number = #{number,jdbcType=INTEGER}
  409. </if>
  410. <if test="mobile !=null">
  411. and u.mobile= #{mobile,jdbcType=VARCHAR}
  412. </if>
  413. <if test="auditStatus !=null">
  414. and i.audit_status = #{auditStatus,jdbcType=INTEGER}
  415. </if>
  416. <if test="auditName !=null">
  417. and i.username like CONCAT('%',#{auditName,jdbcType=VARCHAR},'%')
  418. </if>
  419. <if test="email !=null">
  420. and u.email = #{email,jdbcType=VARCHAR}
  421. </if>
  422. <if test="startCreateTime !=null">
  423. and u.create_time <![CDATA[ >= ]]> #{startCreateTime,jdbcType=TIMESTAMP}
  424. </if>
  425. <if test="endCreateTime !=null">
  426. and u.create_time <![CDATA[ < ]]> #{endCreateTime,jdbcType=TIMESTAMP}
  427. </if>
  428. </select>
  429. <select id="findOrgByAidWithParamsListByPage" parameterType="java.lang.String" resultType="com.goafanti.user.bo.OrgListBo">
  430. select
  431. u.id ,
  432. u.mobile,
  433. u.email,
  434. u.create_time as createTime,
  435. u.number ,
  436. a.name as adminName,
  437. ma.name as managerName,
  438. u.type,
  439. i.unit_name as unitName,
  440. i.audit_status as orgAuditStatus,
  441. i.aft_username as aftUsername
  442. from user u
  443. LEFT JOIN admin a on a.id = u.aid
  444. LEFT JOIN admin ma on ma.id = u.mid
  445. LEFT JOIN organization_identity i on u.id = i.uid
  446. where u.type = 1
  447. <if test="aid != null">
  448. and u.aid = #{aid,jdbcType=VARCHAR}
  449. </if>
  450. <if test="number !=null">
  451. and u.number = #{number,jdbcType=INTEGER}
  452. </if>
  453. <if test="mobile !=null">
  454. and u.mobile= #{mobile,jdbcType=VARCHAR}
  455. </if>
  456. <if test="auditStatus !=null">
  457. and i.audit_status = #{auditStatus,jdbcType=INTEGER}
  458. </if>
  459. <if test="auditName !=null">
  460. and i.unit_name like CONCAT('%',#{auditName,jdbcType=VARCHAR},'%')
  461. </if>
  462. <if test="email !=null">
  463. and u.email = #{email,jdbcType=VARCHAR}
  464. </if>
  465. <if test="startCreateTime !=null">
  466. and u.create_time <![CDATA[ >= ]]> #{startCreateTime,jdbcType=TIMESTAMP}
  467. </if>
  468. <if test="endCreateTime !=null">
  469. and u.create_time <![CDATA[ < ]]> #{endCreateTime,jdbcType=TIMESTAMP}
  470. </if>
  471. order by u.number desc
  472. <if test="page_sql!=null">
  473. ${page_sql}
  474. </if>
  475. </select>
  476. <select id="findOrgByAidWithParamsCount" parameterType="String" resultType="java.lang.Integer">
  477. select
  478. count(1)
  479. from user u
  480. LEFT JOIN admin a on a.id = u.aid
  481. LEFT JOIN organization_identity i on u.id = i.uid
  482. where u.type = 1
  483. <if test="aid != null">
  484. and u.aid = #{aid,jdbcType=VARCHAR}
  485. </if>
  486. <if test="number !=null">
  487. and u.number = #{number,jdbcType=INTEGER}
  488. </if>
  489. <if test="mobile !=null">
  490. and u.mobile= #{mobile,jdbcType=VARCHAR}
  491. </if>
  492. <if test="auditStatus !=null">
  493. and i.audit_status = #{auditStatus,jdbcType=INTEGER}
  494. </if>
  495. <if test="auditName !=null">
  496. and i.unit_name like CONCAT('%',#{auditName,jdbcType=VARCHAR},'%')
  497. </if>
  498. <if test="email !=null">
  499. and u.email = #{email,jdbcType=VARCHAR}
  500. </if>
  501. <if test="startCreateTime !=null">
  502. and u.create_time <![CDATA[ >= ]]> #{startCreateTime,jdbcType=TIMESTAMP}
  503. </if>
  504. <if test="endCreateTime !=null">
  505. and u.create_time <![CDATA[ < ]]> #{endCreateTime,jdbcType=TIMESTAMP}
  506. </if>
  507. </select>
  508. <select id="findUserByNameAndMobile" resultType="java.lang.String">
  509. select
  510. ui.username
  511. from user u
  512. left join user_identity ui on u.id = ui.uid
  513. where u.lvl &gt; 0 and u.type = 0 and ui.audit_status = 5
  514. <if test="name != null">
  515. and ui.username = #{name,jdbcType=VARCHAR}
  516. </if>
  517. <if test="mobile != null">
  518. and u.mobile = #{mobile,jdbcType=VARCHAR}
  519. </if>
  520. </select>
  521. <select id="findOrgByNameAndMobile" resultType="java.lang.String">
  522. select
  523. oi.unit_name
  524. from user u
  525. left join organization_identity oi on u.id = oi.uid
  526. where u.lvl &gt; 0 and u.type = 1 and oi.audit_status = 5
  527. <if test="name != null">
  528. and oi.unit_name = #{name,jdbcType=VARCHAR}
  529. </if>
  530. <if test="mobile != null">
  531. and u.mobile = #{mobile,jdbcType=VARCHAR}
  532. </if>
  533. </select>
  534. <select id="findAreaManagerUserListByPage" parameterType="String" resultType="com.goafanti.user.bo.UserListBo">
  535. select
  536. u.id ,
  537. u.mobile,
  538. u.email,
  539. u.create_time as createTime,
  540. u.number ,
  541. i.aft_username as aftUsername,
  542. i.audit_status as auditStatus,
  543. i.username,
  544. a.name as adminName,
  545. ad.name as managerName
  546. from user u
  547. LEFT JOIN admin a on a.id = u.aid
  548. LEFT JOIN admin ad on ad.id = u.mid
  549. LEFT JOIN user_identity i on u.id = i.uid
  550. where u.type = 0
  551. <if test = "mobile != null">
  552. and u.mobile = #{mobile,jdbcType=VARCHAR}
  553. </if>
  554. <if test = "email != null">
  555. and u.email = #{email,jdbcType=VARCHAR}
  556. </if>
  557. <if test = "pStart != null" >
  558. and u.create_time <![CDATA[ > ]]> #{pStart,jdbcType=TIMESTAMP}
  559. </if>
  560. <if test = "pEnd != null">
  561. and u.create_time <![CDATA[ < ]]> #{pEnd,jdbcType=TIMESTAMP}
  562. </if>
  563. <if test=" number != null">
  564. and u.number = #{number,jdbcType=INTEGER}
  565. </if>
  566. <if test="username != null">
  567. and i.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  568. </if>
  569. <if test="auditStatus != null">
  570. and i.audit_status= #{auditStatus,jdbcType=INTEGER}
  571. </if>
  572. <if test="provinceList != null">
  573. and i.province in
  574. <foreach collection="provinceList" item="plist" open="(" separator="," close=")">
  575. #{plist}
  576. </foreach>
  577. </if>
  578. <if test="cityList != null">
  579. and i.city in
  580. <foreach collection="cityList" item="clist" open="(" separator="," close=")">
  581. #{clist}
  582. </foreach>
  583. </if>
  584. order by u.number desc
  585. <if test="page_sql!=null">
  586. ${page_sql}
  587. </if>
  588. </select>
  589. <select id="findAreaManagerUserCount" resultType="java.lang.Integer" parameterType="String">
  590. select count(1)
  591. from user u LEFT JOIN user_identity i
  592. ON u.id = i.uid
  593. WHERE u.type = 0
  594. <if test = "mobile != null">
  595. and u.mobile = #{mobile,jdbcType=VARCHAR}
  596. </if>
  597. <if test = "email != null">
  598. and u.email = #{email,jdbcType=VARCHAR}
  599. </if>
  600. <if test = "pStart != null" >
  601. and u.create_time <![CDATA[ > ]]> #{pStart,jdbcType=TIMESTAMP}
  602. </if>
  603. <if test = "pEnd != null">
  604. and u.create_time <![CDATA[ < ]]> #{pEnd,jdbcType=TIMESTAMP}
  605. </if>
  606. <if test="number != null">
  607. and u.number = #{number,jdbcType=INTEGER}
  608. </if>
  609. <if test="username != null">
  610. and i.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  611. </if>
  612. <if test="auditStatus != null">
  613. and i.audit_status= #{auditStatus,jdbcType=INTEGER}
  614. </if>
  615. <if test="provinceList != null">
  616. and i.province in
  617. <foreach collection="provinceList" item="plist" open="(" separator="," close=")">
  618. #{plist}
  619. </foreach>
  620. </if>
  621. <if test="cityList != null">
  622. and i.city in
  623. <foreach collection="cityList" item="clist" open="(" separator="," close=")">
  624. #{clist}
  625. </foreach>
  626. </if>
  627. </select>
  628. <select id="findAreaManagerOrgListByPage" parameterType="String" resultType="com.goafanti.user.bo.OrgListBo">
  629. select
  630. u.id ,
  631. u.mobile,
  632. u.email,
  633. u.create_time as createTime,
  634. u.number ,
  635. o.aft_username as aftUsername,
  636. o.audit_status as orgAuditStatus,
  637. a.name as adminName,
  638. o.unit_name as unitName,
  639. ad.name as managerName
  640. from user u
  641. LEFT JOIN admin a on a.id = u.aid
  642. LEFT JOIN admin ad on ad.id = u.mid
  643. LEFT JOIN organization_identity o on u.id = o.uid
  644. WHERE u.type = 1
  645. <if test = "mobile != null">
  646. and u.mobile = #{mobile,jdbcType=VARCHAR}
  647. </if>
  648. <if test = "uid != null">
  649. and u.id = #{uid,jdbcType=VARCHAR}
  650. </if>
  651. <if test = "email != null">
  652. and u.email = #{email,jdbcType=VARCHAR}
  653. </if>
  654. <if test = "pStart != null" >
  655. and u.create_time <![CDATA[ >= ]]> #{pStart,jdbcType=TIMESTAMP}
  656. </if>
  657. <if test = "pEnd != null">
  658. and u.create_time <![CDATA[ < ]]> #{pEnd,jdbcType=TIMESTAMP}
  659. </if>
  660. <if test=" number != null">
  661. and u.number = #{number,jdbcType=INTEGER}
  662. </if>
  663. <if test="unitName != null">
  664. and o.unit_name like '%'#{unitName,jdbcType=VARCHAR}'%'
  665. </if>
  666. <if test="auditStatus != null">
  667. and o.audit_status= #{auditStatus,jdbcType=INTEGER}
  668. </if>
  669. <if test="provinceList != null">
  670. and o.licence_province in
  671. <foreach collection="provinceList" item="plist" open="(" separator="," close=")">
  672. #{plist}
  673. </foreach>
  674. </if>
  675. <if test="cityList != null">
  676. and o.licence_city in
  677. <foreach collection="cityList" item="clist" open="(" separator="," close=")">
  678. #{clist}
  679. </foreach>
  680. </if>
  681. order by u.number desc
  682. <if test="page_sql!=null">
  683. ${page_sql}
  684. </if>
  685. </select>
  686. <select id="findAreaManagerOrgCount" resultType="java.lang.Integer" parameterType="String">
  687. select count(1)
  688. from user u LEFT JOIN organization_identity o
  689. ON u.id = o.uid
  690. WHERE u.type = 1
  691. <if test = "uid != null">
  692. and u.id = #{uid,jdbcType=VARCHAR}
  693. </if>
  694. <if test = "mobile != null">
  695. and u.mobile = #{mobile,jdbcType=VARCHAR}
  696. </if>
  697. <if test = "email != null">
  698. and u.email = #{email,jdbcType=VARCHAR}
  699. </if>
  700. <if test = "pStart != null" >
  701. and u.create_time <![CDATA[ >= ]]> #{pStart,jdbcType=TIMESTAMP}
  702. </if>
  703. <if test = "pEnd != null">
  704. and u.create_time <![CDATA[ < ]]> #{pEnd,jdbcType=TIMESTAMP}
  705. </if>
  706. <if test=" number != null">
  707. and u.number = #{number,jdbcType=INTEGER}
  708. </if>
  709. <if test="unitName != null">
  710. and o.unit_name like '%'#{unitName,jdbcType=VARCHAR}'%'
  711. </if>
  712. <if test="auditStatus != null">
  713. and o.audit_status= #{auditStatus,jdbcType=INTEGER}
  714. </if>
  715. <if test="provinceList != null">
  716. and i.province in
  717. <foreach collection="provinceList" item="plist" open="(" separator="," close=")">
  718. #{plist}
  719. </foreach>
  720. </if>
  721. <if test="cityList != null">
  722. and i.city in
  723. <foreach collection="cityList" item="clist" open="(" separator="," close=")">
  724. #{clist}
  725. </foreach>
  726. </if>
  727. </select>
  728. <select id="findUserPartnerDetail" parameterType="java.lang.String" resultType="com.goafanti.user.bo.UserPartnerDetailBo">
  729. SELECT
  730. u.number,
  731. ui.username,
  732. ui.province,
  733. ui.city,
  734. ui.area,
  735. uc.engaged_field AS engagedField,
  736. info.personal_profile AS personalProfile,
  737. u.lvl AS LEVEL,
  738. ua.ability_label AS abilityLabel,
  739. info.person_portrait_url AS personPortraitUrl,
  740. info.life_photo_url AS lifePhotoUrl,
  741. interest.id as interestId
  742. FROM
  743. `user` u
  744. LEFT JOIN user_identity ui ON ui.uid = u.id
  745. LEFT JOIN user_career uc ON uc.uid = u.id
  746. LEFT JOIN user_ability ua ON ua.uid = u.id
  747. LEFT JOIN user_info info ON info.uid = u.id
  748. LEFT JOIN user_interest interest on interest.to_uid = u.id and interest.from_uid = #{tokenId,jdbcType=VARCHAR}
  749. WHERE
  750. u.type = 0
  751. and u.id = #{uid,jdbcType=VARCHAR}
  752. </select>
  753. <select id="findOrgPartnerDetail" parameterType="java.lang.String" resultType="com.goafanti.user.bo.OrgPartnerDetailBo">
  754. SELECT
  755. u.number,
  756. oi.unit_name AS unitName,
  757. oi.licence_province AS province,
  758. oi.licence_city AS city,
  759. oi.licence_area AS area,
  760. u.lvl AS LEVEL,
  761. ua.ability_label AS abilityLabel,
  762. info.logo_url AS logoUrl,
  763. info.company_introduction AS companyIntroduction,
  764. info.publicity_picture_url AS publicityPictureUrl,
  765. ot.search_area_category as field,
  766. interest.id as interestId
  767. FROM
  768. `user` u
  769. LEFT JOIN organization_identity oi ON oi.uid = u.id
  770. LEFT JOIN organization_info info ON info.uid = u.id
  771. LEFT JOIN organization_tech ot ON ot.uid = u.id
  772. LEFT JOIN user_ability ua ON ua.uid = u.id
  773. LEFT JOIN user_interest interest on interest.to_uid = u.id and interest.from_uid = #{tokenId,jdbcType=VARCHAR}
  774. WHERE
  775. u.type = 1
  776. and u.id = #{uid,jdbcType=VARCHAR}
  777. </select>
  778. <select id="findStarListByPage" parameterType="String" resultType="com.goafanti.user.bo.StarListBo">
  779. select
  780. u.id as uid,
  781. u.number,
  782. ui.username,
  783. uc.engaged_field as engagedField,
  784. uc.professional_title as professionalTitle,
  785. uc.work_unit as workUnit,
  786. adc.achievement_count as achievementNum
  787. from user u
  788. left join user_identity ui on ui.uid = u.id
  789. left join user_career uc on uc.uid = u.id
  790. left join achievement_demand_count adc on adc.uid = u.id
  791. where
  792. ui.celebrity = 1
  793. <if test="number != null">
  794. and u.number = #{number,jdbcType=INTEGER}
  795. </if>
  796. <if test="engagedField != null">
  797. and uc.engaged_field like CONCAT(#{engagedField,jdbcType=VARCHAR},'%')
  798. </if>
  799. <if test="username != null">
  800. and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  801. </if>
  802. <if test="professionalTitle != null">
  803. and uc.professional_title like CONCAT('%',#{professionalTitle,jdbcType=VARCHAR},'%')
  804. </if>
  805. <if test="workUnit != null">
  806. and uc.work_unit like CONCAT('%',#{workUnit,jdbcType=VARCHAR},'%')
  807. </if>
  808. ORDER BY adc.achievement_count DESC
  809. <if test="page_sql!=null">
  810. ${page_sql}
  811. </if>
  812. </select>
  813. <select id="findStarCount" parameterType="String" resultType="java.lang.Integer">
  814. select
  815. count(1)
  816. from user u
  817. left join user_identity ui on ui.uid = u.id
  818. left join user_career uc on uc.uid = u.id
  819. where
  820. ui.celebrity = 1
  821. <if test="number != null">
  822. and u.number = #{number,jdbcType=INTEGER}
  823. </if>
  824. <if test="engagedField != null">
  825. and uc.engaged_field like CONCAT(#{engagedField,jdbcType=VARCHAR},'%')
  826. </if>
  827. <if test="username != null">
  828. and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  829. </if>
  830. <if test="professionalTitle != null">
  831. and uc.professional_title like CONCAT('%',#{professionalTitle,jdbcType=VARCHAR},'%')
  832. </if>
  833. <if test="workUnit != null">
  834. and uc.work_unit like CONCAT('%',#{workUnit,jdbcType=VARCHAR},'%')
  835. </if>
  836. </select>
  837. <select id="findStarAndExpertListByPage" parameterType="String" resultType="com.goafanti.user.bo.StarAndExpertListBo">
  838. select
  839. u.id as uid,
  840. u.number,
  841. ui.username,
  842. uc.engaged_field as engagedField,
  843. uc.professional_title as professionalTitle,
  844. uc.work_unit as workUnit,
  845. adc.achievement_count as achievementNum
  846. from user u
  847. left join user_identity ui on ui.uid = u.id
  848. left join user_career uc on uc.uid = u.id
  849. left join achievement_demand_count adc on adc.uid = u.id
  850. where
  851. (ui.celebrity = 1 or ui.expert = 1)
  852. <if test="number != null">
  853. and u.number = #{number,jdbcType=INTEGER}
  854. </if>
  855. <if test="engagedField != null">
  856. and uc.engaged_field like CONCAT(#{engagedField,jdbcType=VARCHAR},'%')
  857. </if>
  858. <if test="username != null">
  859. and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  860. </if>
  861. <if test="professionalTitle != null">
  862. and uc.professional_title like CONCAT('%',#{professionalTitle,jdbcType=VARCHAR},'%')
  863. </if>
  864. <if test="workUnit != null">
  865. and uc.work_unit like CONCAT('%',#{workUnit,jdbcType=VARCHAR},'%')
  866. </if>
  867. ORDER BY adc.achievement_count DESC
  868. <if test="page_sql!=null">
  869. ${page_sql}
  870. </if>
  871. </select>
  872. <select id="findStarAndExpertCount" parameterType="String" resultType="java.lang.Integer">
  873. select
  874. count(1)
  875. from user u
  876. left join user_identity ui on ui.uid = u.id
  877. left join user_career uc on uc.uid = u.id
  878. where
  879. (ui.celebrity = 1 or ui.expert = 1)
  880. <if test="number != null">
  881. and u.number = #{number,jdbcType=INTEGER}
  882. </if>
  883. <if test="engagedField != null">
  884. and uc.engaged_field like CONCAT(#{engagedField,jdbcType=VARCHAR},'%')
  885. </if>
  886. <if test="username != null">
  887. and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  888. </if>
  889. <if test="professionalTitle != null">
  890. and uc.professional_title like CONCAT('%',#{professionalTitle,jdbcType=VARCHAR},'%')
  891. </if>
  892. <if test="workUnit != null">
  893. and uc.work_unit like CONCAT('%',#{workUnit,jdbcType=VARCHAR},'%')
  894. </if>
  895. </select>
  896. <select id="selectNumberByPrimaryKey" parameterType="String" resultType="java.lang.Long">
  897. select number
  898. from user
  899. where id = #{id,jdbcType=VARCHAR}
  900. </select>
  901. </mapper>