CompanyCQuery.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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.CompanyCQuery">
  4. <select id="getList" resultType="com.hz.employmentsite.vo.companyService.CompanyVo">
  5. select company.*,city.name as regionName,area.name as streetName,sparea.name as
  6. signInPoliticalAreaName,sys_cmodel.Name as companyModelType,
  7. postCountData.postCount,u.`Name` as createUserName
  8. ,inSites.InstitutionID as institutionID,site.SiteName,com_status.Name as recordStatusName,
  9. industry.industryName as industryName,industry.industryName as showIndustryName,
  10. com_estate.Name as estateCategoryName,com_type.Name as companyTypeName,com_reType.Name as RegisteredCapitalTypeName,
  11. com_tag.Name as tagName,com_short.Name as isShortageName,modifyUser.Name as modifyUserName, createUser.`Name` as createUserName
  12. from pc_company company
  13. left join sys_user u on u.UserID = company.CreateUserID
  14. left join (select * from sys_dictionary_item where DictionaryCode ='CompanyModel') sys_cmodel on
  15. company.CompanyModel = sys_cmodel.Value
  16. left join (select * from sys_dictionary_item where DictionaryCode ='CompanyType') com_type on
  17. company.CompanyType = com_type.Value
  18. left join (select * from sys_dictionary_item where DictionaryCode ='CompanyStatus') com_status on
  19. company.RecordStatus = com_status.Value
  20. left join (select * from sys_dictionary_item where DictionaryCode ='CompanyEstateCategory') com_estate on
  21. company.EstateCategoryID = com_estate.Value
  22. left join (select * from sys_dictionary_item where DictionaryCode ='CompanyTag') com_tag on
  23. company.TagID = com_tag.Value
  24. left join (select * from sys_dictionary_item where DictionaryCode ='IsShortAge') com_short on
  25. company.IsShortage = com_short.Value
  26. left join (select * from sys_dictionary_item where DictionaryCode ='RegisteredCapitalType') com_reType on
  27. company.RegisteredCapitalType = com_reType.Value
  28. left join pc_industry industry on company.IndustryID = industry.industryId
  29. left join area_code city on company.RegionCode = city.code
  30. left join area_code area on company.StreetCode = area.code
  31. left join area_code sparea on company.SignInPoliticalArea = sparea.code
  32. left join pc_site site on company.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. left join sys_user createUser on company.CreateUserID = createUser.UserID
  36. left join sys_user modifyUser on company.ModifyUserID = modifyUser.UserID
  37. left join (select CompanyID, count(1) as postCount from pc_post group by CompanyID) postCountData on postCountData.CompanyID = company.CompanyID
  38. where 1=1
  39. <if test="companyIDList!='' and companyIDList!=null">
  40. and company.companyID in (${companyIDList})
  41. </if>
  42. <if test="companyName!='' and companyName!=null">
  43. and company.companyName like Concat('%',#{companyName},'%')
  44. </if>
  45. <if test="companyCode!='' and companyCode!=null">
  46. and company.companyCode like Concat('%',#{companyCode},'%')
  47. </if>
  48. <if test="recordStatus!='' and recordStatus!=null">
  49. and company.RecordStatus = #{recordStatus}
  50. </if>
  51. <if test="regionCode!='' and regionCode!=null">
  52. and company.regionCode like Concat('%',#{regionCode},'%')
  53. </if>
  54. <if test="streetCode!='' and regionCode!=null">
  55. and company.streetCode like Concat('%',#{streetCode},'%')
  56. </if>
  57. <if test="createUserId!='' and createUserId!=null">
  58. and company.CreateUserID = #{createUserId}
  59. </if>
  60. <if test="companyTypeID != '' and companyTypeID != null">
  61. and company.CompanyType = #{companyTypeID}
  62. </if>
  63. <if test="industryID != '' and industryID != null">
  64. and company.IndustryID = #{industryID}
  65. </if>
  66. <if test="workTime!='' and workTime!=null">
  67. and Date(company.CreateTime) = Date(#{workTime})
  68. </if>
  69. <if test="curLoginUserSiteID!='' and curLoginUserSiteID!=null">
  70. and company.siteID = #{curLoginUserSiteID}
  71. </if>
  72. <if test="siteID!='' and siteID!=null">
  73. and company.siteID = #{siteID}
  74. </if>
  75. <if test="startDate != null and endDate == null">
  76. and company.CreateTime <![CDATA[ >= ]]> #{startDate}
  77. </if>
  78. <if test="endDate != null and startDate == null">
  79. and company.CreateTime <![CDATA[ <= ]]> #{endDate}
  80. </if>
  81. <if test="startDate != null and endDate != null">
  82. and company.CreateTime <![CDATA[ >= ]]> #{startDate}
  83. and company.CreateTime <![CDATA[ <= ]]> #{endDate}
  84. </if>
  85. <if test="isAllCompany != null and isAllCompany == true ">
  86. or company.companyID = 'AllCompany'
  87. </if>
  88. <if test="createUserName!='' and createUserName!=null">
  89. and createUser.`Name` like Concat('%',#{createUserName},'%')
  90. </if>
  91. order by
  92. <if test="postCountSorter == null or postCountSorter == ''">
  93. company.CreateTime desc,
  94. postCount desc
  95. </if>
  96. <if test="postCountSorter != null and postCountSorter == 'ascend'">
  97. postCount,
  98. company.CreateTime desc
  99. </if>
  100. <if test="postCountSorter != null and postCountSorter == 'descend'">
  101. postCount desc,
  102. company.CreateTime desc
  103. </if>
  104. </select>
  105. <select id="getFirmNameLikeList" resultType="com.hz.employmentsite.model.PcFirm">
  106. select id,FirmName
  107. from pc_firm
  108. <where>
  109. <choose>
  110. <when test="firmName!=null and firmName!=''">
  111. and FirmName like Concat('%',#{firmName},'%')
  112. </when>
  113. <otherwise>
  114. and 1!=1
  115. </otherwise>
  116. </choose>
  117. </where>
  118. LIMIT 30
  119. </select>
  120. <select id="getDataMapList" resultType="com.hz.employmentsite.vo.dataMap.CompanyPostMapVo">
  121. SELECT
  122. company.CompanyID,
  123. company_user.`Name` as companyCreateUserName,
  124. company.CompanyName,
  125. company.CompanyAddress,
  126. cmodel.`Name` AS companyModelType,
  127. com_status.`Name` AS recordStatusName,
  128. company.Longitude,
  129. company.Latitude,
  130. (
  131. 6371 * ACOS(
  132. COS(
  133. RADIANS( #{latitude} )) * COS(
  134. RADIANS( company.Latitude )) * COS(
  135. RADIANS( company.Longitude ) - RADIANS( #{longitude} )) + SIN(
  136. RADIANS( #{latitude} )) * SIN(
  137. RADIANS( company.Latitude ))
  138. )) AS distance
  139. FROM
  140. pc_company company
  141. LEFT JOIN sys_dictionary_item cmodel ON company.CompanyModel = cmodel.`Value`
  142. AND cmodel.DictionaryCode = 'CompanyModel'
  143. LEFT JOIN sys_dictionary_item com_status ON company.RecordStatus = com_status.`Value`
  144. AND com_status.DictionaryCode = 'CompanyStatus'
  145. LEFT JOIN sys_user company_user ON company.CreateUserID = company_user.UserID
  146. WHERE 1=1
  147. <if test="companyName!='' and companyName!=null">
  148. and company.companyName like Concat('%',#{companyName},'%')
  149. </if>
  150. <if test="companyModel!=null">
  151. and company.companyModel = #{companyModel}
  152. </if>
  153. <if test="recordStatus!=null">
  154. and company.recordStatus = #{recordStatus}
  155. </if>
  156. <if test="regionCode!='' and regionCode!=null">
  157. and company.regionCode = #{regionCode}
  158. </if>
  159. <if test="siteID!='' and siteID!=null">
  160. and company.siteID = #{siteID}
  161. </if>
  162. <if test="createTimeBy!='' and createTimeBy!=null">
  163. and Date(company.CreateTime) <![CDATA[ >= ]]> Date(#{createTimeBy})
  164. </if>
  165. <if test="maxDistance!=null">
  166. HAVING
  167. distance <![CDATA[ <= ]]> #{maxDistance}
  168. </if>
  169. ORDER BY
  170. company.CreateTime DESC
  171. </select>
  172. <select id="getDataMapListByPostName" resultType="com.hz.employmentsite.vo.dataMap.CompanyPostMapVo">
  173. SELECT
  174. post.PostID,
  175. post_user.`Name` as postCreateUserName,
  176. prof.ProfessionName,
  177. post.MinSalary,
  178. post.MaxSalary,
  179. post.RecruitCount,
  180. post.ContactName,
  181. post.ContactMobile,
  182. post_culture.`Name` AS cultureLevelName,
  183. post.StartTime,
  184. post.EndTime,
  185. post.welfare,
  186. post.postDesc,
  187. company.CompanyID,
  188. company_user.`Name` as companyCreateUserName,
  189. company.CompanyName,
  190. company.CompanyAddress,
  191. cmodel.`Name` AS companyModelType,
  192. com_status.`Name` AS recordStatusName,
  193. company.Longitude,
  194. company.Latitude,
  195. (
  196. 6371 * ACOS(
  197. COS(
  198. RADIANS( #{latitude} )) * COS(
  199. RADIANS( company.Latitude )) * COS(
  200. RADIANS( company.Longitude ) - RADIANS( #{longitude} )) + SIN(
  201. RADIANS( #{latitude} )) * SIN(
  202. RADIANS( company.Latitude ))
  203. )) AS distance
  204. FROM
  205. pc_post post
  206. LEFT JOIN pc_profession prof ON post.ProfessionID = prof.ProfessionID
  207. LEFT JOIN pc_company company ON post.CompanyID = company.CompanyID
  208. LEFT JOIN sys_dictionary_item cmodel ON company.CompanyModel = cmodel.`Value`
  209. AND cmodel.DictionaryCode = 'CompanyModel'
  210. LEFT JOIN sys_dictionary_item com_status ON company.RecordStatus = com_status.`Value`
  211. AND com_status.DictionaryCode = 'CompanyStatus'
  212. LEFT JOIN sys_dictionary_item post_culture ON post.CultureRank = post_culture.`Value`
  213. AND post_culture.DictionaryCode = 'CultureLevel'
  214. LEFT JOIN sys_user company_user ON company.CreateUserID = company_user.UserID
  215. LEFT JOIN sys_user post_user ON post.CreateUserID = post_user.UserID
  216. WHERE 1=1
  217. <if test="postName!='' and postName!=null">
  218. and prof.ProfessionName like Concat('%',#{postName},'%')
  219. </if>
  220. <if test="companyModel!=null">
  221. and company.companyModel = #{companyModel}
  222. </if>
  223. <if test="recordStatus!=null">
  224. and company.recordStatus = #{recordStatus}
  225. </if>
  226. <if test="regionCode!='' and regionCode!=null">
  227. and company.regionCode = #{regionCode}
  228. </if>
  229. <if test="siteID!='' and siteID!=null">
  230. and company.siteID = #{siteID}
  231. </if>
  232. <if test="createTimeBy!='' and createTimeBy!=null">
  233. and Date(post.CreateTime) <![CDATA[ >= ]]> Date(#{createTimeBy})
  234. </if>
  235. <if test="maxDistance!=null">
  236. HAVING
  237. distance <![CDATA[ <= ]]> #{maxDistance}
  238. </if>
  239. ORDER BY
  240. post.CreateTime DESC, distance DESC, CompanyID
  241. </select>
  242. </mapper>