ProjectDeclarationDao.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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.government.dao.ProjectDeclarationDao">
  4. <select id="findPageInfo" resultType="platform.modules.government.entity.ProjectDeclaration">
  5. SELECT * FROM project_declaration
  6. where 1=1
  7. <if test="projectName != null and projectName != '' ">
  8. and project_name LIKE CONCAT ('%',#{projectName},'%')
  9. </if>
  10. <if test="startTime1 != null and startTime1 != '' ">
  11. and apply_startDate <![CDATA[>=]]> #{startTime1}
  12. </if>
  13. <if test="startTime2 != null and startTime2 != '' ">
  14. and apply_startDate <![CDATA[<=]]> #{startTime2}
  15. </if>
  16. <if test="endTime1 != null and endTime1 != '' ">
  17. and apply_endDate <![CDATA[>=]]> #{endTime1}
  18. </if>
  19. <if test="endTime2 != null and endTime2 != '' ">
  20. and apply_endDate <![CDATA[<=]]> #{endTime2}
  21. </if>
  22. order by create_time desc
  23. </select>
  24. <select id="selectById" resultType="platform.modules.government.entity.ProjectDeclaration">
  25. select * from project_declaration where id = #{id}
  26. </select>
  27. <select id="findByCondition" resultType="platform.modules.government.entity.ProjectDeclaration">
  28. SELECT distinct
  29. p.* FROM
  30. project_declaration p
  31. LEFT JOIN notices_accept n on n.recorde_id = p.id
  32. where 1=1
  33. <if test="projectName != null and projectName != '' ">
  34. and p.project_name LIKE CONCAT ('%',#{projectName},'%')
  35. </if>
  36. <if test="startTime1 != null and startTime1 != '' ">
  37. and p.apply_startDate <![CDATA[>=]]> left(#{startTime1},10)
  38. </if>
  39. <if test="startTime2 != null and startTime2 != '' ">
  40. and p.apply_startDate <![CDATA[<=]]> left(#{startTime2},10)
  41. </if>
  42. <if test="endTime1 != null and endTime1 != '' ">
  43. and p.apply_endDate <![CDATA[>=]]> left(#{endTime1},10)
  44. </if>
  45. <if test="endTime2 != null and endTime2 != '' ">
  46. and p.apply_endDate <![CDATA[<=]]> left(#{endTime2},10)
  47. </if>
  48. <if test="request.company_id != null and request.company_id != '' ">
  49. and n.user_id = #{request.company_id}
  50. </if>
  51. <if test="request.isActive != null and request.isActive != '' ">
  52. and p.apply_startDate <![CDATA[<=]]> left(now(),10)
  53. and p.apply_endDate <![CDATA[>=]]> left(now(),10)
  54. and p.status != 0
  55. </if>
  56. <if test="searchCondition.is_online_application != null ">
  57. and p.is_online_application =#{searchCondition.is_online_application}
  58. </if>
  59. order by p.create_time desc
  60. </select>
  61. <select id="findUnionProjectsOnHome" resultType="platform.modules.government.entity.ProjectDeclaration">
  62. <if test="request.type != null and request.type != '' and request.type =='4'.toString()">
  63. select * from
  64. (
  65. SELECT
  66. a.id,a.project_name,a.create_time,a.project_source,a.apply_enddate,0 as isFilling,a.project_content AS
  67. content
  68. FROM project_declaration a
  69. where
  70. a.del_flag=0
  71. and a.is_open = 1
  72. and a.status = 1
  73. UNION
  74. select
  75. b.id ,b.project_name,b.create_time,b.project_source,b.end_time AS apply_enddate,3 as isFilling,b.content
  76. from project_intelligent_declaration b
  77. where b.del_flag = 0 and b.status=1
  78. ) temp
  79. order by temp.create_time desc
  80. </if>
  81. <if test="request.type != null and request.type != '' and request.type !='4'.toString()">
  82. select
  83. b.id ,b.project_name,b.create_time,b.project_source,b.end_time AS apply_enddate,1 as isFilling,b.content
  84. from project_provinces_declaration b
  85. where b.del_flag = 0 and b.status=1 AND b.project_source = #{request.type} AND b.is_public = 1
  86. order by b.create_time desc
  87. </if>
  88. <if test="request.type ==''">
  89. select * from
  90. (
  91. SELECT
  92. a.id,a.project_name,a.create_time,a.project_source,a.apply_enddate,0 as isFilling,a.project_content AS
  93. content
  94. FROM project_declaration a
  95. where
  96. a.del_flag=0
  97. and a.is_open = 1
  98. and a.status = 1
  99. UNION
  100. select
  101. b.id ,b.project_name,b.create_time,b.project_source,b.end_time AS apply_enddate,1 as isFilling,b.content
  102. from project_provinces_declaration b
  103. where b.del_flag = 0 and b.status=1 AND b.is_public = 1
  104. UNION
  105. select
  106. b.id ,b.project_name,b.create_time,b.project_source,b.end_time AS apply_enddate,3 as isFilling,b.content
  107. from project_intelligent_declaration b
  108. where b.del_flag = 0 and b.status=1
  109. ) temp
  110. where 1=1
  111. <if test="request.startTime !='' and request.startTime !=null ">
  112. and temp.create_time <![CDATA[>=]]> #{request.startTime}
  113. </if>
  114. <if test="request.endTime !='' and request.endTime !=null ">
  115. and temp.create_time <![CDATA[<=]]> #{request.endTime}
  116. </if>
  117. order by temp.create_time desc
  118. </if>
  119. </select>
  120. <select id="findUnionProjectsOnHomeV2" resultType="platform.modules.government.entity.ProjectDeclaration">
  121. select * from
  122. (
  123. SELECT
  124. a.id,a.project_name,a.create_time,a.project_source,a.apply_enddate,0 as isFilling,a.project_content AS
  125. content
  126. FROM project_declaration a
  127. where
  128. a.del_flag=0
  129. and a.is_open = 1
  130. and a.status = 1
  131. UNION
  132. select
  133. b.id ,b.project_name,b.create_time,b.project_source,b.end_time AS apply_enddate,3 as isFilling,b.content
  134. from project_intelligent_declaration b
  135. where b.del_flag = 0 and b.status=1
  136. union
  137. select
  138. c.id ,c.project_name,c.create_time,c.project_source,c.end_time AS apply_enddate,1 as isFilling,c.content
  139. from project_provinces_declaration c
  140. where c.del_flag = 0 and c.status=1
  141. AND c.is_public = 1
  142. ) temp
  143. where 1=1
  144. <if test="request.type != null and request.type != ''">
  145. and temp.project_source = #{request.type}
  146. </if>
  147. <if test="request.startTime !='' and request.startTime !=null ">
  148. and temp.create_time <![CDATA[>=]]> #{request.startTime}
  149. </if>
  150. <if test="request.endTime !='' and request.endTime !=null ">
  151. and temp.create_time <![CDATA[<=]]> #{request.endTime}
  152. </if>
  153. order by temp.create_time desc
  154. </select>
  155. <select id="findProjectsOnHome" resultType="platform.modules.government.entity.ProjectDeclaration">
  156. SELECT
  157. a.project_name,a.id,a.create_time,a.project_source,a.apply_enddate
  158. FROM project_declaration a
  159. where
  160. a.del_flag=0
  161. and a.is_open = 1
  162. and a.status = 1
  163. <if test="request.keyword!=null and request.keyword!=''">
  164. and a.project_name LIKE CONCAT ('%',#{ request.keyword},'%')
  165. </if>
  166. <if test="request.type!=null and request.type!=''">
  167. and a.project_source = #{ request.type}
  168. </if>
  169. order by a.create_time desc
  170. limit #{request.start},#{request.page_size}
  171. </select>
  172. <select id="findProjectsCountOnHome" resultType="integer">
  173. SELECT
  174. count(0)
  175. FROM project_declaration a
  176. where a.del_flag = 0
  177. and a.is_open = 1
  178. and a.status = 1
  179. <if test="request.keyword!=null and request.keyword!=''">
  180. and a.project_name LIKE CONCAT ('%',#{ request.keyword},'%')
  181. </if>
  182. <if test="request.type!=null and request.type!=''">
  183. and a.project_source = #{ request.type}
  184. </if>
  185. </select>
  186. </mapper>