ProjectReportChangeDao.xml 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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.jeeplus.modules.projectcontentinfo.dao.ProjectReportChangeDao">
  4. <sql id="projectReportDataColumns">
  5. a.id AS "id",
  6. a.create_by AS "createBy.id",
  7. a.create_date AS "createDate",
  8. a.update_by AS "updateBy.id",
  9. a.update_date AS "updateDate",
  10. a.remarks AS "remarks",
  11. a.del_flag AS "delFlag",
  12. a.company_id AS "companyId",
  13. a.office_id AS "officeId",
  14. a.project_id AS "project.id",
  15. a.name AS "name",
  16. a.number AS "number",
  17. a.type AS "type",
  18. a.achievement_type AS "achievementType",
  19. a.review_standard AS "reviewStandard",
  20. a.sign_cost_one AS "signCostOne.id",
  21. a.sign_cost_two AS "signCostTwo.id",
  22. a.master AS "master.id",
  23. a.report_date AS "reportDate",
  24. a.file_status AS "fileStatus",
  25. a.status AS "status",
  26. a.process_instance_id AS "processInstanceId",
  27. m.name AS "master.name",
  28. a.report_id AS "reportId",
  29. a.before_count AS "beforeCount",
  30. a.before_id AS "beforeEntity.id",
  31. a.report_type AS "reportType",
  32. a.number_path as "numberPath",
  33. a.review_fee AS "reviewFee",
  34. a.approval_fee AS "approvalFee",
  35. a.contract_fee AS "contractFee",
  36. a.verify_fee AS "verifyFee",
  37. a.verify_rate AS "verifyRate",
  38. a.consult_fee AS "consultFee",
  39. a.building_fee AS "buildingFee",
  40. a.install_fee AS "installFee"
  41. </sql>
  42. <sql id="projectReportDataJoins">
  43. LEFT JOIN sys_user m ON m.id = a.master
  44. </sql>
  45. <select id="get" resultType="ProjectReportData" >
  46. SELECT
  47. <include refid="projectReportDataColumns"/>
  48. FROM project_report_change a
  49. <include refid="projectReportDataJoins"/>
  50. WHERE a.id = #{id}
  51. </select>
  52. <select id="findByBefore" resultType="ProjectReportData" >
  53. SELECT
  54. <include refid="projectReportDataColumns"/>
  55. FROM project_report_change a
  56. <include refid="projectReportDataJoins"/>
  57. WHERE a.report_id = #{reportId} AND a.status = '5'
  58. ORDER BY before_count DESC
  59. limit 1
  60. </select>
  61. <select id="getNumber" resultType="ProjectReportData" >
  62. SELECT
  63. a.id AS "id",
  64. a.number AS "number"
  65. FROM project_report_change a
  66. WHERE
  67. a.del_flag = #{DEL_FLAG_NORMAL}
  68. AND a.project_id = #{project.id}
  69. ORDER BY a.number DESC
  70. limit 1
  71. </select>
  72. <select id="findList" resultType="ProjectReportData" >
  73. SELECT
  74. <include refid="projectReportDataColumns"/>
  75. FROM project_report_change a
  76. <include refid="projectReportDataJoins"/>
  77. <where>
  78. a.del_flag = #{DEL_FLAG_NORMAL} AND a.report_id is NOT NULL
  79. <if test="project != null and project.id != null and project.id != ''">
  80. AND a.project_id = #{project.id}
  81. </if>
  82. <if test="type != null and type != ''">
  83. AND a.type = #{type}
  84. </if>
  85. <if test="name != null and name != ''">
  86. AND a.name like
  87. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  88. <if test="dbName == 'mysql'">CONCAT('%', #{name}, '%')</if>
  89. </if>
  90. <if test="number != null and number != ''">
  91. AND a.number = #{number}
  92. </if>
  93. <if test="status != null and status != ''">
  94. AND a.status = #{status}
  95. </if>
  96. <if test="master!=null and master.id != null and master.id != ''">
  97. AND a.master = #{master.id}
  98. </if>
  99. <if test="startDate != null and startDate != ''">
  100. AND a.report_date &gt;= #{startDate}
  101. </if>
  102. <if test="endDate != null and endDate != ''">
  103. AND a.report_date &lt;= #{endDate}
  104. </if>
  105. </where>
  106. <choose>
  107. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  108. ORDER BY ${page.orderBy}
  109. </when>
  110. <otherwise>
  111. ORDER BY a.update_date DESC
  112. </otherwise>
  113. </choose>
  114. </select>
  115. <select id="findAllList" resultType="ProjectReportData" >
  116. SELECT
  117. <include refid="projectReportDataColumns"/>
  118. FROM project_report_change a
  119. <include refid="projectReportDataJoins"/>
  120. <where>
  121. a.del_flag = #{DEL_FLAG_NORMAL}
  122. </where>
  123. <choose>
  124. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  125. ORDER BY ${page.orderBy}
  126. </when>
  127. <otherwise>
  128. ORDER BY a.update_date DESC
  129. </otherwise>
  130. </choose>
  131. </select>
  132. <insert id="insert">
  133. INSERT INTO project_report_change(
  134. id,
  135. create_by,
  136. create_date,
  137. update_by,
  138. update_date,
  139. remarks,
  140. del_flag,
  141. company_id,
  142. office_id,
  143. project_id,
  144. name,
  145. number,
  146. type,
  147. achievement_type,
  148. review_standard,
  149. sign_cost_one,
  150. sign_cost_two,
  151. master,
  152. report_date,
  153. file_status,
  154. status,
  155. report_id,
  156. before_count,
  157. before_id,
  158. report_type,
  159. number_path,
  160. review_fee,
  161. approval_fee,
  162. contract_fee,
  163. verify_fee,
  164. verify_rate,
  165. consult_fee,
  166. building_fee,
  167. install_fee
  168. ) VALUES (
  169. #{id},
  170. #{createBy.id},
  171. #{createDate},
  172. #{updateBy.id},
  173. #{updateDate},
  174. #{remarks},
  175. #{delFlag},
  176. #{companyId},
  177. #{officeId},
  178. #{project.id},
  179. #{name},
  180. #{number},
  181. #{type},
  182. #{achievementType},
  183. #{reviewStandard},
  184. #{signCostOne.id},
  185. #{signCostTwo.id},
  186. #{master.id},
  187. #{reportDate},
  188. #{fileStatus},
  189. #{status},
  190. #{reportId},
  191. #{beforeCount},
  192. #{beforeEntity.id},
  193. #{reportType},
  194. #{numberPath},
  195. #{reviewFee},
  196. #{approvalFee},
  197. #{contractFee},
  198. #{verifyFee},
  199. #{verifyRate},
  200. #{consultFee},
  201. #{buildingFee},
  202. #{installFee}
  203. )
  204. </insert>
  205. <update id="update">
  206. UPDATE project_report_change SET
  207. update_by = #{updateBy.id},
  208. update_date = #{updateDate},
  209. remarks = #{remarks},
  210. project_id = #{project.id},
  211. name = #{name},
  212. number = #{number},
  213. type = #{type},
  214. achievement_type = #{achievementType},
  215. review_standard = #{reviewStandard},
  216. sign_cost_one = #{signCostOne.id},
  217. sign_cost_two = #{signCostTwo.id},
  218. master = #{master.id},
  219. report_date = #{reportDate},
  220. status = #{status},
  221. report_id = #{reportId},
  222. report_type = #{reportType},
  223. number_path = #{numberPath},
  224. review_fee = #{reviewFee},
  225. approval_fee = #{approvalFee},
  226. contract_fee = #{contractFee},
  227. verify_fee = #{verifyFee},
  228. verify_rate = #{verifyRate},
  229. consult_fee = #{consultFee},
  230. building_fee = #{buildingFee},
  231. install_fee = #{installFee}
  232. WHERE id = #{id}
  233. </update>
  234. <update id="saveInvalid">
  235. UPDATE project_report_change SET
  236. update_by = #{updateBy.id},
  237. update_date = #{updateDate},
  238. remarks = #{remarks},
  239. <if test="invalidStatus != null and invalidStatus != ''">
  240. invalid_status = #{invalidStatus},
  241. </if>
  242. status = #{status}
  243. WHERE id = #{id}
  244. </update>
  245. <update id="changeProjectReportData">
  246. UPDATE project_report_data
  247. SET update_by = #{updateBy.id},
  248. update_date = #{updateDate},
  249. remarks = #{remarks},
  250. company_id = #{companyId},
  251. office_id = #{officeId},
  252. project_id = #{project.id},
  253. name = #{name},
  254. number = #{number},
  255. type = #{type},
  256. achievement_type = #{achievementType},
  257. review_standard = #{reviewStandard},
  258. sign_cost_one = #{signCostOne.id},
  259. sign_cost_two = #{signCostTwo.id},
  260. master = #{master.id},
  261. report_date = #{reportDate},
  262. status = #{status}
  263. WHERE id = #{id}
  264. </update>
  265. <update id="changeBerforProjectReportData">
  266. UPDATE project_report_data
  267. SET update_by = #{updateBy.id},
  268. update_date = #{updateDate},
  269. remarks = #{remarks},
  270. company_id = #{companyId},
  271. office_id = #{officeId},
  272. project_id = #{project.id},
  273. name = #{name},
  274. number = #{number},
  275. type = #{type},
  276. achievement_type = #{achievementType},
  277. review_standard = #{reviewStandard},
  278. sign_cost_one = #{signCostOne.id},
  279. sign_cost_two = #{signCostTwo.id},
  280. master = #{master.id},
  281. report_date = #{reportDate},
  282. status = #{status},
  283. file_status = #{fileStatus}
  284. WHERE id = #{id}
  285. </update>
  286. <!--物理删除-->
  287. <update id="delete">
  288. DELETE FROM project_report_change
  289. WHERE id = #{id}
  290. </update>
  291. <update id="deleteTree">
  292. DELETE FROM project_content_change
  293. WHERE project_id = #{project.id} and info_id = #{id}
  294. </update>
  295. <!--逻辑删除-->
  296. <update id="deleteByLogic">
  297. UPDATE project_report_change SET
  298. del_flag = #{DEL_FLAG_DELETE}
  299. WHERE id = #{id}
  300. </update>
  301. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  302. <select id="findUniqueByProperty" resultType="ProjectReportData" statementType="STATEMENT">
  303. select * FROM project_report_change where ${propertyName} = '${value}'
  304. </select>
  305. <update id="updateProcessInstanceId">
  306. UPDATE project_report_change SET
  307. process_instance_id = #{processInstanceId}
  308. WHERE id = #{id}
  309. </update>
  310. <update id="deleteReportDataInfo">
  311. DELETE FROM project_report_content WHERE report_id = #{reportId} AND type = '2'
  312. </update>
  313. <update id="deleteReportDataBased">
  314. DELETE FROM project_report_content WHERE report_id = #{reportId} AND type = '4'
  315. </update>
  316. <update id="deleteContentChange">
  317. DELETE FROM project_content_change WHERE info_id = #{infoId}
  318. </update>
  319. <update id="reportNumber">
  320. UPDATE project_report_change SET
  321. number = #{number}
  322. WHERE id = #{reportId}
  323. </update>
  324. <!-- 获取流程ID -->
  325. <select id="getByProcessInstanceId" resultType="ProjectReportData" >
  326. SELECT
  327. <include refid="projectReportDataColumns"/>
  328. FROM project_report_change a
  329. <include refid="projectReportDataJoins"/>
  330. WHERE a.process_instance_id = #{processInstanceId}
  331. </select>
  332. </mapper>