sealMaterialDao.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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.sealMaterial.dao.SealMaterialDao">
  4. <select id="selectCountAboutSealMaterial" resultType="integer">
  5. select count(1)
  6. from seal_material_info
  7. where seal_material_name = #{sealMaterialName}
  8. and amount = #{amount}
  9. and project_id = #{projectId}
  10. </select>
  11. <!--物理删除-->
  12. <delete id="delete">
  13. delete from seal_material_info
  14. WHERE id = #{id}
  15. </delete>
  16. <!-- 批量保存-->
  17. <insert id="batchInsert">
  18. insert into seal_material_info
  19. (id,
  20. create_by,
  21. create_date,
  22. update_by,
  23. update_date,
  24. remarks,
  25. del_flag,
  26. sort,
  27. seal_material_name,
  28. amount,
  29. main_contents,
  30. agent,
  31. seal_contents_remarks,
  32. project_id)
  33. values
  34. <foreach collection="sealMaterialInfoImportList" item="data" separator=",">
  35. (#{data.id},
  36. #{data.createBy.id},
  37. #{data.createDate},
  38. #{data.updateBy.id},
  39. #{data.updateDate},
  40. #{data.remarks},
  41. #{data.delFlag},
  42. #{data.sort},
  43. #{data.sealMaterialName},
  44. #{data.amount},
  45. #{data.mainContents},
  46. #{data.agent.id},
  47. #{data.sealMaterialImportRemarks},
  48. #{data.projectId})
  49. </foreach>
  50. </insert>
  51. <!--批量更新时间-->
  52. <update id="batchUpdateTime">
  53. update seal_material_info set
  54. use_seal_time = NOW()
  55. where project_id =#{projectId}
  56. </update>
  57. <select id="getSealMaterialByProjectId" resultType="com.jeeplus.modules.sealMaterial.entity.SealMaterialInfo">
  58. select
  59. r.project_name as "projectName",
  60. r.project_id as "reportId",
  61. s.seal_material_name as "sealMaterialName",
  62. s.amount as "amount",
  63. s.main_contents as "mainContents",
  64. r.area_name as "area",
  65. r.reviewer_person as "reviewPerson",
  66. (select s.name from rural_project_records r,sys_user s where r.create_by = s.id and r.id = #{projectId}) as "porjectCreatePerson",
  67. u.name as "projectMasterId",
  68. r.start_date as "startDate",
  69. r.ending_date as "endingDate",
  70. use_seal_time as "useSealTime",
  71. seal_contents_remarks as "sealMaterialImportRemarks",
  72. su.name as "agent.name",
  73. s.agent as "agent.id",
  74. s.id as "id"
  75. from seal_material_info s
  76. left join rural_project_records r on s.project_id = r.id
  77. left join sys_user u on r.project_master_id = u.id
  78. left join sys_user su on s.agent = su.id
  79. where s.project_id =#{projectId}
  80. order by s.sort asc
  81. </select>
  82. <select id="findExportList" resultType="com.jeeplus.modules.sealMaterial.entity.SealMaterialInfoExport">
  83. select
  84. s.seal_material_name as "sealMaterialName",
  85. s.amount as "amount",
  86. s.main_contents as "mainContents",
  87. u.name as "agentName",
  88. DATE_FORMAT(s.use_seal_time,'%Y-%m-%d') as "useSealTime",
  89. s.seal_contents_remarks as "sealMaterialImportRemarks",
  90. rpr.project_name as projectName,
  91. prd.number as projectReportNum
  92. from seal_material_info s
  93. left join sys_user u on s.agent = u.id
  94. left join rural_project_records rpr on rpr.id = s.project_id
  95. left join project_report_data prd on rpr.id = prd.project_id
  96. where s.project_id = #{projectId}
  97. order by s.sort asc
  98. </select>
  99. <select id="findExportAll" resultType="com.jeeplus.modules.sealMaterial.entity.SealMaterialInfoExport">
  100. select
  101. s.seal_material_name as "sealMaterialName",
  102. s.amount as "amount",
  103. s.main_contents as "mainContents",
  104. u.name as "agentName",
  105. DATE_FORMAT(s.use_seal_time,'%Y-%m-%d') as "useSealTime",
  106. s.seal_contents_remarks as "sealMaterialImportRemarks",
  107. rpr.project_name as projectName,
  108. prd.number as projectReportNum
  109. from seal_material_info s
  110. left join sys_user u on s.agent = u.id
  111. left join rural_project_records rpr on rpr.id = s.project_id
  112. left join project_report_data prd on rpr.id = prd.project_id
  113. <where>
  114. s.project_id in (select project_id from seal_apply_for_info where id in
  115. <foreach collection="idList" item="id" separator="," open="(" close=")">
  116. #{id}
  117. </foreach>
  118. )
  119. </where>
  120. order by prd.number desc,s.sort asc
  121. </select>
  122. <update id="updateById">
  123. update seal_material_info
  124. <if test="sealMaterialName!=null and sealMaterialName!=''">
  125. set seal_material_name = #{sealMaterialName}
  126. </if>
  127. <if test="amount!=null and amount!=''">
  128. ,amount = #{amount}
  129. </if>
  130. <if test="mainContents!=null and mainContents!=''">
  131. ,main_contents = #{mainContents}
  132. </if>
  133. <if test="sealMaterialImportRemarks!=null and sealMaterialImportRemarks!=''">
  134. ,seal_contents_remarks = #{sealMaterialImportRemarks}
  135. </if>
  136. where id =#{id}
  137. </update>
  138. <update id="deleteByProjectId">
  139. delete from seal_material_info where project_id = #{projectId}
  140. </update>
  141. </mapper>