PlanQuarterMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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.PlanQuarterMapper">
  6. <resultMap type="com.ozs.plan.doman.PlanQuarter" id="PlanQuarterResult">
  7. <id property="plan_practical_id" column="planPracticalId"/>
  8. <result property="plan_year_id" column="planYearId"/>
  9. <result property="purchase_dept_id" column="purchaseDeptId"/>
  10. <result property="project_name" column="projectName"/>
  11. <result property="project_type" column="projectType"/>
  12. <result property="demand_overview" column="demandOverview"/>
  13. <result property="evaluation" column="evaluation"/>
  14. <result property="is_excess" column="isExcess"/>
  15. <result property="purchase_services" column="purchaseServices"/>
  16. <result property="purchase_mode" column="purchaseMode"/>
  17. <result property="plan_demand_sub_time" column="planDemandSubTime"/>
  18. <result property="plan_purchase_finish_time" column="planPurchaseFinishTime"/>
  19. <result property="plan_deliver_time" column="planDeliverTime"/>
  20. <result property="project_attr" column="projectAttr"/>
  21. <result property="adjust_reason" column="adjustReason"/>
  22. <result property="delay_reason" column="delayReason"/>
  23. <result property="remarks" column="remarks"/>
  24. <result property="project_status" column="projectStatus"/>
  25. <result property="send_letter" column="sendLetter"/>
  26. <result property="letter_str" column="letterStr"/>
  27. <result property="created" column="created"/>
  28. <result property="create_time" column="createTime"/>
  29. <result property="updated" column="updated"/>
  30. <result property="update_time" column="updateTime"/>
  31. <result property="refuse_reason" column="refuseReason"/>
  32. <result property="del_flay" column="delFlay"/>
  33. <result property="plan_type" column="planType"/>
  34. </resultMap>
  35. <update id="updateInfoById" parameterType="com.ozs.plan.doman.PlanQuarter">
  36. update plan_practical
  37. set project_name=#{projectName},
  38. project_type=#{projectType},
  39. demand_overview=#{demandOverview},
  40. evaluation=#{evaluation},
  41. is_excess=#{isExcess},
  42. purchase_services=#{purchaseServices},
  43. purchase_mode=#{purchaseMode},
  44. plan_demand_sub_time=#{planDemandSubTime},
  45. plan_purchase_finish_time=#{planPurchaseFinishTime},
  46. plan_deliver_time=#{planDeliverTime},
  47. project_attr=#{projectAttr},
  48. adjust_reason=#{adjustReason},
  49. remarks=#{remarks},
  50. updated=#{updated},
  51. update_time=#{updateTime}
  52. where plan_practical_id = #{planPracticalId}
  53. </update>
  54. <select id="selectPlanQuarterList" parameterType="com.ozs.plan.doman.PlanQuarter" resultMap="PlanQuarterResult">
  55. select * from plan_practical
  56. <where>
  57. <if test="projectName != null and projectName != ''">
  58. AND project_name like concat('%', #{projectName}, '%')
  59. </if>
  60. <if test="purchaseServices != null and purchaseServices != ''">
  61. AND purchase_services = #{purchaseServices}
  62. </if>
  63. <if test="isExcess != null and isExcess != ''">
  64. AND is_excess = #{isExcess}
  65. </if>
  66. <if test="projectStatus != null and projectStatus != ''">
  67. AND project_status = #{projectStatus}
  68. </if>
  69. <if test="beginTime != null "><!-- 开始时间检索 -->
  70. and date_format(plan_demand_sub_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
  71. </if>
  72. <if test="endTime != null "><!-- 结束时间检索 -->
  73. and date_format(plan_demand_sub_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
  74. </if>
  75. and plan_type=0
  76. and del_flay=0
  77. </where>
  78. order by plan_demand_sub_time desc
  79. </select>
  80. <select id="selectPlanQuarterExamineList" parameterType="com.ozs.plan.doman.PlanQuarter"
  81. resultMap="PlanQuarterResult">
  82. select * from plan_practical
  83. <where>
  84. <if test="projectName != null and projectName != ''">
  85. AND project_name like concat('%', #{projectName}, '%')
  86. </if>
  87. <if test="purchaseServices != null and purchaseServices != ''">
  88. AND purchase_services = #{purchaseServices}
  89. </if>
  90. <if test="isExcess != null and isExcess != ''">
  91. AND is_excess = #{isExcess}
  92. </if>
  93. <if test="projectStatus == null or projectStatus ==''">
  94. AND project_status in (1,3)
  95. </if>
  96. <if test="projectStatus != null and projectStatus != ''">
  97. AND project_status = #{projectStatus}
  98. </if>
  99. <if test="beginTime != null "><!-- 开始时间检索 -->
  100. and date_format(plan_demand_sub_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
  101. </if>
  102. <if test="endTime != null "><!-- 结束时间检索 -->
  103. and date_format(plan_demand_sub_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
  104. </if>
  105. and plan_type=0
  106. and del_flay=0
  107. </where>
  108. order by plan_demand_sub_time desc
  109. </select>
  110. <select id="countProjectName" resultType="java.lang.Integer" parameterType="java.lang.String">
  111. select count(plan_practical.plan_practical_id)
  112. from plan_practical
  113. where project_name = #{projectName}
  114. and plan_type = 0
  115. and del_flay = 0
  116. </select>
  117. <select id="getById" resultType="com.ozs.plan.doman.PlanQuarter" parameterType="java.lang.Long">
  118. select *
  119. from plan_practical
  120. where plan_practical_id = #{planPracticalId}
  121. and del_flay = 0
  122. </select>
  123. <select id="getByPlanYearId" resultType="com.ozs.plan.doman.PlanQuarter" parameterType="java.lang.Long">
  124. select *
  125. from plan_practical
  126. where plan_year_id = #{planYearId}
  127. and del_flay = 0
  128. </select>
  129. <select id="countProjectNameOther" resultType="java.lang.Integer" parameterType="java.lang.String">
  130. select count(plan_practical.plan_practical_id)
  131. from plan_practical
  132. where project_name = #{projectName}
  133. and plan_practical_id != #{planPracticalId}
  134. and plan_type = 0
  135. and del_flay = 0
  136. </select>
  137. <select id="query" resultType="com.ozs.plan.doman.PlanQuarter"
  138. parameterType="com.ozs.plan.doman.vo.requestVo.PlanQuarterStandardVo">
  139. select p.* from
  140. plan_practical p left join pm_audit_dept_ref r
  141. on p.plan_practical_id = r.ref_id and r.ref_type = 1 and plan_type = 0
  142. <where>
  143. ( #{created} = 1 or r.dept_id = #{purchaseDeptId} )
  144. AND r.`status`=0 and plan_type = 0
  145. <if test="projectName != null and projectName != ''">
  146. AND p.project_name like concat('%', #{projectName}, '%')
  147. </if>
  148. <if test="purchaseServices != null and purchaseServices != ''">
  149. AND p.purchase_services = #{purchaseServices}
  150. </if>
  151. <if test="isExcess != null and isExcess != ''">
  152. AND p.is_excess = #{isExcess}
  153. </if>
  154. <if test="projectStatus == null or projectStatus ==''">
  155. AND p.project_status in (1,3)
  156. </if>
  157. <if test="projectStatus != null and projectStatus != ''">
  158. AND p.project_status = #{projectStatus}
  159. </if>
  160. <if test="beginTime != null "><!-- 开始时间检索 -->
  161. and date_format(p.plan_demand_sub_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
  162. </if>
  163. <if test="endTime != null "><!-- 结束时间检索 -->
  164. and date_format(p.plan_demand_sub_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
  165. </if>
  166. and p.del_flay=0
  167. </where>
  168. order by create_time desc
  169. </select>
  170. <!-- 创建计划信息-->
  171. <insert id="insertPlanQuarter" parameterType="com.ozs.plan.doman.PlanQuarter" useGeneratedKeys="true"
  172. keyProperty="planPracticalId">
  173. insert into plan_practical (purchase_dept_id, plan_year_id, project_name, project_type, demand_overview,
  174. evaluation,
  175. is_excess,
  176. purchase_services, purchase_mode, plan_demand_sub_time, plan_purchase_finish_time,
  177. plan_deliver_time, project_attr, adjust_reason, remarks, project_status,
  178. created, create_time, del_flay, plan_type, send_letter)
  179. values (#{purchaseDeptId}, #{planYearId}, #{projectName}, #{projectType}, #{demandOverview}, #{evaluation},
  180. #{isExcess},
  181. #{purchaseServices}, #{purchaseMode}, #{planDemandSubTime}, #{planPurchaseFinishTime},
  182. #{planDeliverTime},
  183. #{projectAttr}, #{adjustReason}, #{remarks}, #{projectStatus}, #{created}, #{createTime}, 0, 0, 0)
  184. </insert>
  185. <!-- 计划删除-->
  186. <update id="deletePlanQuarterByIds" parameterType="java.lang.Long">
  187. update plan_practical set del_flay=1 where plan_practical_id in
  188. <foreach collection="array" item="item" open="(" separator="," close=")">
  189. #{item}
  190. </foreach>
  191. </update>
  192. <update id="deletePlanQuarterById" parameterType="java.lang.Long">
  193. update plan_practical
  194. set del_flay=1
  195. where plan_practical_id = #{planPracticalId}
  196. </update>
  197. <!-- 计划提交-->
  198. <update id="commit" parameterType="java.lang.Long">
  199. update plan_practical
  200. set project_status=1
  201. where plan_practical_id = #{planPracticalId}
  202. </update>
  203. <!-- 计划审核-->
  204. <update id="review" parameterType="com.ozs.plan.doman.vo.requestVo.PlanQuarterStandardVo">
  205. update plan_practical
  206. <set>
  207. <if test="refuseReason != null and refuseReason != ''">
  208. refuse_reason=#{refuseReason},
  209. </if>
  210. <if test="projectStatus != null and projectStatus != ''">
  211. project_status=#{projectStatus},
  212. </if>
  213. <if test="adjustReason != null and adjustReason != ''">
  214. adjust_reason=#{adjustReason}
  215. </if>
  216. </set>
  217. where plan_practical_id = #{planPracticalId}
  218. </update>
  219. <update id="sendLetter" parameterType="java.lang.Long">
  220. update plan_practical
  221. set send_letter=1,
  222. <if test="letterStr != null and letterStr != ''">
  223. letter_str=#{letterStr}
  224. </if>
  225. where plan_practical_id = #{planPracticalId}
  226. </update>
  227. </mapper>