ProvisionalPlanMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ozs.plan.mapper.ProvisionalPlanMapper">
  6. <resultMap type="com.ozs.plan.doman.ProvisionalPlan" id="ProvisionalPlanResult">
  7. <id property="plan_practical_id" column="planPracticalId"/>
  8. <id property="plan_year_id" column="planYearId"/>
  9. <result property="plan_year_id" column="planYearId"/>
  10. <result property="purchase_dept_id" column="purchaseDeptId"/>
  11. <result property="project_name" column="projectName"/>
  12. <result property="project_type" column="projectType"/>
  13. <result property="demand_overview" column="demandOverview"/>
  14. <result property="evaluation" column="evaluation"/>
  15. <result property="is_excess" column="isExcess"/>
  16. <result property="purchase_services" column="purchaseServices"/>
  17. <result property="purchase_mode" column="purchaseMode"/>
  18. <result property="plan_demand_sub_time" column="planDemandSubTime"/>
  19. <result property="plan_purchase_finish_time" column="planPurchaseFinishTime"/>
  20. <result property="plan_deliver_time" column="planDeliverTime"/>
  21. <result property="project_attr" column="projectAttr"/>
  22. <result property="adjust_reason" column="adjustReason"/>
  23. <result property="remarks" column="remarks"/>
  24. <result property="project_status" column="projectStatus"/>
  25. <result property="refuse_reason" column="refuseReason"/>
  26. <result property="del_flay" column="delFlay"/>
  27. <result property="plan_type" column="planType"/>
  28. <result property="created" column="created"/>
  29. <result property="create_time" column="createTime"/>
  30. <result property="updated" column="updated"/>
  31. <result property="update_time" column="updateTime"/>
  32. </resultMap>
  33. <delete id="deleteProvisionalPlanById" parameterType="java.lang.Long">
  34. delete
  35. from plan_practical
  36. where plan_practical_id = #{planPracticalId}
  37. </delete>
  38. <update id="updateProvisionalPlanById" parameterType="com.ozs.plan.doman.vo.requestVo.ProvisionalPlanVo">
  39. update plan_practical
  40. <trim prefix="SET" suffixOverrides=",">
  41. <if test="purchaseDeptId != null and purchaseDeptId != ''">
  42. purchase_dept_id = #{purchaseDeptId},
  43. </if>
  44. <if test="projectName != null and projectName != ''">
  45. project_name = #{projectName},
  46. </if>
  47. <if test="projectType != null and projectType != ''">
  48. project_type = #{projectType},
  49. </if>
  50. <if test="demandOverview != null and demandOverview != ''">
  51. demand_overview = #{demandOverview},
  52. </if>
  53. <if test="evaluation != null and evaluation != ''">
  54. evaluation = #{evaluation},
  55. </if>
  56. <if test="isExcess != null and isExcess != '' ">
  57. is_excess = #{isExcess},
  58. </if>
  59. <if test="purchaseServices != null and purchaseServices != '' ">
  60. purchase_services = #{purchaseServices},
  61. </if>
  62. <if test="purchaseMode != null and purchaseMode != '' ">
  63. purchase_mode = #{purchaseMode},
  64. </if>
  65. <if test="planDemandSubTime != null">
  66. plan_demand_sub_time = #{planDemandSubTime},
  67. </if>
  68. <if test="planPurchaseFinishTime != null">
  69. plan_purchase_finish_time = #{planPurchaseFinishTime},
  70. </if>
  71. <if test="planDeliverTime != null">
  72. plan_deliver_time = #{planDeliverTime},
  73. </if>
  74. <if test="projectAttr != null and projectAttr != '' ">
  75. project_attr = #{projectAttr},
  76. </if>
  77. <if test="adjustReason != null and adjustReason != '' ">
  78. adjust_reason = #{adjustReason},
  79. </if>
  80. <if test="remarks != null and remarks != '' ">
  81. remarks = #{remarks},
  82. </if>
  83. <if test="projectStatus != null and projectStatus != '' ">
  84. project_status = #{projectStatus},
  85. </if>
  86. <if test="refuseReason != null and refuseReason != '' ">
  87. refuse_reason = #{refuseReason},
  88. </if>
  89. <if test="delFlay != null and delFlay != '' ">
  90. del_flay = #{delFlay},
  91. </if>
  92. <if test="planType != null and planType != '' ">
  93. plan_type = #{planType},
  94. </if>
  95. <if test="updated != null and updated != '' ">
  96. updated = #{updated},
  97. </if>
  98. <if test="updateTime != null">
  99. update_time = #{updateTime},
  100. </if>
  101. </trim>
  102. where plan_practical_id = #{planPracticalId}
  103. </update>
  104. <select id="selectProjectName" resultType="com.ozs.plan.doman.ProvisionalPlan" parameterType="java.lang.String">
  105. select *
  106. from plan_practical
  107. where project_name = #{projectName}
  108. and del_flay = 0
  109. and plan_type = "1"
  110. </select>
  111. <update id="commitProvisionalPlan" parameterType="java.lang.Long">
  112. update plan_practical
  113. set project_status = 1
  114. where plan_type = 1
  115. and plan_practical_id = #{planPracticalId}
  116. </update>
  117. <select id="seletById" resultType="com.ozs.plan.doman.ProvisionalPlan" parameterType="java.lang.Long">
  118. select *
  119. from plan_practical
  120. where plan_type = 1
  121. and plan_practical_id = #{planPracticalId}
  122. </select>
  123. <select id="selectProvisionalPlan" resultType="com.ozs.plan.doman.ProvisionalPlan"
  124. parameterType="com.ozs.plan.doman.vo.requestVo.ProvisionalPlanVo">
  125. select * from plan_practical
  126. <where>
  127. <if test="projectName != null and projectName != ''">
  128. and project_name like concat('%', #{projectName}, '%')
  129. </if>
  130. <if test="purchaseServices != null and purchaseServices != ''">
  131. and purchase_services = #{purchaseServices}
  132. </if>
  133. <if test="isExcess != null and isExcess != ''">
  134. and is_excess = #{isExcess}
  135. </if>
  136. <if test="projectStatus != null and projectStatus != ''">
  137. and project_status = #{projectStatus}
  138. </if>
  139. <if test="beginTime != null "><!-- 开始时间检索 -->
  140. and date_format(plan_demand_sub_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
  141. </if>
  142. <if test="endTime != null "><!-- 结束时间检索 -->
  143. and date_format(plan_demand_sub_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
  144. </if>
  145. and plan_type = 1
  146. </where>
  147. order by create_time desc
  148. </select>
  149. <select id="selectProvisionalPlanAudit" resultType="com.ozs.plan.doman.ProvisionalPlan"
  150. parameterType="com.ozs.plan.doman.vo.requestVo.ProvisionalPlanVo">
  151. select * from plan_practical
  152. <where>
  153. <if test="projectName != null and projectName != ''">
  154. and project_name like concat('%', #{projectName}, '%')
  155. </if>
  156. <if test="purchaseServices != null and purchaseServices != ''">
  157. and purchase_services = #{purchaseServices}
  158. </if>
  159. <if test="isExcess != null and isExcess != ''">
  160. and is_excess = #{isExcess}
  161. </if>
  162. <if test="projectStatus == null or projectStatus ==''">
  163. and project_status in (1,3)
  164. </if>
  165. <if test="projectStatus != null and projectStatus != ''">
  166. and project_status = #{projectStatus}
  167. </if>
  168. <if test="beginTime != null "><!-- 开始时间检索 -->
  169. and date_format(plan_demand_sub_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
  170. </if>
  171. <if test="endTime != null "><!-- 结束时间检索 -->
  172. and date_format(plan_demand_sub_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
  173. </if>
  174. and plan_type = 1
  175. </where>
  176. order by create_time desc
  177. </select>
  178. <!-- 计划审核-->
  179. <update id="review" parameterType="com.ozs.plan.doman.vo.requestVo.ProvisionalPlanVo">
  180. update plan_practical
  181. <trim prefix="SET" suffixOverrides=",">
  182. <if test="refuseReason != null and refuseReason != ''">
  183. refuse_reason = #{refuseReason},
  184. </if>
  185. <if test="projectStatus != null and projectStatus != ''">
  186. project_status = #{projectStatus},
  187. </if>
  188. </trim>
  189. where plan_practical_id = #{planPracticalId}
  190. </update>
  191. <select id="selectProvisionalPlanByYearId" resultType="com.ozs.plan.doman.ProvisionalPlan"
  192. parameterType="java.lang.Integer">
  193. select *
  194. from plan_practical
  195. where plan_year_id = #{planYearId}
  196. </select>
  197. <select id="query" resultType="com.ozs.plan.doman.ProvisionalPlan"
  198. parameterType="com.ozs.plan.doman.vo.requestVo.ProvisionalPlanVo">
  199. select p.* from
  200. plan_practical p left join pm_audit_dept_ref r
  201. on p.plan_practical_id = r.ref_id and r.ref_type = 1 and p.plan_type = 1
  202. <where>
  203. ( #{created} = 1 or r.dept_id = #{purchaseDeptId} )
  204. <if test="projectName != null and projectName != ''">
  205. AND p.project_name like concat('%', #{projectName}, '%')
  206. </if>
  207. <if test="purchaseServices != null and purchaseServices != ''">
  208. AND p.purchase_services = #{purchaseServices}
  209. </if>
  210. <if test="isExcess != null and isExcess != ''">
  211. AND p.is_excess = #{isExcess}
  212. </if>
  213. <if test="projectStatus == null or projectStatus ==''">
  214. AND p.project_status in (1,3)
  215. </if>
  216. <if test="projectStatus != null and projectStatus != ''">
  217. AND p.project_status = #{projectStatus}
  218. </if>
  219. <if test="params.beginTime != null "><!-- 开始时间检索 -->
  220. and date_format(p.plan_demand_sub_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
  221. </if>
  222. <if test="params.endTime != null "><!-- 结束时间检索 -->
  223. and date_format(p.plan_demand_sub_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
  224. </if>
  225. and p.del_flay=0
  226. </where>
  227. order by create_time desc
  228. </select>
  229. </mapper>