ProjectProvincesDao.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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="platform.modules.company.dao.ProjectProvincesDao">
  4. <!-- 企业我的项目填报列表 -->
  5. <select id="findByCondition" resultType="platform.modules.company.entity.ProjectProvinces">
  6. SELECT DISTINCT
  7. a.id,
  8. a.company_id,
  9. a.apply_no,
  10. a.apply_date,
  11. a.receive_date,
  12. a.declaration_id,
  13. a.apply_status,
  14. a.approve_status,
  15. a.create_time,
  16. a.create_by,
  17. s.service_super_type as service_super_type,
  18. s.id as service_type,
  19. s.service_type_name as service_type_name,
  20. d.project_source as project_source,
  21. c.company_name as company_name
  22. FROM
  23. project_provinces a
  24. LEFT JOIN y_company c on c.id = a.company_id
  25. LEFT JOIN project_provinces_declaration d on d.id = a.declaration_id
  26. LEFT JOIN project_service_type s on s.id = d.project_service_type
  27. WHERE
  28. a.del_flag = '0'
  29. <if test="searchCondition.company_id!=null and searchCondition.company_id!=''">
  30. and a.company_id = #{searchCondition.company_id}
  31. </if>
  32. <if test="searchCondition.service_super_type!=null and searchCondition.service_super_type!=''">
  33. and s.service_super_type = #{searchCondition.service_super_type}
  34. </if>
  35. <if test="searchCondition.project_name!=null and searchCondition.project_name!=''">
  36. and s.service_type_name like CONCAT ('%',#{searchCondition.project_name},'%')
  37. </if>
  38. <if test="searchCondition.apply_status!=null and searchCondition.apply_status!=''">
  39. and a.apply_status = #{searchCondition.apply_status}
  40. </if>
  41. <if test="searchCondition.approve_status!=null and searchCondition.approve_status!=''">
  42. and a.approve_status=#{searchCondition.approve_status}
  43. </if>
  44. <if test="searchCondition.startTime!=null and searchCondition.startTime!=''">
  45. and a.apply_date &gt;= #{searchCondition.startTime}
  46. </if>
  47. <if test="searchCondition.endTime!=null and searchCondition.endTime!=''">
  48. and a.apply_date &lt;= #{searchCondition.endTime}
  49. </if>
  50. order by create_time desc
  51. </select>
  52. <select id="findApplyById" resultType="platform.modules.company.entity.ProjectProvinces">
  53. SELECT DISTINCT
  54. a.id,
  55. a.company_id,
  56. a.apply_no,
  57. a.apply_date,
  58. a.receive_date,
  59. a.declaration_id,
  60. a.apply_status,
  61. a.approve_status,
  62. a.category_id,
  63. a.project_type_name,
  64. a.is_statement,
  65. a.create_time,
  66. a.create_by,
  67. s.service_super_type as service_super_type,
  68. s.id as service_type,
  69. s.service_type_name as service_type_name,
  70. d.project_source as project_source,
  71. c.company_name as company_name
  72. FROM
  73. project_provinces a
  74. LEFT JOIN y_company c on c.id = a.company_id
  75. LEFT JOIN project_provinces_declaration d on d.id = a.declaration_id
  76. LEFT JOIN project_service_type s on s.id = d.project_service_type
  77. WHERE
  78. a.del_flag = '0' and a.id = #{apply_id}
  79. </select>
  80. <select id="findExistFilling" resultType="platform.modules.company.entity.ProjectProvinces">
  81. SELECT
  82. a.id,
  83. a.company_id,
  84. a.declaration_id
  85. FROM
  86. project_provinces a
  87. WHERE a.del_flag = '0'
  88. <if test="searchCondition.company_id!=null and searchCondition.company_id!=''">
  89. and a.company_id=#{searchCondition.company_id}
  90. </if>
  91. <if test="searchCondition.declaration_id!=null and searchCondition.declaration_id!=''">
  92. and a.declaration_id=#{searchCondition.declaration_id}
  93. </if>
  94. </select>
  95. <!-- 企业我的项目填报列表 -->
  96. <select id="findPageByIds" resultType="platform.modules.company.entity.ProjectProvinces">
  97. SELECT DISTINCT
  98. a.id,
  99. a.company_id,
  100. a.apply_no,
  101. a.apply_date,
  102. a.receive_date,
  103. a.declaration_id,
  104. a.apply_status,
  105. a.approve_status,
  106. a.create_time,
  107. a.create_by,
  108. s.service_super_type as service_super_type,
  109. s.id as service_type,
  110. s.service_type_name as service_type_name,
  111. d.project_source as project_source,
  112. c.company_name as company_name
  113. FROM
  114. project_provinces a
  115. LEFT JOIN y_company c on c.id = a.company_id
  116. LEFT JOIN project_provinces_declaration d on d.id = a.declaration_id
  117. LEFT JOIN project_service_type s on s.id = d.project_service_type
  118. WHERE
  119. a.del_flag = '0'
  120. and d.id = #{id}
  121. and a.apply_status != '0'
  122. <if test="streetId!=null and streetId!=''">
  123. and c.street_id=#{streetId}
  124. </if>
  125. order by create_time desc
  126. </select>
  127. <!-- 企业我的项目填报列表 -->
  128. <select id="findPageById" resultType="platform.modules.company.entity.ProjectProvinces">
  129. SELECT DISTINCT
  130. a.id,
  131. a.company_id,
  132. a.apply_no,
  133. a.apply_date,
  134. detail.create_time receive_date,
  135. a.declaration_id,
  136. a.apply_status,
  137. a.approve_status,
  138. a.create_time,
  139. a.create_by,
  140. s.service_super_type AS service_super_type,
  141. s.id AS service_type,
  142. s.service_type_name AS service_type_name,
  143. d.project_source AS project_source,
  144. c.company_name AS company_name
  145. FROM
  146. project_provinces a
  147. LEFT JOIN y_company c ON c.id = a.company_id
  148. LEFT JOIN project_provinces_declaration d ON d.id = a.declaration_id
  149. LEFT JOIN project_service_type s ON s.id = d.project_service_type
  150. LEFT JOIN c_message m ON m.apply_id = d.id
  151. LEFT JOIN c_message_detail detail ON m.id = detail.message_id
  152. LEFT JOIN y_company company ON detail.push_id = company.id
  153. WHERE
  154. a.del_flag = '0'
  155. and d.id = #{id}
  156. and a.apply_status != '0'
  157. <if test="streetId!=null and streetId!=''">
  158. and c.street_id=#{streetId}
  159. </if>
  160. order by create_time desc
  161. </select>
  162. <!-- 企业我的项目填报列表 -->
  163. <select id="findPageByIdAndApproveStatus" resultType="platform.modules.company.entity.ProjectProvinces">
  164. SELECT DISTINCT
  165. a.id,
  166. a.company_id,
  167. a.apply_no,
  168. a.apply_date,
  169. a.receive_date,
  170. a.declaration_id,
  171. a.apply_status,
  172. a.approve_status,
  173. a.create_time,
  174. a.create_by,
  175. s.service_super_type as service_super_type,
  176. s.id as service_type,
  177. s.service_type_name as service_type_name,
  178. d.project_source as project_source,
  179. c.company_name as company_name
  180. FROM
  181. project_provinces a
  182. LEFT JOIN y_company c on c.id = a.company_id
  183. LEFT JOIN project_provinces_declaration d on d.id = a.declaration_id
  184. LEFT JOIN project_service_type s on s.id = d.project_service_type
  185. WHERE
  186. a.del_flag = '0'
  187. and d.id = #{id}
  188. <if test="approveStatus!=null and approveStatus!=''">
  189. and a.approve_status = #{approveStatus}
  190. </if>
  191. and a.apply_status != '0'
  192. <if test="streetId!=null and streetId!=''">
  193. and c.street_id=#{streetId}
  194. </if>
  195. order by create_time desc
  196. </select>
  197. <select id="findPage" parameterType="platform.modules.government.dto.ParamApplication"
  198. resultType="platform.modules.government.dto.ProjectProvincesDto">
  199. SELECT
  200. application.id id,
  201. application.apply_no apply_no,
  202. company.company_name company_name,
  203. declaration.project_service_type project_service_type,
  204. declaration.project_source project_source,
  205. application.approve_status approve_status
  206. FROM
  207. project_provinces application
  208. LEFT JOIN z_approval approval ON approval.APPLY_ID = application.id
  209. AND approval.TYPE = #{project.approval_type}
  210. LEFT JOIN y_company company ON company.id = application.company_id
  211. LEFT JOIN project_provinces_declaration declaration ON declaration.id = application.declaration_id
  212. LEFT JOIN project_service_type servicetype ON declaration.project_service_type = servicetype.id
  213. WHERE
  214. 1 = 1
  215. <if test="project.projectIds.size() > 0 ">
  216. AND application.id IN
  217. <foreach collection="project.projectIds" index="index" item="item" open="(" separator="," close=")">
  218. #{item}
  219. </foreach>
  220. </if>
  221. <if test="project.projectIds.size() == 0 ">
  222. AND application.id=0
  223. </if>
  224. <if test="project.project_type != null and project.project_type != '' ">
  225. AND declaration.project_type = #{project.project_type}
  226. </if>
  227. <if test="project.project_source != null and project.project_source != '' ">
  228. AND declaration.project_source = #{project.project_source}
  229. </if>
  230. <if test="project.company_name != null and project.company_name != '' ">
  231. AND company.company_name LIKE CONCAT('%',#{project.company_name},'%')
  232. </if>
  233. <if test="project.project_name != null and project.project_name != '' ">
  234. AND declaration.project_name LIKE CONCAT('%',#{project.project_name},'%')
  235. </if>
  236. <if test="project.project_service_type_name != null and project.project_service_type_name != '' ">
  237. AND servicetype.service_type_name LIKE CONCAT('%',#{project.project_service_type_name},'%')
  238. </if>
  239. GROUP BY application.id
  240. ORDER BY application.create_time DESC
  241. </select>
  242. <select id="findMessageByIdAndType" resultType="platform.modules.government.dto.ProjectMessageDto">
  243. SELECT
  244. c.company_name,d.create_time,d.is_read
  245. FROM
  246. c_message m
  247. LEFT JOIN c_message_detail d ON m.id = d.message_id
  248. LEFT JOIN y_company c on d.push_id=c.id
  249. WHERE
  250. m.apply_id = #{id}
  251. and m.business_type = #{type}
  252. </select>
  253. <select id="findProvincesList" resultType="platform.modules.company.entity.ProjectProvinces">
  254. SELECT
  255. p.*
  256. FROM
  257. project_provinces p
  258. LEFT JOIN project_provinces_declaration pd ON pd.id = p.declaration_id
  259. WHERE
  260. p.del_flag = false
  261. <if test="searchCondition.companyId != null and searchCondition.companyId != ''">
  262. AND p.company_id = #{searchCondition.companyId}
  263. </if>
  264. <if test="searchCondition.streetId != null and searchCondition.streetId != ''">
  265. AND p.street_id = #{searchCondition.streetId}
  266. </if>
  267. <if test="searchCondition.project_service_type != null and searchCondition.project_service_type != ''">
  268. AND pd.project_service_type LIKE CONCAT ('%', #{searchCondition.project_service_type}, '%')
  269. </if>
  270. <if test="searchCondition.project_source != null and searchCondition.project_source != ''">
  271. AND pd.project_source = #{searchCondition.project_source}
  272. </if>
  273. <if test="searchCondition.approve_status != null and searchCondition.approve_status != ''">
  274. AND p.approve_status = #{searchCondition.approve_status}
  275. </if>
  276. ORDER BY p.create_time DESC
  277. </select>
  278. <select id="findByProjectIdAndApproveStatus" resultType="platform.modules.company.entity.ProjectProvinces">
  279. select * from project_provinces
  280. where del_flag = 0
  281. <if test="null != projectIds and projectIds.size >0 and projectDecIds.size ==0">
  282. and project_id IN
  283. <foreach collection="projectIds" index="index" item="item" open="(" separator="," close=")">
  284. #{item}
  285. </foreach>
  286. </if>
  287. <if test="null != projectDecIds and projectDecIds.size >0 and projectIds.size ==0">
  288. and declaration_id IN
  289. <foreach collection="projectDecIds" index="index" item="item" open="(" separator="," close=")">
  290. #{item}
  291. </foreach>
  292. </if>
  293. <if test="null != projectDecIds and projectDecIds.size >0 and projectIds.size >0">
  294. and (project_id IN
  295. <foreach collection="projectIds" index="index" item="item" open="(" separator="," close=")">
  296. #{item}
  297. </foreach>
  298. or declaration_id IN
  299. <foreach collection="projectDecIds" index="index" item="item" open="(" separator="," close=")">
  300. #{item}
  301. </foreach>
  302. )
  303. </if>
  304. <if test="null != approveStatus and approveStatus.size >0">
  305. AND approve_status IN
  306. <foreach collection="approveStatus" index="index" item="item" open="(" separator="," close=")">
  307. #{item}
  308. </foreach>
  309. </if>
  310. <if test="null != companyIds and companyIds.size >0">
  311. AND company_id IN
  312. <foreach collection="companyIds" index="index" item="item" open="(" separator="," close=")">
  313. #{item}
  314. </foreach>
  315. </if>
  316. </select>
  317. <select id="findAll" resultType="platform.modules.company.entity.ProjectProvinces">
  318. SELECT
  319. p.*
  320. FROM
  321. project_provinces p
  322. left join project_provinces_declaration d on p.declaration_id = d.id
  323. inner join project_service_type t on d.project_service_type = t.id and t.del_flag = 0
  324. WHERE p.apply_status != 0
  325. <if test="searchCondition.begin_date != null and searchCondition.begin_date != ''">
  326. AND p.apply_date <![CDATA[>=]]> #{searchCondition.begin_date}
  327. </if>
  328. <if test="searchCondition.end_date != null and searchCondition.end_date != ''">
  329. AND p.apply_date <![CDATA[<=]]> #{searchCondition.end_date}
  330. </if>
  331. <if test="searchCondition.projectType != null and searchCondition.projectType != ''">
  332. AND d.project_service_type = #{searchCondition.projectType}
  333. </if>
  334. </select>
  335. <select id="findListByCondition" resultType="platform.modules.company.entity.ProjectProvinces">
  336. SELECT
  337. *
  338. FROM
  339. project_provinces
  340. WHERE
  341. 1=1
  342. <if test="condition.begin_date != null and condition.begin_date !='' ">
  343. <![CDATA[ and DATE_FORMAT(create_time, '%Y-%m-%d')>= DATE_FORMAT(#{condition.begin_date}, '%Y-%m-%d') ]]>
  344. </if>
  345. <if test="condition.end_date != null and condition.end_date !='' ">
  346. <![CDATA[ and DATE_FORMAT(create_time, '%Y-%m-%d')<= DATE_FORMAT(#{condition.end_date}, '%Y-%m-%d') ]]>
  347. </if>
  348. </select>
  349. </mapper>