ResumesDao.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  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.sqx.modules.resumes.dao.ResumesDao">
  4. <select id="selectResumesList" resultType="com.sqx.modules.resumes.entity.Resumes">
  5. select r.*,u.user_name as userName,u.avatar from resumes r
  6. left join tb_user u on u.user_id=r.user_id
  7. <where>
  8. <if test="resumes.isShow!=null">
  9. and r.is_show = #{resumes.isShow}
  10. </if>
  11. <if test="resumes.resumesName!=null and resumes.resumesName!=''">
  12. and r.resumes_name like concat('%',#{resumes.resumesName},'%')
  13. </if>
  14. <if test="resumes.resumesPhone!=null and resumes.resumesPhone!=''">
  15. and r.resumes_phone like concat('%',#{resumes.resumesPhone},'%')
  16. </if>
  17. <if test="resumes.resumesMajor!=null and resumes.resumesMajor!=''">
  18. and r.resumes_major like concat('%',#{resumes.resumesMajor},'%')
  19. </if>
  20. <if test="resumes.resumesPost!=null and resumes.resumesPost!=''">
  21. and r.resumes_post like concat('%',#{resumes.resumesPost},'%')
  22. </if>
  23. <if test="resumes.resumesWorkExperience!=null and resumes.resumesWorkExperience!=''">
  24. and r.resumes_work_experience like concat('%',#{resumes.resumesWorkExperience},'%')
  25. </if>
  26. <if test="resumes.status!=null and resumes.status!=0">
  27. and r.status=#{resumes.status}
  28. </if>
  29. <if test="resumes.isRecommend!=null and resumes.isRecommend==1">
  30. and (r.is_recommend =1 or r.is_recommend is null )
  31. </if>
  32. <if test="resumes.isRecommend!=null and resumes.isRecommend==2">
  33. and r.is_recommend=#{resumes.isRecommend}
  34. </if>
  35. <if test="resumes.resumesEducation!=null and resumes.resumesEducation!=''">
  36. and r.resumes_education like concat('%',#{resumes.resumesEducation},'%')
  37. </if>
  38. <if test="resumes.resumesMarriage!=null and resumes.resumesMarriage!=''">
  39. and r.resumes_marriage like concat('%',#{resumes.resumesMarriage},'%')
  40. </if>
  41. <if test="resumes.industryName!=null and resumes.industryName!=''">
  42. and r.industry_name like concat('%',#{resumes.industryName},'%')
  43. </if>
  44. <if test="resumes.rulePostName!=null and resumes.rulePostName!=''">
  45. and r.rule_post_name like concat('%',#{resumes.rulePostName},'%')
  46. </if>
  47. <if test="resumes.resumesCompensation!=null and resumes.resumesCompensation!=''">
  48. and r.resumes_compensation like concat('%',#{resumes.resumesCompensation},'%')
  49. </if>
  50. <if test="resumes.school!=null and resumes.school!=''">
  51. and r.school like concat('%',#{resumes.school},'%')
  52. </if>
  53. <if test="resumes.resumesAge!=null and resumes.resumesAge!=''">
  54. and r.resumes_age =#{resumes.resumesAge}
  55. </if>
  56. <if test="startTime!=null and startTime!='' and startTime!=null and startTime!=''">
  57. and date_format(r.create_time,'%Y-%m-%d') BETWEEN #{startTime} and #{endTime}
  58. </if>
  59. <if test="startTime!=null and startTime!='' and (endTime==null or endTime=='')">
  60. and date_format(cr.create_time,'%Y-%m-%d') &gt;= #{startTime}
  61. </if>
  62. <if test="endTime!=null and endTime!='' and (startTime==null or startTime=='')">
  63. and date_format(r.create_time,'%Y-%m-%d') &lt;= #{endTime}
  64. </if>
  65. </where>
  66. order by r.update_time desc
  67. </select>
  68. <select id="selectResumesListHr" resultType="com.sqx.modules.resumes.entity.ResumesListDto">
  69. SELECT
  70. u.user_name AS userName,
  71. u.avatar AS userAvatar,
  72. u.sex AS userSex,
  73. u.age AS userAge,
  74. last_work.type AS workType,
  75. last_work.company_name AS companyName,
  76. intent.intentIndustry AS intentIndustry,
  77. last_work.start_time AS lastWorkStartTime,
  78. last_work.end_time AS lastWorkEndTime,
  79. last_work.work_content AS workContent,
  80. e.school AS school,
  81. e.degree AS degree,
  82. intent.all_expected_positions AS expectedPosition,
  83. intent.all_expected_cities AS expectedCity,
  84. intent.min_salary AS minSalary,
  85. intent.max_salary AS maxSalary,-- resumes.status AS resumesStatus,
  86. resumes.resumes_education AS resumesEducation,
  87. resumes.resumes_work_experience AS resumesWorkExperience,
  88. resumes.resumes_id AS resumesId,
  89. resumes.is_recommend AS isRecommend,
  90. resumes.resumes_status AS resumesStatus,
  91. GROUP_CONCAT( DISTINCT s.skill_name SEPARATOR ',' ) AS skillName
  92. FROM
  93. tb_user u
  94. LEFT JOIN skill s ON s.user_id = u.user_id
  95. INNER JOIN resumes ON u.user_id = resumes.user_id
  96. AND resumes.`status` = 1
  97. INNER JOIN (
  98. SELECT
  99. edu.*,
  100. ROW_NUMBER() OVER ( PARTITION BY edu.user_id ORDER BY edu.end_time DESC ) AS edu_rn
  101. FROM
  102. edu
  103. WHERE
  104. edu.is_use = 1
  105. ) e ON u.user_id = e.user_id
  106. AND e.edu_rn = 1
  107. INNER JOIN (
  108. SELECT
  109. wed.*,
  110. we.type,
  111. we.company_name,
  112. we.user_id,
  113. ROW_NUMBER() OVER ( PARTITION BY we.user_id ORDER BY wed.end_time DESC ) AS work_rn
  114. FROM
  115. work_exp we
  116. INNER JOIN work_exp_detail wed ON we.work_exp_id = wed.work_exp_id
  117. WHERE
  118. we.is_use = 1
  119. ) last_work ON u.user_id = last_work.user_id
  120. AND last_work.work_rn = 1
  121. INNER JOIN (
  122. SELECT
  123. user_id,
  124. GROUP_CONCAT( DISTINCT rule_classify_name SEPARATOR ',' ) AS all_expected_positions,
  125. GROUP_CONCAT( DISTINCT citys SEPARATOR ',' ) AS all_expected_cities,
  126. GROUP_CONCAT( DISTINCT industry SEPARATOR ',' ) AS intentIndustry,
  127. MIN( min_salary ) AS min_salary,
  128. MAX( max_salary ) AS max_salary
  129. FROM
  130. intention
  131. WHERE
  132. is_default = 1
  133. GROUP BY
  134. user_id
  135. ) intent ON u.user_id = intent.user_id
  136. <where>
  137. <if test="resumesListDto.expectedCity!=null and resumesListDto.expectedCity!=''">
  138. AND FIND_IN_SET(#{resumesListDto.expectedCity},intent.all_expected_cities)
  139. </if>
  140. <if test="resumesListDto.resumesId !=null and resumesListDto.resumesId!=''">
  141. AND resumes.resumes_id = #{resumesListDto.resumesId}
  142. </if>
  143. <if test="resumesListDto.expectedPosition != null and resumesListDto.expectedPosition != ''">
  144. AND FIND_IN_SET(#{resumesListDto.expectedPosition}, intent.all_expected_positions)
  145. </if>
  146. <if test="resumesListDto.isRecommend != null">
  147. AND resumes.is_recommend = 1
  148. </if>
  149. <if test="resumesListDto.resumesStatus != null">
  150. AND resumes.resumes_status = #{resumesListDto.resumesStatus}
  151. </if>
  152. </where>
  153. order by r.update_time desc
  154. </select>
  155. <select id="selectResumesListByCompany" resultType="com.sqx.modules.resumes.entity.Resumes">
  156. SELECT
  157. r.*,
  158. u.user_name AS userName,
  159. u.avatar
  160. FROM
  161. resumes r
  162. LEFT JOIN tb_user u
  163. ON u.user_id = r.user_id
  164. WHERE u.`user_id` NOT IN (SELECT user_id FROM shield_company s WHERE s.`company_id`=#{companyId} and
  165. shield_type=2)
  166. AND (r.resumes_status !=3)
  167. AND r.is_show = 1
  168. <if test="resumes.resumesPost==null or resumes.resumesPost==''">
  169. <if test="companyClassify!=null and companyClassify.size()>0">
  170. and r.resumes_post in
  171. <foreach collection="companyClassify" item="item" open="(" close=")" separator=",">
  172. #{item}
  173. </foreach>
  174. </if>
  175. </if>
  176. <if test="resumes.resumesName!=null and resumes.resumesName!=''">
  177. and r.resumes_name like concat('%',#{resumes.resumesName},'%')
  178. </if>
  179. <if test="resumes.industryName!=null and resumes.industryName!=''">
  180. and r.industry_name = #{resumes.industryName}
  181. </if>
  182. <if test="resumes.resumesPhone!=null and resumes.resumesPhone!=''">
  183. and r.resumes_phone like concat('%',#{resumes.resumesPhone},'%')
  184. </if>
  185. <if test="resumes.resumesMajor!=null and resumes.resumesMajor!=''">
  186. and r.resumes_major like concat('%',#{resumes.resumesMajor},'%')
  187. </if>
  188. <if test="resumes.resumesPost!=null and resumes.resumesPost!=''">
  189. and r.resumes_post like concat('%', #{resumes.resumesPost},'%')
  190. </if>
  191. <if test="resumes.resumesWorkExperience!=null and resumes.resumesWorkExperience!=''">
  192. and r.resumes_work_experience like concat('%',#{resumes.resumesWorkExperience},'%')
  193. </if>
  194. <if test="resumes.status!=null and resumes.status!=0">
  195. and r.status=#{resumes.status}
  196. </if>
  197. <if test="resumes.ruleClassifyId!=null and resumes.ruleClassifyId!=0">
  198. and r.rule_classify_id=#{resumes.ruleClassifyId}
  199. </if>
  200. <if test="resumes.resumesAge!=null and resumes.resumesAge!=''">
  201. and r.resumesAge=#{resumes.resumesAge}
  202. </if>
  203. <if test="resumes.resumesMarriage!=null and resumes.resumesMarriage!=''">
  204. and r.resumes_marriage=#{resumes.resumesMarriage}
  205. </if>
  206. <if test="resumes.resumesCompensation!=null and resumes.resumesCompensation!=''">
  207. and r.resumes_compensation=#{resumes.resumesCompensation}
  208. </if>
  209. <if test="resumes.isRecommend!=null and resumes.isRecommend==2">
  210. and r.is_recommend=#{resumes.isRecommend}
  211. </if>
  212. <if test="resumes.isRecommend!=null and resumes.isRecommend==1">
  213. and (r.is_recommend=#{resumes.isRecommend} or r.is_recommend is null)
  214. </if>
  215. <if test="resumes.resumesEducation!=null and resumes.resumesEducation!=''">
  216. and r.resumes_education like concat('%',#{resumes.resumesEducation},'%')
  217. </if>
  218. <if test="resumes.resumesWorkExperience!=null and resumes.resumesWorkExperience!=''">
  219. and r.resumes_work_experience like concat('%',#{resumes.resumesWorkExperience},'%')
  220. </if>
  221. <if test="resumes.rulePostName!=null and resumes.rulePostName!=''">
  222. and r.rule_post_name like concat('%',#{resumes.rulePostName},'%')
  223. </if>
  224. <if test="resumes.resumesIntention!=null and resumes.resumesIntention!=''">
  225. and (r.resumes_intention like concat('%',#{resumes.resumesIntention},'%') or r.city like
  226. concat('%',#{resumes.resumesIntention},'%') )
  227. </if>
  228. <if test="resumes.city!=null and resumes.city!=''">
  229. and (r.city like concat('%',#{resumes.city},'%') or r.city like
  230. concat('%',#{resumes.city},'%') )
  231. </if>
  232. <if test="resumes.school!=null and resumes.school!=''">
  233. and r.school like concat('%',#{resumes.school},'%')
  234. </if>
  235. <if test="screen!=null and screen==1">
  236. order by is_recommend desc
  237. </if>
  238. <if test="screen!=null and screen==2">
  239. order by update_time desc
  240. </if>
  241. </select>
  242. <insert id="insertResumes" useGeneratedKeys="true" keyProperty="resumesId"
  243. parameterType="com.sqx.modules.resumes.entity.Resumes">
  244. INSERT INTO resumes
  245. <trim prefix="(" suffix=")" suffixOverrides=",">
  246. <if test="null != resumesName and '' != resumesName">
  247. resumes_name,
  248. </if>
  249. <if test="null != resumesAge and '' != resumesAge">
  250. resumes_age,
  251. </if>
  252. <if test="null != resumesPhone and '' != resumesPhone">
  253. resumes_phone,
  254. </if>
  255. <if test="null != resumesEducation and '' != resumesEducation">
  256. resumes_education,
  257. </if>
  258. <if test="null != resumesMarriage and '' != resumesMarriage">
  259. resumes_marriage,
  260. </if>
  261. <if test="null != resumesCompensation and '' != resumesCompensation">
  262. resumes_compensation,
  263. </if>
  264. <if test="null != resumesEmail and '' != resumesEmail">
  265. resumes_email,
  266. </if>
  267. <if test="null != resumesWorkExperience and '' != resumesWorkExperience">
  268. resumes_work_experience,
  269. </if>
  270. <if test="null != resumesIntention and '' != resumesIntention">
  271. resumes_intention,
  272. </if>
  273. <if test="null != resumesMajor and '' != resumesMajor">
  274. resumes_major,
  275. </if>
  276. <if test="null != resumesPost and '' != resumesPost">
  277. resumes_post,
  278. </if>
  279. <if test="null != resumesDetails and '' != resumesDetails">
  280. resumes_details,
  281. </if>
  282. <if test="null != resumesImageName and '' != resumesImageName">
  283. resumes_image_name,
  284. </if>
  285. <if test="null != resumesImage and '' != resumesImage">
  286. resumes_image,
  287. </if>
  288. <if test="null != userId ">
  289. user_id,
  290. </if>
  291. <if test="null != status ">
  292. status,
  293. </if>
  294. <if test="null != updateTime and '' != updateTime">
  295. update_time,
  296. </if>
  297. <if test="null != createTime and '' != createTime">
  298. create_time,
  299. </if>
  300. <if test="null != school and '' != school">
  301. school,
  302. </if>
  303. <if test="null != ruleClassifyId and '' != ruleClassifyId">
  304. rule_classify_id,
  305. </if>
  306. <if test="null != address and '' != address">
  307. address,
  308. </if>
  309. <if test="null != resumesSex">
  310. resumes_sex,
  311. </if>
  312. <if test="null != rulePostName and '' != rulePostName">
  313. rule_post_name,
  314. </if>
  315. <if test="null != rulePostId ">
  316. rule_post_id,
  317. </if>
  318. <if test="null != isRecommend ">
  319. is_recommend,
  320. </if>
  321. <if test="null != city ">
  322. city,
  323. </if>
  324. <if test="null != major">
  325. major,
  326. </if>
  327. </trim>
  328. <trim prefix="values (" suffix=")" suffixOverrides=",">
  329. <if test="null != resumesName and '' != resumesName">
  330. #{resumesName},
  331. </if>
  332. <if test="null != resumesAge and '' != resumesAge">
  333. #{resumesAge},
  334. </if>
  335. <if test="null != resumesPhone and '' != resumesPhone">
  336. #{resumesPhone},
  337. </if>
  338. <if test="null != resumesEducation and '' != resumesEducation">
  339. #{resumesEducation},
  340. </if>
  341. <if test="null != resumesMarriage and '' != resumesMarriage">
  342. #{resumesMarriage},
  343. </if>
  344. <if test="null != resumesCompensation and '' != resumesCompensation">
  345. #{resumesCompensation},
  346. </if>
  347. <if test="null != resumesEmail and '' != resumesEmail">
  348. #{resumesEmail},
  349. </if>
  350. <if test="null != resumesWorkExperience and '' != resumesWorkExperience">
  351. #{resumesWorkExperience},
  352. </if>
  353. <if test="null != resumesIntention and '' != resumesIntention">
  354. #{resumesIntention},
  355. </if>
  356. <if test="null != resumesMajor and '' != resumesMajor">
  357. #{resumesMajor},
  358. </if>
  359. <if test="null != resumesPost and '' != resumesPost">
  360. #{resumesPost},
  361. </if>
  362. <if test="null != resumesDetails and '' != resumesDetails">
  363. #{resumesDetails},
  364. </if>
  365. <if test="null != resumesImageName and '' != resumesImageName">
  366. #{resumesImageName},
  367. </if>
  368. <if test="null != resumesImage and '' != resumesImage">
  369. #{resumesImage},
  370. </if>
  371. <if test="null != userId ">
  372. #{userId},
  373. </if>
  374. <if test="null != status ">
  375. #{status},
  376. </if>
  377. <if test="null != updateTime and '' != updateTime">
  378. #{updateTime},
  379. </if>
  380. <if test="null != createTime and '' != createTime">
  381. #{createTime},
  382. </if>
  383. <if test="null != school and '' != school">
  384. #{school},
  385. </if>
  386. <if test="null != ruleClassifyId and '' != ruleClassifyId">
  387. #{ruleClassifyId},
  388. </if>
  389. <if test="null != address and '' != address">
  390. #{address},
  391. </if>
  392. <if test="null != resumesSex">
  393. #{resumesSex},
  394. </if>
  395. <if test="null != rulePostName and '' != rulePostName">
  396. #{rulePostName},
  397. </if>
  398. <if test="null != rulePostId ">
  399. #{rulePostId},
  400. </if>
  401. <if test="null != isRecommend ">
  402. #{isRecommend},
  403. </if>
  404. <if test="null != city ">
  405. #{city},
  406. </if>
  407. <if test="null != major ">
  408. #{major},
  409. </if>
  410. </trim>
  411. </insert>
  412. <select id="selectResumesStatusByUpdateTime" resultType="com.sqx.modules.resumes.entity.Resumes">
  413. select *
  414. from resumes
  415. where is_recommend = 2
  416. and date_format(DATE_ADD(update_time, INTERVAL 3 day), '%Y-%m-%d') &lt;= date_format(now(), '%Y-%m-%d')
  417. </select>
  418. <select id="exportExcelCompanyList" resultType="com.sqx.modules.resumes.entity.Resumes">
  419. select r.*,u.user_name as userName,u.avatar from resumes r
  420. left join tb_user u on u.user_id=r.user_id
  421. where 1=1
  422. <if test="resumes.resumesName!=null and resumes.resumesName!=''">
  423. and r.resumes_name like concat('%',#{resumes.resumesName},'%')
  424. </if>
  425. <if test="resumes.resumesPhone!=null and resumes.resumesPhone!=''">
  426. and r.resumes_phone like concat('%',#{resumes.resumesPhone},'%')
  427. </if>
  428. <if test="resumes.resumesMajor!=null and resumes.resumesMajor!=''">
  429. and r.resumes_major like concat('%',#{resumes.resumesMajor},'%')
  430. </if>
  431. <if test="resumes.resumesPost!=null and resumes.resumesPost!=''">
  432. and r.resumes_post like concat('%',#{resumes.resumesPost},'%')
  433. </if>
  434. <if test="resumes.resumesWorkExperience!=null and resumes.resumesWorkExperience!=''">
  435. and r.resumes_work_experience like concat('%',#{resumes.resumesWorkExperience},'%')
  436. </if>
  437. <if test="resumes.status!=null and resumes.status!=0">
  438. and r.status=#{resumes.status}
  439. </if>
  440. <if test="resumes.isRecommend!=null and resumes.isRecommend==1">
  441. and (r.is_recommend =1 or r.is_recommend is null )
  442. </if>
  443. <if test="resumes.isRecommend!=null and resumes.isRecommend==2">
  444. and r.is_recommend=#{resumes.isRecommend}
  445. </if>
  446. <if test="resumes.resumesEducation!=null and resumes.resumesEducation!=''">
  447. and r.resumes_education like concat('%',#{resumes.resumesEducation},'%')
  448. </if>
  449. <if test="resumes.resumesMarriage!=null and resumes.resumesMarriage!=''">
  450. and r.resumes_marriage like concat('%',#{resumes.resumesMarriage},'%')
  451. </if>
  452. <if test="resumes.industryName!=null and resumes.industryName!=''">
  453. and r.industry_name like concat('%',#{resumes.industryName},'%')
  454. </if>
  455. <if test="resumes.rulePostName!=null and resumes.rulePostName!=''">
  456. and r.rule_post_name like concat('%',#{resumes.rulePostName},'%')
  457. </if>
  458. <if test="resumes.resumesCompensation!=null and resumes.resumesCompensation!=''">
  459. and r.resumes_compensation like concat('%',#{resumes.resumesCompensation},'%')
  460. </if>
  461. <if test="resumes.school!=null and resumes.school!=''">
  462. and r.school like concat('%',#{resumes.school},'%')
  463. </if>
  464. <if test="resumes.resumesAge!=null and resumes.resumesAge!=''">
  465. and r.resumes_age =#{resumes.resumesAge}
  466. </if>
  467. <if test="startTime!=null and startTime!='' and startTime!=null and startTime!=''">
  468. and date_format(r.create_time,'%Y-%m-%d') BETWEEN #{startTime} and #{endTime}
  469. </if>
  470. <if test="startTime!=null and startTime!='' and (endTime==null or endTime=='')">
  471. and date_format(cr.create_time,'%Y-%m-%d') &gt;= #{startTime}
  472. </if>
  473. <if test="endTime!=null and endTime!='' and (startTime==null or startTime=='')">
  474. and date_format(r.create_time,'%Y-%m-%d') &lt;= #{endTime}
  475. </if>
  476. order by r.update_time desc
  477. </select>
  478. <select id="selectResumesByResumesId" resultType="com.sqx.modules.resumes.entity.Resumes">
  479. select *
  480. <if test="userId!=null">
  481. ,(select if(count(0)>0,1,0) from my_collection m where m.resumes_id = r.resumes_id and m.user_id = #{userId} and m.type =2 ) as isCollection
  482. </if>
  483. from resumes r
  484. where r.resumes_id = #{resumesId}
  485. </select>
  486. </mapper>