UserMapper.xml 28 KB

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