123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ozs.plan.mapper.PlanQuarterMapper">
- <resultMap type="com.ozs.plan.doman.PlanQuarter" id="PlanQuarterResult">
- <id property="plan_practical_id" column="planPracticalId"/>
- <result property="plan_year_id" column="planYearId"/>
- <result property="purchase_dept_id" column="purchaseDeptId"/>
- <result property="project_name" column="projectName"/>
- <result property="project_type" column="projectType"/>
- <result property="demand_overview" column="demandOverview"/>
- <result property="evaluation" column="evaluation"/>
- <result property="is_excess" column="isExcess"/>
- <result property="purchase_services" column="purchaseServices"/>
- <result property="purchase_mode" column="purchaseMode"/>
- <result property="plan_demand_sub_time" column="planDemandSubTime"/>
- <result property="plan_purchase_finish_time" column="planPurchaseFinishTime"/>
- <result property="plan_deliver_time" column="planDeliverTime"/>
- <result property="project_attr" column="projectAttr"/>
- <result property="adjust_reason" column="adjustReason"/>
- <result property="delay_reason" column="delayReason"/>
- <result property="remarks" column="remarks"/>
- <result property="project_status" column="projectStatus"/>
- <result property="send_letter" column="sendLetter"/>
- <result property="letter_str" column="letterStr"/>
- <result property="created" column="created"/>
- <result property="create_time" column="createTime"/>
- <result property="updated" column="updated"/>
- <result property="update_time" column="updateTime"/>
- <result property="refuse_reason" column="refuseReason"/>
- <result property="del_flay" column="delFlay"/>
- <result property="plan_type" column="planType"/>
- </resultMap>
- <update id="updateInfoById" parameterType="com.ozs.plan.doman.PlanQuarter">
- update plan_practical
- set project_name=#{projectName},
- project_type=#{projectType},
- demand_overview=#{demandOverview},
- evaluation=#{evaluation},
- is_excess=#{isExcess},
- purchase_services=#{purchaseServices},
- purchase_mode=#{purchaseMode},
- plan_demand_sub_time=#{planDemandSubTime},
- plan_purchase_finish_time=#{planPurchaseFinishTime},
- plan_deliver_time=#{planDeliverTime},
- project_attr=#{projectAttr},
- adjust_reason=#{adjustReason},
- remarks=#{remarks},
- updated=#{updated},
- update_time=#{updateTime}
- where plan_practical_id = #{planPracticalId}
- </update>
- <select id="selectPlanQuarterList" parameterType="com.ozs.plan.doman.PlanQuarter" resultMap="PlanQuarterResult">
- select * from plan_practical
- <where>
- <if test="projectName != null and projectName != ''">
- AND project_name like concat('%', #{projectName}, '%')
- </if>
- <if test="purchaseServices != null and purchaseServices != ''">
- AND purchase_services = #{purchaseServices}
- </if>
- <if test="isExcess != null and isExcess != ''">
- AND is_excess = #{isExcess}
- </if>
- <if test="projectStatus != null and projectStatus != ''">
- AND project_status = #{projectStatus}
- </if>
- <if test="beginTime != null "><!-- 开始时间检索 -->
- and date_format(plan_demand_sub_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
- </if>
- <if test="endTime != null "><!-- 结束时间检索 -->
- and date_format(plan_demand_sub_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
- </if>
- and plan_type=0
- and del_flay=0
- </where>
- order by plan_demand_sub_time desc
- </select>
- <select id="selectPlanQuarterExamineList" parameterType="com.ozs.plan.doman.PlanQuarter"
- resultMap="PlanQuarterResult">
- select * from plan_practical
- <where>
- <if test="projectName != null and projectName != ''">
- AND project_name like concat('%', #{projectName}, '%')
- </if>
- <if test="purchaseServices != null and purchaseServices != ''">
- AND purchase_services = #{purchaseServices}
- </if>
- <if test="isExcess != null and isExcess != ''">
- AND is_excess = #{isExcess}
- </if>
- <if test="projectStatus == null or projectStatus ==''">
- AND project_status in (1,3)
- </if>
- <if test="projectStatus != null and projectStatus != ''">
- AND project_status = #{projectStatus}
- </if>
- <if test="beginTime != null "><!-- 开始时间检索 -->
- and date_format(plan_demand_sub_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
- </if>
- <if test="endTime != null "><!-- 结束时间检索 -->
- and date_format(plan_demand_sub_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
- </if>
- and plan_type=0
- and del_flay=0
- </where>
- order by plan_demand_sub_time desc
- </select>
- <select id="countProjectName" resultType="java.lang.Integer" parameterType="java.lang.String">
- select count(plan_practical.plan_practical_id)
- from plan_practical
- where project_name = #{projectName}
- and plan_type = 0
- and del_flay = 0
- </select>
- <select id="getById" resultType="com.ozs.plan.doman.PlanQuarter" parameterType="java.lang.Long">
- select *
- from plan_practical
- where plan_practical_id = #{planPracticalId}
- and del_flay = 0
- </select>
- <select id="getByPlanYearId" resultType="com.ozs.plan.doman.PlanQuarter" parameterType="java.lang.Long">
- select *
- from plan_practical
- where plan_year_id = #{planYearId}
- and del_flay = 0
- </select>
- <select id="countProjectNameOther" resultType="java.lang.Integer" parameterType="java.lang.String">
- select count(plan_practical.plan_practical_id)
- from plan_practical
- where project_name = #{projectName}
- and plan_practical_id != #{planPracticalId}
- and plan_type = 0
- and del_flay = 0
- </select>
- <select id="query" resultType="com.ozs.plan.doman.PlanQuarter"
- parameterType="com.ozs.plan.doman.vo.requestVo.PlanQuarterStandardVo">
- select p.* from
- plan_practical p left join pm_audit_dept_ref r
- on p.plan_practical_id = r.ref_id and r.ref_type = 1 and plan_type = 0
- <where>
- ( #{created} = 1 or r.dept_id = #{purchaseDeptId} )
- AND r.`status`=0 and plan_type = 0
- <if test="projectName != null and projectName != ''">
- AND p.project_name like concat('%', #{projectName}, '%')
- </if>
- <if test="purchaseServices != null and purchaseServices != ''">
- AND p.purchase_services = #{purchaseServices}
- </if>
- <if test="isExcess != null and isExcess != ''">
- AND p.is_excess = #{isExcess}
- </if>
- <if test="projectStatus == null or projectStatus ==''">
- AND p.project_status in (1,3)
- </if>
- <if test="projectStatus != null and projectStatus != ''">
- AND p.project_status = #{projectStatus}
- </if>
- <if test="beginTime != null "><!-- 开始时间检索 -->
- and date_format(p.plan_demand_sub_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
- </if>
- <if test="endTime != null "><!-- 结束时间检索 -->
- and date_format(p.plan_demand_sub_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
- </if>
- and p.del_flay=0
- </where>
- order by create_time desc
- </select>
- <!-- 创建计划信息-->
- <insert id="insertPlanQuarter" parameterType="com.ozs.plan.doman.PlanQuarter" useGeneratedKeys="true"
- keyProperty="planPracticalId">
- insert into plan_practical (purchase_dept_id, plan_year_id, project_name, project_type, demand_overview,
- evaluation,
- is_excess,
- purchase_services, purchase_mode, plan_demand_sub_time, plan_purchase_finish_time,
- plan_deliver_time, project_attr, adjust_reason, remarks, project_status,
- created, create_time, del_flay, plan_type, send_letter)
- values (#{purchaseDeptId}, #{planYearId}, #{projectName}, #{projectType}, #{demandOverview}, #{evaluation},
- #{isExcess},
- #{purchaseServices}, #{purchaseMode}, #{planDemandSubTime}, #{planPurchaseFinishTime},
- #{planDeliverTime},
- #{projectAttr}, #{adjustReason}, #{remarks}, #{projectStatus}, #{created}, #{createTime}, 0, 0, 0)
- </insert>
- <!-- 计划删除-->
- <update id="deletePlanQuarterByIds" parameterType="java.lang.Long">
- update plan_practical set del_flay=1 where plan_practical_id in
- <foreach collection="array" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </update>
- <update id="deletePlanQuarterById" parameterType="java.lang.Long">
- update plan_practical
- set del_flay=1
- where plan_practical_id = #{planPracticalId}
- </update>
- <!-- 计划提交-->
- <update id="commit" parameterType="java.lang.Long">
- update plan_practical
- set project_status=1
- where plan_practical_id = #{planPracticalId}
- </update>
- <!-- 计划审核-->
- <update id="review" parameterType="com.ozs.plan.doman.vo.requestVo.PlanQuarterStandardVo">
- update plan_practical
- <set>
- <if test="refuseReason != null and refuseReason != ''">
- refuse_reason=#{refuseReason},
- </if>
- <if test="projectStatus != null and projectStatus != ''">
- project_status=#{projectStatus},
- </if>
- <if test="adjustReason != null and adjustReason != ''">
- adjust_reason=#{adjustReason}
- </if>
- </set>
- where plan_practical_id = #{planPracticalId}
- </update>
- <update id="sendLetter" parameterType="java.lang.Long">
- update plan_practical
- set send_letter=1,
- <if test="letterStr != null and letterStr != ''">
- letter_str=#{letterStr}
- </if>
- where plan_practical_id = #{planPracticalId}
- </update>
- </mapper>
|