RecommendMgtCQuery.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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.hz.employmentsite.mapper.cquery.RecommendMgtCQuery">
  4. <select id="getRecommendMgtList" resultType="com.hz.employmentsite.vo.jobUserManager.RecommendMgtVo">
  5. select a.recommendmgtid,a.postid,a.jobhuntid,a.recommendtype,a.entrystate,a.officialaccountsid,
  6. a.postisread,a.jobpeopleisread,a.createuserid,a.createtime,a.modifyuserid,a.modifytime,a.remark,
  7. c.companyname,c.usermobile as companymobile,c.username as companyusername,e.`name`,e.usermobile,
  8. f.professionname as zpprofessionname,f2.professionname as qzprofessionname,
  9. dic1.`name` as recommendtypename,dic2.`name` as entrystatename,dic3.`name` as postisreadname,
  10. dic4.`name` as jobpeopleisreadname,g.`name` as pushname, dic5.`name` as gendername
  11. ,e.jobuserId,c.companyId
  12. ,d.workYear
  13. ,site.SiteID, site.SiteName,inSites.InstitutionID as institutionID,site.RegionCode
  14. from pc_recommend_mgt a
  15. inner join pc_post b on a.PostID = b.PostID
  16. left join pc_company c on b.CompanyID = c.CompanyID
  17. inner join pc_jobhunt d on a.JobHuntID = d.JobHuntID
  18. left join pc_jobuser e on d.JobUserID = e.JobuserID
  19. left join pc_profession f on b.ProfessionID = f.ProfessionID
  20. left join pc_profession f2 on d.ProfessionID = f2.ProfessionID
  21. left join (select `Value`,`Name` from sys_dictionary_item where DictionaryCode='RecommendType') dic1 on
  22. a.RecommendType = dic1.`Value`
  23. left join (select `Value`,`Name` from sys_dictionary_item where DictionaryCode='EntryState') dic2 on
  24. a.EntryState = dic2.`Value`
  25. left join (select `Value`,`Name` from sys_dictionary_item where DictionaryCode='IsRead') dic3 on a.PostIsRead =
  26. dic3.`Value`
  27. left join (select `Value`,`Name` from sys_dictionary_item where DictionaryCode='IsRead') dic4 on
  28. a.JobPeopleIsRead = dic4.`Value`
  29. left join (select `Value`,`Name` from sys_dictionary_item where DictionaryCode='Gender') dic5 on e.Sex =
  30. dic5.`Value`
  31. left join sys_user g on a.CreateUserID = g.UserID
  32. left join pc_site site on e.SiteID = site.SiteID
  33. left join pc_site_institution inSites on site.SiteID = inSites.SiteID
  34. left join pc_institution institution on inSites.institutionID = institution.InstitutionID
  35. <where>
  36. <if test="recommendMgtID != '' and recommendMgtID != null">
  37. and a.RecommendMgtID = #{recommendMgtID}
  38. </if>
  39. <if test="name != '' and name != null">
  40. and e.name like Concat('%',#{name},'%')
  41. </if>
  42. <if test="companyName != '' and companyName != null">
  43. and c.CompanyName like Concat('%',#{companyName},'%')
  44. </if>
  45. <if test="recommendType != null">
  46. and a.RecommendType = #{recommendType}
  47. </if>
  48. <if test="entryState != null">
  49. and a.EntryState = #{entryState}
  50. </if>
  51. <if test="pushName != '' and pushName != null">
  52. and g.Name like Concat('%',#{pushName},'%')
  53. </if>
  54. <if test="qzProfessionName != '' and qzProfessionName != null">
  55. and f2.ProfessionName like Concat('%',#{qzProfessionName},'%')
  56. </if>
  57. <if test="zpProfessionName != '' and zpProfessionName != null">
  58. and f.ProfessionName like Concat('%',#{zpProfessionName},'%')
  59. </if>
  60. <if test="siteID != null and siteID != ''">
  61. and e.siteId = #{siteID}
  62. </if>
  63. <if test="regionCode != '' and regionCode != null">
  64. and e.RegionCode = #{regionCode}
  65. </if>
  66. <if test="startDate != null and endDate == null">
  67. and a.CreateTime <![CDATA[ >= ]]> #{startDate}
  68. </if>
  69. <if test="endDate != null and startDate == null">
  70. and a.CreateTime <![CDATA[ <= ]]> #{endDate}
  71. </if>
  72. <if test="startDate != null and endDate != null">
  73. and a.CreateTime <![CDATA[ >= ]]> #{startDate}
  74. and a.CreateTime <![CDATA[ <= ]]> #{endDate}
  75. </if>
  76. <if test="curLoginUserSiteJobHuntIDs != '' and curLoginUserSiteJobHuntIDs != null">
  77. and a.JobHuntID in (${curLoginUserSiteJobHuntIDs})
  78. </if>
  79. </where>
  80. order by a.createtime desc
  81. </select>
  82. <!-- 推荐岗位信息-->
  83. <select id="getRecommendCompanyPostList"
  84. resultType="com.hz.employmentsite.vo.jobUserManager.RecommendCompanyPostVo">
  85. select a.postid,b.companyID,b.companyname,c.professionname,a.recruitcount,a.starttime,a.endtime,b.companyAddress,
  86. case when d.recommendmgtid is null then '未推荐' else '已推荐' end as isRecommend,d.recommendMgtID,
  87. a.professionid,a.maxsalary,a.minsalary,area.name as regionName,site.SiteName,
  88. (case when (a.contactMobile is null or a.contactMobile = '') then b.userMobile else a.contactMobile end) as contactMobile,
  89. dic1.`name` as culturerankname, dic2.`name` as workyearname
  90. from pc_post a
  91. left join pc_company b on a.CompanyID = b.CompanyID
  92. left join (select * from area_code where lv = 3) area on b.RegionCode = area.code
  93. left join (select SiteID,SiteName from pc_site) site on b.SiteID = site.SiteID
  94. left join pc_profession c on a.ProfessionID = c.ProfessionID
  95. left join pc_recommend_mgt d on a.PostID = d.PostID and d.JobHuntID = #{jobHuntID}
  96. left join (select `Value`,`Name` from sys_dictionary_item where DictionaryCode='CultureLevel') dic1 on
  97. a.CultureRank = dic1.`Value`
  98. left join (select `Value`,`Name`,`Code` from sys_dictionary_item where DictionaryCode='WorkYearType') dic2 on
  99. a.WorkYear = dic2.`Value`
  100. <where>
  101. <if test="type!=null and type==0">
  102. and d.RecommendMgtID is null
  103. and a.RecordStatus = 1
  104. </if>
  105. <if test="type!=null and type==1">
  106. and d.RecommendMgtID is not null
  107. </if>
  108. <choose>
  109. <when test="parentProfessionID != null and parentProfessionID!=''">
  110. and c.ParentProfessionID = #{parentProfessionID}
  111. </when>
  112. <when test="professionID != null and professionID != '' and (inviteProfessionName == null or inviteProfessionName == '') and (companyName == null or companyName == '') ">
  113. and a.ProfessionID = #{professionID}
  114. </when>
  115. <when test="professionID != null and professionID != '' and (inviteProfessionName == null or inviteProfessionName == '') and (companyName != null and companyName != '')">
  116. and ( a.ProfessionID = #{professionID} or b.CompanyName like Concat('%',#{companyName},'%') )
  117. </when>
  118. <when test="(professionID == null or professionID == '') and (inviteProfessionName == null or inviteProfessionName == '') and (companyName != null and companyName != '')">
  119. and b.CompanyName like Concat('%',#{companyName},'%')
  120. </when>
  121. <when test="professionID != null and professionID != '' and inviteProfessionName != null and inviteProfessionName != '' and (companyName == null or companyName == '') ">
  122. and ( a.ProfessionID = #{professionID} or c.professionname like Concat('%',#{inviteProfessionName},'%') )
  123. </when>
  124. <when test="(professionID == null or professionID == '') and inviteProfessionName != null and inviteProfessionName != '' and (companyName == null or companyName == '') ">
  125. and c.professionname like Concat('%',#{inviteProfessionName},'%')
  126. </when>
  127. <when test="professionID != null and professionID != '' and inviteProfessionName != null and inviteProfessionName != '' and companyName != null and companyName!='' ">
  128. and ( a.ProfessionID = #{professionID} or ( b.CompanyName like Concat('%',#{companyName},'%') and c.professionname like Concat('%',#{inviteProfessionName},'%') ) )
  129. </when>
  130. <when test="(professionID == null or professionID == '') and inviteProfessionName != null and inviteProfessionName != '' and companyName != null and companyName!='' ">
  131. and ( b.CompanyName like Concat('%',#{companyName},'%') and c.professionname like Concat('%',#{inviteProfessionName},'%') )
  132. </when>
  133. <otherwise>and 1=1</otherwise>
  134. </choose>
  135. <if test="cultureRank!=null and cultureRank!=''">
  136. and a.CultureRank = #{cultureRank}
  137. </if>
  138. <if test="workYear!=null and workYear!=''">
  139. and a.workYear = #{workYear}
  140. </if>
  141. <choose>
  142. <when test="minSalary!=null and maxSalary!=null">
  143. and a.MinSalary <![CDATA[<=]]> #{maxSalary} and a.MaxSalary <![CDATA[>=]]> #{minSalary}
  144. </when>
  145. <when test="minSalary!=null and minSalary!=''">
  146. and a.MinSalary <![CDATA[>=]]> #{minSalary}
  147. </when>
  148. <when test="maxSalary!=null and maxSalary!=''">
  149. and a.MaxSalary <![CDATA[<=]]> #{maxSalary}
  150. </when>
  151. <otherwise>and 1=1</otherwise>
  152. </choose>
  153. <if test="regionNameList!=null and regionNameList!=''">
  154. and area.name in (${regionNameList})
  155. </if>
  156. <if test="siteNameList!=null and siteNameList!=''">
  157. and site.siteName in (${siteNameList})
  158. </if>
  159. </where>
  160. order by a.CreateTime desc
  161. </select>
  162. <!-- 推荐求职人员信息-->
  163. <select id="getRecommendJobList" resultType="com.hz.employmentsite.vo.jobUserManager.RecommendJobVo">
  164. select a.jobhuntid,b.jobUserID,b.name as userName,b.usermobile,e.sitename,dic1.`name` as culturerankname,dic2.`name` as
  165. keypersontypename,a.workyear,a.minsalary,a.maxsalary,area.name as regionName,
  166. case when d.recommendmgtid is null then '未推荐' else '已推荐' end as
  167. isrecommend,d.recommendMgtID,a.professionid,c.professionname
  168. from pc_jobhunt a
  169. left join pc_jobuser b on a.JobUserID = b.JobUserID
  170. left join area_code area on b.regionCode = area.code
  171. left join pc_profession c on a.ProfessionID = c.ProfessionID
  172. left join pc_site e on b.SiteID = e.SiteID
  173. left join (select `Value`,`Name` from sys_dictionary_item where DictionaryCode='HighestDegree') dic1 on
  174. b.CultureRank = dic1.`Value`
  175. left join (select `Value`,`Name` from sys_dictionary_item where DictionaryCode='KeyPersonType') dic2 on
  176. b.KeyPersonTypeID = dic2.`Value`
  177. left join pc_recommend_mgt d on a.JobHuntID = d.JobHuntID and d.PostID = #{postID}
  178. <where>
  179. <if test="type!=null and type==0">
  180. and d.RecommendMgtID is null
  181. and b.jobStatusID != 1
  182. </if>
  183. <if test="type!=null and type==1">
  184. and d.RecommendMgtID is not null
  185. </if>
  186. <if test="userName!=null and userName!=''">
  187. and b.name like Concat('%',#{userName},'%')
  188. </if>
  189. <if test="keyPersonType!=null and keyPersonType!=''">
  190. and b.KeyPersonTypeID = #{keyPersonType}
  191. </if>
  192. <if test="cultureRank!=null and cultureRank!=''">
  193. and b.CultureRank <![CDATA[<=]]> #{cultureRank}
  194. </if>
  195. <if test="regionNameList !=null and regionNameList!=''">
  196. and area.name in (${regionNameList})
  197. </if>
  198. <if test="siteNameList!=null and siteNameList!=''">
  199. and e.siteName in (${siteNameList})
  200. </if>
  201. <choose>
  202. <when test="parentProfessionID!=null and parentProfessionID!=''">
  203. and c.ParentProfessionID = #{parentProfessionID}
  204. </when>
  205. <when test="professionID!=null and professionID!=''and (huntProfessionName==null or huntProfessionName=='')">
  206. and a.ProfessionID = #{professionID}
  207. </when>
  208. <when test="professionID!=null and professionID!=''and huntProfessionName!=null and huntProfessionName!=''">
  209. and ( a.ProfessionID = #{professionID} or c.professionname like Concat('%',#{huntProfessionName},'%') )
  210. </when>
  211. <otherwise>and 1=1</otherwise>
  212. </choose>
  213. <if test="workYear!=null and workYear!=''">
  214. and a.WorkYear <![CDATA[<=]]> #{workYear}
  215. </if>
  216. <choose>
  217. <when test="minSalary!=null and maxSalary!=null">
  218. and a.MinSalary <![CDATA[<=]]> #{maxSalary} and a.MaxSalary <![CDATA[>=]]> #{minSalary}
  219. </when>
  220. <when test="minSalary!=null and minSalary!=''">
  221. and a.MinSalary <![CDATA[>=]]> #{minSalary}
  222. </when>
  223. <when test="maxSalary!=null and maxSalary!=''">
  224. and a.MaxSalary <![CDATA[<=]]> #{maxSalary}
  225. </when>
  226. <otherwise>and 1=1</otherwise>
  227. </choose>
  228. <if test="recommendedJobHuntIDList!='' and recommendedJobHuntIDList!=null">
  229. and a.jobhuntid not in (${recommendedJobHuntIDList})
  230. </if>
  231. </where>
  232. order by a.CreateTime desc
  233. </select>
  234. <select id="getProfessionLevelList" resultType="com.hz.employmentsite.vo.jobUserManager.ProfessionLevel">
  235. select ProfessionID, ParentProfessionID, ProfessionName, '1' as ProfessionLevel
  236. from pc_profession
  237. where ParentProfessionID = ''
  238. union all
  239. select a.ProfessionID, a.ParentProfessionID, a.ProfessionName, '2' as ProfessionLevel
  240. from pc_profession a
  241. inner join (select ProfessionID from pc_profession where ParentProfessionID = '') b
  242. on a.ParentProfessionID = b.ProfessionID
  243. union all
  244. select c.ProfessionID, c.ParentProfessionID, c.ProfessionName, '3' as ProfessionLevel
  245. from pc_profession c
  246. inner join (select a.ProfessionID
  247. from pc_profession a
  248. inner join (select ProfessionID from pc_profession where ParentProfessionID = '') b
  249. on a.ParentProfessionID = b.ProfessionID) bb
  250. on c.ParentProfessionID = bb.ProfessionID
  251. </select>
  252. <select id="getCompanyProfessionLikeList" resultType="com.hz.employmentsite.vo.jobUserManager.ProfessionLevel">
  253. select aa.ProfessionID, aa.ParentProfessionID, aa.ProfessionName, bb.ProfessionName as ParentProfessionName,
  254. company.companyName,post.postName
  255. from (
  256. select c.ProfessionID, c.ParentProfessionID, c.ProfessionName,c.OrderNo
  257. from pc_profession c
  258. inner join (select a.ProfessionID
  259. from pc_profession a
  260. inner join (select ProfessionID from pc_profession where ParentProfessionID = '') b
  261. on a.ParentProfessionID = b.ProfessionID) bb
  262. on c.ParentProfessionID = bb.ProfessionID
  263. where 1=1
  264. <if test="professionName!=null and professionName!=''">
  265. and c.ProfessionName like Concat('%',#{professionName},'%')
  266. </if>
  267. ) aa
  268. left join pc_profession bb on aa.ParentProfessionID = bb.ProfessionID
  269. left join pc_post post on aa.ProfessionID = post.ProfessionID
  270. left join pc_company company on post.companyID = company.companyID
  271. where 1=1 and post.RecordStatus = 1
  272. <if test="companyName!=null and companyName!=''">
  273. and company.companyName = #{companyName}
  274. </if>
  275. order by bb.OrderNo,aa.OrderNo
  276. </select>
  277. <select id="getProfessionLikeList" resultType="com.hz.employmentsite.vo.jobUserManager.ProfessionLevel">
  278. select aa.ProfessionID, aa.ParentProfessionID, aa.ProfessionName, bb.ProfessionName as ParentProfessionName
  279. from (
  280. select c.ProfessionID, c.ParentProfessionID, c.ProfessionName,c.OrderNo
  281. from pc_profession c
  282. inner join (select a.ProfessionID
  283. from pc_profession a
  284. inner join (select ProfessionID from pc_profession where ParentProfessionID = '') b
  285. on a.ParentProfessionID = b.ProfessionID) bb
  286. on c.ParentProfessionID = bb.ProfessionID
  287. <where>
  288. <choose>
  289. <when test="professionName!=null and professionName!=''">
  290. and c.ProfessionName like Concat('%',#{professionName},'%')
  291. </when>
  292. <otherwise>
  293. and 1!=1
  294. </otherwise>
  295. </choose>
  296. </where>
  297. ) aa
  298. left join pc_profession bb on aa.ParentProfessionID = bb.ProfessionID
  299. order by bb.OrderNo,aa.OrderNo
  300. </select>
  301. <select id="getWorkCategoryLevelList" resultType="com.hz.employmentsite.vo.jobUserManager.WorkCategoryLevel">
  302. select WorkCategoryID, ParentWorkCategoryID, WorkCategoryName, '1' as WorkCategoryLevel
  303. from pc_workcategory
  304. where ParentWorkCategoryID = ''
  305. union all
  306. select a.WorkCategoryID, a.ParentWorkCategoryID, a.WorkCategoryName, '2' as WorkCategoryLevel
  307. from pc_workcategory a
  308. inner join (select WorkCategoryID from pc_workcategory where ParentWorkCategoryID = '') b
  309. on a.ParentWorkCategoryID = b.WorkCategoryID
  310. union all
  311. select c.WorkCategoryID, c.ParentWorkCategoryID, c.WorkCategoryName, '3' as WorkCategoryLevel
  312. from pc_workcategory c
  313. inner join (select a.WorkCategoryID
  314. from pc_workcategory a
  315. inner join (select WorkCategoryID from pc_workcategory where ParentWorkCategoryID = '') b
  316. on a.ParentWorkCategoryID = b.WorkCategoryID) bb
  317. on c.ParentWorkCategoryID = bb.WorkCategoryID
  318. </select>
  319. <select id="getOccupationCategoryList" resultType="com.hz.employmentsite.vo.jobUserManager.OccupationCategory">
  320. select OccupationalID, ParentOccupationalID, OccupationalName, '1' as OccupationalLevel
  321. from pc_occupational
  322. where ParentOccupationalID = '0'
  323. union all
  324. select a.OccupationalID, a.ParentOccupationalID, a.OccupationalName, '2' as OccupationalLevel
  325. from pc_occupational a
  326. inner join (select OccupationalID from pc_occupational where ParentOccupationalID = '0') b
  327. on a.ParentOccupationalID = b.OccupationalID
  328. </select>
  329. <select id="getAllIndustryList" resultType="com.hz.employmentsite.vo.jobUserManager.IndustryLevel">
  330. select IndustryID, ParentID, IndustryName, '1' as IndustryLevel
  331. from pc_industry
  332. where ParentID = ''
  333. union all
  334. select a.IndustryID, a.ParentID, a.IndustryName, '2' as IndustryLevel
  335. from pc_industry a
  336. inner join (select IndustryID from pc_industry where ParentID = '') b
  337. on a.ParentID = b.IndustryID
  338. </select>
  339. <select id="getCompanypostToUsermessageList" resultType="java.util.HashMap">
  340. select a.recommendmgtid,
  341. e.openId as userOpenId,
  342. c.companyname,
  343. c.usermobile as companymobile,
  344. f.professionname as postName
  345. from pc_recommend_mgt a
  346. inner join pc_post b on a.PostID = b.PostID
  347. inner join pc_company c on b.CompanyID = c.CompanyID
  348. inner join pc_jobhunt d on a.JobHuntID = d.JobHuntID
  349. inner join pc_jobuser e on d.JobUserID = e.JobuserID
  350. inner join pc_profession f on b.ProfessionID = f.ProfessionID
  351. where (a.isSendUser = 0 || a.isSendUser is null)
  352. and e.openId is not null
  353. </select>
  354. <select id="getUserhuntpostToCompanymessageList" resultType="java.util.HashMap">
  355. select a.recommendmgtid,
  356. c.openId as companyOpenId,
  357. e.`name` as userName,
  358. e.usermobile,
  359. f2.professionname as userHuntPostName
  360. from pc_recommend_mgt a
  361. inner join pc_post b on a.PostID = b.PostID
  362. inner join pc_company c on b.CompanyID = c.CompanyID
  363. inner join pc_jobhunt d on a.JobHuntID = d.JobHuntID
  364. inner join pc_jobuser e on d.JobUserID = e.JobuserID
  365. inner join pc_profession f2 on d.ProfessionID = f2.ProfessionID
  366. where (a.isSendCompany = 0 || a.isSendCompany is null)
  367. and c.openId is not null
  368. </select>
  369. </mapper>