2025-04-20 13:31:47 +08:00
<?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" />
2025-04-27 01:52:21 +08:00
<result property= "maxId" column= "max_id" />
2025-04-20 13:31:47 +08:00
<result property= "comId" column= "com_id" />
2025-04-27 01:52:21 +08:00
<result property= "comName" column= "com_name" />
2025-04-20 13:31:47 +08:00
<result property= "projectId" column= "project_id" />
2025-04-27 01:52:21 +08:00
<result property= "projectName" column= "project_name" />
2025-04-20 13:31:47 +08:00
<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" />
2025-04-27 01:52:21 +08:00
<result property= "taskDuation" column= "task_duation" />
<result property= "planStartDate" column= "plan_start_date" />
<result property= "planFinishDate" column= "plan_finish_date" />
2025-04-20 13:31:47 +08:00
<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" />
2025-05-07 00:37:49 +08:00
<result property= "totalSchedule" column= "total_schedule" />
2025-04-20 13:31:47 +08:00
</resultMap>
<sql id= "selectProPlanScheduleVo" >
2025-05-07 00:37:49 +08:00
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
2025-04-27 01:52:21 +08:00
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
2025-04-20 13:31:47 +08:00
</sql>
<select id= "selectProPlanScheduleList" parameterType= "ProPlanSchedule" resultMap= "ProPlanScheduleResult" >
<include refid= "selectProPlanScheduleVo" />
<where >
2025-04-27 01:52:21 +08:00
<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>
2025-05-07 00:37:49 +08:00
<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>
2025-04-27 01:52:21 +08:00
and pps.is_del != 2
2025-04-20 13:31:47 +08:00
</where>
2025-05-07 00:37:49 +08:00
<if test= "id != null " > order by pps.id</if>
<if test= "id == null " > order by pps.id desc</if>
2025-04-20 13:31:47 +08:00
</select>
<select id= "selectProPlanScheduleById" parameterType= "Long" resultMap= "ProPlanScheduleResult" >
<include refid= "selectProPlanScheduleVo" />
2025-04-27 01:52:21 +08:00
where pps.id = #{id}
2025-04-20 13:31:47 +08:00
</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>
2025-05-07 00:37:49 +08:00
<if test= "totalSchedule != null" > total_schedule,</if>
2025-04-20 13:31:47 +08:00
</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>
2025-05-07 00:37:49 +08:00
<if test= "totalSchedule != null" > #{totalSchedule},</if>
2025-04-20 13:31:47 +08:00
</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>
2025-05-07 00:37:49 +08:00
<if test= "totalSchedule != null" > total_schedule = #{totalSchedule},</if>
2025-04-20 13:31:47 +08:00
</trim>
where id = #{id}
</update>
2025-04-27 01:52:21 +08:00
<update id= "deleteProPlanScheduleById" parameterType= "Long" >
update pro_plan_schedule set is_del = 2 where id = #{id}
</update>
2025-04-20 13:31:47 +08:00
2025-04-27 01:52:21 +08:00
<update id= "deleteProPlanScheduleByIds" parameterType= "String" >
update pro_plan_schedule set is_del = 2 where id in
2025-04-20 13:31:47 +08:00
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
2025-04-27 01:52:21 +08:00
</update>
2025-04-28 00:40:37 +08:00
<select id= "findPreviousScheduleByPlanId" parameterType= "Long" resultMap= "ProPlanScheduleResult" >
2025-04-27 01:52:21 +08:00
<include refid= "selectProPlanScheduleVo" />
where pps.plan_id = #{taskId} and pps.is_del = 0 order by pps.id desc limit 1
</select>
2025-05-07 00:37:49 +08:00
<update id= "updateProPlanTotalSchedule" >
update pro_plan_schedule as a
join (
select max(id) as max_id
from pro_plan_schedule
2025-05-07 22:18:18 +08:00
where project_id = #{proId}
2025-05-07 00:37:49 +08:00
and is_del = '0'
) as b on a.id = b.max_id
2025-05-07 22:18:18 +08:00
set a.total_schedule = #{totalSchedule}
2025-05-07 00:37:49 +08:00
</update>
2025-04-20 13:31:47 +08:00
</mapper>