ProjectFillingDao.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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.ProjectFillingDao">
  4. <!-- 企业我的项目填报列表 -->
  5. <select id="findByCondition" resultType="platform.modules.company.entity.ProjectFilling">
  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. d.project_source as project_source,
  18. c.company_name as company_name
  19. FROM
  20. project_filling a
  21. LEFT JOIN y_company c on c.id = a.company_id
  22. LEFT JOIN project_filling_declaration d on d.id = a.declaration_id
  23. WHERE
  24. a.del_flag = '0'
  25. <if test="searchCondition.company_id!=null and searchCondition.company_id!=''">
  26. and a.company_id = #{searchCondition.company_id}
  27. </if>
  28. <if test="searchCondition.project_name!=null and searchCondition.project_name!=''">
  29. and d.project_name like CONCAT ('%',#{searchCondition.project_name},'%')
  30. </if>
  31. <if test="searchCondition.apply_status!=null and searchCondition.apply_status!=''">
  32. and a.apply_status = #{searchCondition.apply_status}
  33. </if>
  34. <if test="searchCondition.approve_status!=null and searchCondition.approve_status!=''">
  35. and a.approve_status=#{searchCondition.approve_status}
  36. </if>
  37. <if test="searchCondition.startTime!=null and searchCondition.startTime!=''">
  38. and a.apply_date &gt;= #{searchCondition.startTime}
  39. </if>
  40. <if test="searchCondition.endTime!=null and searchCondition.endTime!=''">
  41. and a.apply_date &lt;= #{searchCondition.endTime}
  42. </if>
  43. order by create_time desc
  44. </select>
  45. <select id="findApplyById" resultType="platform.modules.company.entity.ProjectFilling">
  46. SELECT DISTINCT
  47. a.id,
  48. a.company_id,
  49. a.apply_no,
  50. a.apply_date,
  51. a.receive_date,
  52. a.declaration_id,
  53. a.apply_status,
  54. a.approve_status,
  55. a.create_time,
  56. a.create_by,
  57. s.service_super_type as service_super_type,
  58. s.id as service_type,
  59. s.service_type_name as service_type_name,
  60. d.project_source as project_source,
  61. c.company_name as company_name
  62. FROM
  63. project_filling a
  64. LEFT JOIN y_company c on c.id = a.company_id
  65. LEFT JOIN project_filling_declaration d on d.id = a.declaration_id
  66. LEFT JOIN project_service_type s on s.id = d.project_service_type
  67. WHERE
  68. a.del_flag = '0' and a.id = #{apply_id}
  69. </select>
  70. <select id="findExistFilling" resultType="platform.modules.company.entity.ProjectFilling">
  71. SELECT
  72. a.id,
  73. a.company_id,
  74. a.declaration_id
  75. FROM
  76. project_filling a
  77. WHERE a.del_flag = '0'
  78. <if test="searchCondition.company_id!=null and searchCondition.company_id!=''">
  79. and a.company_id=#{searchCondition.company_id}
  80. </if>
  81. <if test="searchCondition.declaration_id!=null and searchCondition.declaration_id!=''">
  82. and a.declaration_id=#{searchCondition.declaration_id}
  83. </if>
  84. </select>
  85. <!-- 企业我的项目填报列表 -->
  86. <select id="findPageById" resultType="platform.modules.company.entity.ProjectFilling">
  87. SELECT DISTINCT
  88. a.id,
  89. a.company_id,
  90. a.apply_no,
  91. a.apply_date,
  92. a.receive_date,
  93. a.declaration_id,
  94. a.apply_status,
  95. a.approve_status,
  96. a.create_time,
  97. a.create_by,
  98. s.service_super_type as service_super_type,
  99. s.id as service_type,
  100. s.service_type_name as service_type_name,
  101. d.project_source as project_source,
  102. c.company_name as company_name
  103. FROM
  104. project_filling a
  105. LEFT JOIN y_company c on c.id = a.company_id
  106. LEFT JOIN project_filling_declaration d on d.id = a.declaration_id
  107. LEFT JOIN project_service_type s on s.id = d.project_service_type
  108. WHERE
  109. a.del_flag = '0'
  110. and d.id = #{id}
  111. and a.apply_status != '0'
  112. order by create_time desc
  113. </select>
  114. <!-- 企业我的项目填报列表 -->
  115. <select id="findPageByIdAndApproveStatus" resultType="platform.modules.company.entity.ProjectFilling">
  116. SELECT DISTINCT
  117. a.id,
  118. a.company_id,
  119. a.apply_no,
  120. a.apply_date,
  121. a.receive_date,
  122. a.declaration_id,
  123. a.apply_status,
  124. a.approve_status,
  125. a.create_time,
  126. a.create_by,
  127. s.service_super_type as service_super_type,
  128. s.id as service_type,
  129. s.service_type_name as service_type_name,
  130. d.project_source as project_source,
  131. c.company_name as company_name
  132. FROM
  133. project_filling a
  134. LEFT JOIN y_company c on c.id = a.company_id
  135. LEFT JOIN project_filling_declaration d on d.id = a.declaration_id
  136. LEFT JOIN project_service_type s on s.id = d.project_service_type
  137. WHERE
  138. a.del_flag = '0'
  139. and d.id = #{id}
  140. <if test="approveStatus!=null and approveStatus!=''">
  141. and a.approve_status = #{approveStatus}
  142. </if>
  143. and a.apply_status != '0'
  144. order by create_time desc
  145. </select>
  146. <select id="findPage" parameterType="platform.modules.government.dto.ParamApplication"
  147. resultType="platform.modules.government.dto.ProjectFillingDto">
  148. SELECT
  149. application.id id,
  150. application.apply_no apply_no,
  151. company.company_name company_name,
  152. declaration.project_type project_type,
  153. declaration.project_service_type project_service_type,
  154. declaration.project_source project_source,
  155. application.approve_status approve_status
  156. FROM
  157. project_filling application
  158. LEFT JOIN z_approval approval ON approval.APPLY_ID = application.id
  159. AND approval.TYPE = #{project.approval_type}
  160. LEFT JOIN y_company company ON company.id = application.company_id
  161. LEFT JOIN project_filling_declaration declaration ON declaration.id = application.declaration_id
  162. LEFT JOIN project_service_type servicetype ON declaration.project_service_type = servicetype.id
  163. WHERE
  164. 1 = 1
  165. <if test="project.projectIds.size() > 0 ">
  166. AND application.id IN
  167. <foreach collection="project.projectIds" index="index" item="item" open="(" separator="," close=")">
  168. #{item}
  169. </foreach>
  170. </if>
  171. <if test="project.projectIds.size() == 0 ">
  172. AND application.id=0
  173. </if>
  174. <if test="project.project_type != null and project.project_type != '' ">
  175. AND declaration.project_type = #{project.project_type}
  176. </if>
  177. <if test="project.project_source != null and project.project_source != '' ">
  178. AND declaration.project_source = #{project.project_source}
  179. </if>
  180. <if test="project.company_name != null and project.company_name != '' ">
  181. AND company.company_name LIKE CONCAT('%',#{project.company_name},'%')
  182. </if>
  183. <if test="project.project_name != null and project.project_name != '' ">
  184. AND declaration.project_name LIKE CONCAT('%',#{project.project_name},'%')
  185. </if>
  186. <if test="project.project_service_type_name != null and project.project_service_type_name != '' ">
  187. AND servicetype.service_type_name LIKE CONCAT('%',#{project.project_service_type_name},'%')
  188. </if>
  189. GROUP BY application.id
  190. ORDER BY application.create_time DESC
  191. </select>
  192. <select id="findUnionProjectsOnHome" resultType="platform.modules.government.entity.ProjectDeclaration">
  193. SELECT
  194. a.id,a.project_name,a.create_time,a.project_source,a.apply_enddate,2 as isFilling
  195. FROM project_filling_declaration a
  196. where
  197. a.del_flag=0
  198. and a.status = 1
  199. <if test="request.type != null and request.type != ''">
  200. AND a.project_source = #{request.type}
  201. </if>
  202. order by a.create_time desc
  203. </select>
  204. <select id="findMessageByIdAndType" resultType="platform.modules.government.dto.ProjectMessageDto">
  205. SELECT
  206. c.company_name,d.create_time,d.is_read
  207. FROM
  208. c_message m
  209. LEFT JOIN c_message_detail d ON m.id = d.message_id
  210. LEFT JOIN y_company c on d.push_id=c.id
  211. WHERE
  212. m.apply_id = #{id}
  213. and m.business_type = #{type}
  214. </select>
  215. <select id="findByDeclarationId" resultType="platform.modules.company.entity.ProjectFilling">
  216. select * from project_filling WHERE declaration_id = #{id}
  217. </select>
  218. <select id="findByProjectIdAndApproveStatus" resultType="platform.modules.company.entity.ProjectFilling">
  219. select * from project_filling
  220. where del_flag = 0
  221. <if test="null != approveStatus and approveStatus.size >0">
  222. AND approve_status IN
  223. <foreach collection="approveStatus" index="index" item="item" open="(" separator="," close=")">
  224. #{item}
  225. </foreach>
  226. </if>
  227. </select>
  228. <select id="findAll" resultType="platform.modules.company.entity.ProjectFilling">
  229. SELECT
  230. p.*
  231. FROM
  232. project_filling p
  233. left join project_filling_declaration d on p.declaration_id = d.id
  234. inner join project_service_type t on d.project_service_type = t.id and t.del_flag = 0
  235. WHERE p.apply_status != 0
  236. <if test="searchCondition.begin_date != null and searchCondition.begin_date != ''">
  237. AND p.apply_date <![CDATA[>=]]> #{searchCondition.begin_date}
  238. </if>
  239. <if test="searchCondition.end_date != null and searchCondition.end_date != ''">
  240. AND p.apply_date <![CDATA[<=]]> #{searchCondition.end_date}
  241. </if>
  242. <if test="searchCondition.projectType != null and searchCondition.projectType != ''">
  243. AND d.project_service_type = #{searchCondition.projectType}
  244. </if>
  245. </select>
  246. <select id="findListByCondition" resultType="platform.modules.company.entity.ProjectFilling">
  247. SELECT
  248. *
  249. FROM
  250. project_filling
  251. WHERE
  252. 1=1
  253. <if test="condition.begin_date != null and condition.begin_date !='' ">
  254. <![CDATA[ and DATE_FORMAT(create_time, '%Y-%m-%d')>= DATE_FORMAT(#{condition.begin_date}, '%Y-%m-%d') ]]>
  255. </if>
  256. <if test="condition.end_date != null and condition.end_date !='' ">
  257. <![CDATA[ and DATE_FORMAT(create_time, '%Y-%m-%d')<= DATE_FORMAT(#{condition.end_date}, '%Y-%m-%d') ]]>
  258. </if>
  259. </select>
  260. </mapper>