166 lines
9.3 KiB
XML
166 lines
9.3 KiB
XML
<?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.yanzhu.manage.mapper.ProPlanScheduleMapper">
|
|
|
|
<resultMap type="ProPlanSchedule" id="ProPlanScheduleResult">
|
|
<result property="id" column="id" />
|
|
<result property="maxId" column="max_id" />
|
|
<result property="comId" column="com_id" />
|
|
<result property="comName" column="com_name" />
|
|
<result property="projectId" column="project_id" />
|
|
<result property="projectName" column="project_name" />
|
|
<result property="planId" column="plan_id" />
|
|
<result property="taskId" column="task_id" />
|
|
<result property="taskUniqueId" column="task_unique_id" />
|
|
<result property="taskName" column="task_name" />
|
|
<result property="bimId" column="bim_id" />
|
|
<result property="schedulePercent" column="schedule_percent" />
|
|
<result property="taskDuation" column="task_duation" />
|
|
<result property="planStartDate" column="plan_start_date" />
|
|
<result property="planFinishDate" column="plan_finish_date" />
|
|
<result property="finishDate" column="finish_date" />
|
|
<result property="description" column="description" />
|
|
<result property="images" column="images" />
|
|
<result property="isDel" column="is_del" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createUserId" column="create_user_id" />
|
|
<result property="createDate" column="create_date" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateDate" column="update_date" />
|
|
<result property="totalSchedule" column="total_schedule" />
|
|
</resultMap>
|
|
|
|
<sql id="selectProPlanScheduleVo">
|
|
select pps.id, (select max(mp.id) from pro_plan_schedule mp where mp.project_id = pps.project_id and mp.is_del=0) as max_id, pps.com_id, sd.dept_name as com_name, pps.project_id, pi.project_name, pps.plan_id, pps.task_id, pps.task_unique_id, pps.task_name, pps.bim_id, pps.schedule_percent, pp.task_duation, pp.plan_start_date, pp.plan_finish_date, pps.finish_date, pps.description, pps.images, pps.is_del, pps.create_by, pps.create_user_id, pps.create_date, pps.update_by, pps.update_date, pps.total_schedule
|
|
from pro_plan_schedule pps
|
|
left join pro_project_info pi on pi.id = pps.project_id
|
|
left join sys_dept sd on sd.dept_id = pps.com_id
|
|
left join pro_plan pp on pp.id = pps.plan_id
|
|
</sql>
|
|
|
|
<select id="selectProPlanScheduleList" parameterType="ProPlanSchedule" resultMap="ProPlanScheduleResult">
|
|
<include refid="selectProPlanScheduleVo"/>
|
|
<where>
|
|
<if test="comId != null "> and pps.com_id = #{comId}</if>
|
|
<if test="projectId != null "> and pps.project_id = #{projectId}</if>
|
|
<if test="activeComId != null "> and pps.com_id = #{activeComId}</if>
|
|
<if test="activeProjectId != null "> and pps.project_id = #{activeProjectId}</if>
|
|
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
|
|
<if test="planId != null "> and pps.plan_id = #{planId}</if>
|
|
<if test="taskId != null "> and pps.task_id = #{taskId}</if>
|
|
<if test="taskUniqueId != null and taskUniqueId != ''"> and pps.task_unique_id = #{taskUniqueId}</if>
|
|
<if test="taskName != null and taskName != ''"> and pps.task_name like concat('%', #{taskName}, '%')</if>
|
|
<if test="bimId != null and bimId != ''"> and pps.bim_id = #{bimId}</if>
|
|
<if test="isDel != null "> and pps.is_del = #{isDel}</if>
|
|
<if test="createUserId != null "> and pps.create_user_id = #{createUserId}</if>
|
|
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and date(pps.create_date) between #{params.beginTime} and #{params.endTime}</if>
|
|
and pps.is_del != 2
|
|
</where>
|
|
<if test="id != null "> order by pps.id</if>
|
|
<if test="id == null "> order by pps.id desc</if>
|
|
</select>
|
|
|
|
<select id="selectProPlanScheduleById" parameterType="Long" resultMap="ProPlanScheduleResult">
|
|
<include refid="selectProPlanScheduleVo"/>
|
|
where pps.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertProPlanSchedule" parameterType="ProPlanSchedule" useGeneratedKeys="true" keyProperty="id">
|
|
insert into pro_plan_schedule
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="comId != null">com_id,</if>
|
|
<if test="projectId != null">project_id,</if>
|
|
<if test="planId != null">plan_id,</if>
|
|
<if test="taskId != null">task_id,</if>
|
|
<if test="taskUniqueId != null">task_unique_id,</if>
|
|
<if test="taskName != null">task_name,</if>
|
|
<if test="bimId != null">bim_id,</if>
|
|
<if test="schedulePercent != null">schedule_percent,</if>
|
|
<if test="finishDate != null">finish_date,</if>
|
|
<if test="description != null">description,</if>
|
|
<if test="images != null">images,</if>
|
|
<if test="isDel != null">is_del,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createUserId != null">create_user_id,</if>
|
|
<if test="createDate != null">create_date,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateDate != null">update_date,</if>
|
|
<if test="totalSchedule != null">total_schedule,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="comId != null">#{comId},</if>
|
|
<if test="projectId != null">#{projectId},</if>
|
|
<if test="planId != null">#{planId},</if>
|
|
<if test="taskId != null">#{taskId},</if>
|
|
<if test="taskUniqueId != null">#{taskUniqueId},</if>
|
|
<if test="taskName != null">#{taskName},</if>
|
|
<if test="bimId != null">#{bimId},</if>
|
|
<if test="schedulePercent != null">#{schedulePercent},</if>
|
|
<if test="finishDate != null">#{finishDate},</if>
|
|
<if test="description != null">#{description},</if>
|
|
<if test="images != null">#{images},</if>
|
|
<if test="isDel != null">#{isDel},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createUserId != null">#{createUserId},</if>
|
|
<if test="createDate != null">#{createDate},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateDate != null">#{updateDate},</if>
|
|
<if test="totalSchedule != null">#{totalSchedule},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateProPlanSchedule" parameterType="ProPlanSchedule">
|
|
update pro_plan_schedule
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="comId != null">com_id = #{comId},</if>
|
|
<if test="projectId != null">project_id = #{projectId},</if>
|
|
<if test="planId != null">plan_id = #{planId},</if>
|
|
<if test="taskId != null">task_id = #{taskId},</if>
|
|
<if test="taskUniqueId != null">task_unique_id = #{taskUniqueId},</if>
|
|
<if test="taskName != null">task_name = #{taskName},</if>
|
|
<if test="bimId != null">bim_id = #{bimId},</if>
|
|
<if test="schedulePercent != null">schedule_percent = #{schedulePercent},</if>
|
|
<if test="finishDate != null">finish_date = #{finishDate},</if>
|
|
<if test="description != null">description = #{description},</if>
|
|
<if test="images != null">images = #{images},</if>
|
|
<if test="isDel != null">is_del = #{isDel},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createUserId != null">create_user_id = #{createUserId},</if>
|
|
<if test="createDate != null">create_date = #{createDate},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateDate != null">update_date = #{updateDate},</if>
|
|
<if test="totalSchedule != null">total_schedule = #{totalSchedule},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteProPlanScheduleById" parameterType="Long">
|
|
update pro_plan_schedule set is_del = 2 where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteProPlanScheduleByIds" parameterType="String">
|
|
update pro_plan_schedule set is_del = 2 where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<select id="findPreviousScheduleByPlanId" parameterType="Long" resultMap="ProPlanScheduleResult">
|
|
<include refid="selectProPlanScheduleVo"/>
|
|
where pps.plan_id = #{taskId} and pps.is_del = 0 order by pps.id desc limit 1
|
|
</select>
|
|
|
|
<update id="updateProPlanTotalSchedule">
|
|
update pro_plan_schedule as a
|
|
join (
|
|
select max(id) as max_id
|
|
from pro_plan_schedule
|
|
where project_id = #{proId}
|
|
and is_del = '0'
|
|
) as b on a.id = b.max_id
|
|
set a.total_schedule = #{totalSchedule}
|
|
</update>
|
|
|
|
</mapper> |