ProjectMattersDao.xml 9.9 KB

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