Przeglądaj źródła

培训/演练:增加字段最后一次下发时间,最后一次撤回时间,计划生效日期 以及对应逻辑

jingyuanchao 1 rok temu
rodzic
commit
bf5a7401e1

+ 37 - 2
project_data/sql/0.0.5/soc/soc.sql

@@ -3,12 +3,12 @@ DELIMITER ??
 DROP PROCEDURE
 	IF
         NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_safety_task' AND COLUMN_NAME = 'solid_id' ) THEN
-        ALTER TABLE  `core_safety_task` 
+        ALTER TABLE  `core_safety_task`
 			ADD COLUMN `solid_id` bigint NULL COMMENT '固定的id,用于识别多个副本是否属于同一个计划' AFTER `plan_id`;
     END IF;
 	IF
        NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_safecheck_plan' AND COLUMN_NAME = 'publish_time' ) THEN
-        	ALTER TABLE `core_safecheck_plan` 
+        	ALTER TABLE `core_safecheck_plan`
 				MODIFY COLUMN `parent_id` bigint NULL DEFAULT -1 COMMENT '下发父计划id' AFTER `id`,
 				ADD COLUMN `solid_id` bigint NULL COMMENT '固定的id,用于识别多个副本是否属于同一个计划' AFTER `parent_id`,
 				ADD COLUMN `parent_solid_id` bigint NULL COMMENT '固定的parentid,用于识别多个副本是否属于同一个计划' AFTER `solid_id`;
@@ -20,6 +20,41 @@ DROP PROCEDURE
 				update core_safecheck_plan set withdraw_time =update_time WHERE withdraw_time is null and plan_status=2;
 				update core_safecheck_plan set effective_time =update_time WHERE effective_time is null and plan_status=1;
     END IF;
+
+
+            -- 预案演练表增加字段:最后一次下发时间/最后一次撤回时间/计划生效日期
+            IF NOT EXISTS(SELECT *
+                              FROM information_schema.columns
+                              WHERE table_schema = DATABASE()
+                                AND table_name = 'core_drill_plan'
+                                AND column_name = 'publish_time') THEN
+                    ALTER TABLE core_drill_plan
+                        ADD COLUMN `publish_time` datetime NULL COMMENT '最后一次下发时间' AFTER `parent_id`,
+                        ADD COLUMN `withdraw_time` datetime NULL COMMENT '最后一次撤回时间' AFTER `publish_time`,
+                        ADD COLUMN `effective_time` datetime NULL COMMENT '计划生效日期' AFTER `withdraw_time`;
+                    update core_drill_plan set publish_time =update_time WHERE publish_time is null and plan_status=1;
+                    update core_drill_plan set withdraw_time =update_time WHERE withdraw_time is null and plan_status=2;
+                    update core_drill_plan set effective_time =update_time WHERE effective_time is null and plan_status=1;
+            END IF;
+
+                -- 预案演练表增加字段:最后一次下发时间/最后一次撤回时间/计划生效日期
+            IF NOT EXISTS(SELECT *
+                              FROM information_schema.columns
+                              WHERE table_schema = DATABASE()
+                                AND table_name = 'core_edu_training_plan'
+                                AND column_name = 'publish_time') THEN
+                    ALTER TABLE core_edu_training_plan
+                        ADD COLUMN `publish_time` datetime NULL COMMENT '最后一次下发时间' AFTER `parent_id`,
+                        ADD COLUMN `withdraw_time` datetime NULL COMMENT '最后一次撤回时间' AFTER `publish_time`,
+                        ADD COLUMN `effective_time` datetime NULL COMMENT '计划生效日期' AFTER `withdraw_time`;
+                    update core_edu_training_plan set publish_time =update_time WHERE publish_time is null and plan_status=1;
+                    update core_edu_training_plan set withdraw_time =update_time WHERE withdraw_time is null and plan_status=2;
+                    update core_edu_training_plan set effective_time =update_time WHERE effective_time is null and plan_status=1;
+            END IF;
+
+
+
+
 END ??
 DELIMITER;
 CALL schema_change ();

+ 15 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/drill/domain/CoreDrillPlan.java

@@ -106,6 +106,21 @@ public class CoreDrillPlan extends BaseEntity {
     @ApiModelProperty(value = "下发计划id")
     private Long parentId;
 
+    @TableField(value = "publish_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "最后一次下发时间")
+    private Date publishTime;
+
+    @TableField(value = "withdraw_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "最后一次撤回时间")
+    private Date withdrawTime;
+
+    @TableField(value = "effective_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "计划生效日期")
+    private Date effectiveTime;
+
     @TableField(value = "file_list")
     @ApiModelProperty(value = "文件")
     private String fileList;

+ 14 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/drill/vo/CoreDrillPlanDataVo.java

@@ -1,5 +1,6 @@
 package com.xunmei.common.core.domain.drill.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.xunmei.common.core.domain.drill.domain.CoreDrillPlanToExecOrg;
@@ -76,6 +77,19 @@ public class CoreDrillPlanDataVo {
     @ApiModelProperty(value = "下发计划id")
     private Long parentId;
 
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "最后一次下发时间")
+    private Date publishTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "最后一次撤回时间")
+    private Date withdrawTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "计划生效日期")
+    private Date effectiveTime;
+
     @ApiModelProperty(value = "计划执行角色")
     private List<CoreDrillPlanToRole> planRoleList;
 

+ 16 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/edu/domain/CoreEduTrainingPlan.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.xunmei.common.core.web.domain.BaseEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -107,6 +108,21 @@ public class CoreEduTrainingPlan extends BaseEntity {
     @TableField("parent_id")
     private Long parentId;
 
+    @TableField(value = "publish_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "最后一次下发时间")
+    private Date publishTime;
+
+    @TableField(value = "withdraw_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "最后一次撤回时间")
+    private Date withdrawTime;
+
+    @TableField(value = "effective_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "计划生效日期")
+    private Date effectiveTime;
+
     @ApiModelProperty(value = "附件")
     @TableField("file_list")
     private String fileList;

+ 14 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/edu/vo/CoreEduTrainingPlanDataVo.java

@@ -1,5 +1,7 @@
 package com.xunmei.common.core.domain.edu.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.xunmei.common.core.domain.edu.domain.CoreEduTrainingPlanToExecOrg;
 import io.swagger.annotations.ApiModelProperty;
@@ -54,6 +56,18 @@ public class CoreEduTrainingPlanDataVo {
     @ApiModelProperty(value = "计划所属机构")
     private Long belongOrgId;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "最后一次下发时间")
+    private Date publishTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "最后一次撤回时间")
+    private Date withdrawTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "计划生效日期")
+    private Date effectiveTime;
+
     @ApiModelProperty(value = "计划所属机构名称")
     private String belongOrgName;
 

+ 25 - 5
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/drill/service/impl/CoreDrillPlanServiceImpl.java

@@ -2,6 +2,7 @@ package com.xunmei.core.drill.service.impl;
 
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.collection.ListUtil;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson2.JSON;
@@ -25,6 +26,7 @@ import com.xunmei.common.core.domain.drill.vo.CoreDrillPlanDataVo;
 import com.xunmei.common.core.domain.drill.vo.CoreDrillPlanDetailVo;
 import com.xunmei.common.core.domain.drill.vo.CoreDrillPlanPageVo;
 import com.xunmei.common.core.domain.drill.vo.CoreDrillPlanRoleVo;
+import com.xunmei.common.core.domain.edu.domain.CoreEduTrainingPlan;
 import com.xunmei.common.core.enums.OrgTypeEnum;
 import com.xunmei.common.core.enums.drill.DrillDoStatus;
 import com.xunmei.common.core.enums.drill.DrillPlanCycleEnum;
@@ -334,11 +336,14 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
                     .set(CoreDrillPlan::getUpdateTime, new Date())
                     .set(CoreDrillPlan::getUpdateBy, String.valueOf(SecurityUtils.getLoginUser().getSysUser().getId()))
             );
+            final Date today = new Date();
             for (Long pId : list) {
                 CompletableFuture.runAsync(() -> {
                     //如果不是省联社或者办事处,状态启用,并且是无周期或者立即生效
                     CoreDrillPlanDataVo detailPlanData = getCoreDrillPlanDataVo(pId);
-                    coreDrillTaskService.createTaskForNow(detailPlanData, plan.getPlanStartDate(), plan.getPlanEndDate());
+                    if (DateUtil.isSameDay(detailPlanData.getEffectiveTime(), today) || detailPlanData.getEffectiveTime().before(today)) {
+                        coreDrillTaskService.createTaskForNow(detailPlanData, plan.getPlanStartDate(), plan.getPlanEndDate());
+                    }
                 }, threadPoolTaskExecutor);
             }
 
@@ -397,7 +402,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
             delAllByParentPlanId(plan);
             List<CoreDrillPlan> planList = null;
             if (plan.getIssue() == 1) {
-                planList = buildPlanData(plan, null, false);
+                planList = buildPlanData(plan, null, false, 0);
             } else {
                 planList = ListUtil.list(true, plan);
             }
@@ -674,7 +679,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
                 .eq(CoreDrillPlan::getParentId, planId)
                 .select(CoreDrillPlan::getId).list();
         if (planList.isEmpty()) {
-            planList = buildPlanData(plan, new ArrayList<>(), true);
+            planList = buildPlanData(plan, new ArrayList<>(), true, status);
         } else {
             planList.forEach(plan1 -> plan1.setPlanStatus(EduTrainingPlanStatus.USING.getCode()));
             List<Long> collect = planList.stream().map(CoreDrillPlan::getId).collect(Collectors.toList());
@@ -683,6 +688,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
         //下发后修改为使用中
         plan.setPlanStatus(DrillPlanStatus.USING.getCode());
         plan.setIssue(1);
+        this.updatePlanTime(plan, status);
         this.updateById(plan);
         if (ObjectUtil.equal(status, 1)) {
             //status=1:立即生效  status=0:下周期生效
@@ -709,6 +715,18 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
 
     }
 
+    private void updatePlanTime(CoreDrillPlan plan, int status) {
+        plan.setPublishTime(new Date());
+        if (ObjectUtil.equal(status, 1)) {
+            //status=1:立即生效  status=0:下周期生效
+            plan.setBuildTaskNow(1);
+            plan.setEffectiveTime(new Date());
+        } else {
+            plan.setBuildTaskNow(0);
+            plan.setEffectiveTime(DateUtil.offsetDay(plan.getPlanEndDate(), 1));
+        }
+    }
+
     private Boolean anotherCheckOrgType(Integer orgType) {
         if (ObjectUtil.isEmpty(orgType)) {
             throw new RuntimeException("当前用户所在机构类型无法确认!");
@@ -738,11 +756,12 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
             update(new LambdaUpdateWrapper<CoreDrillPlan>()
                     .eq(CoreDrillPlan::getId, planId)
                     .set(CoreDrillPlan::getIssue, 0)
+                    .set(CoreDrillPlan::getWithdrawTime, new Date())
                     .set(CoreDrillPlan::getPlanStatus, DrillPlanStatus.DRAFT.getCode()));
             return 1;
         } else {
             //计划下有已完成:不删任务,计划状态回到停用。
-            coreDrillPlanMapper.updatePlanStatusByIdOrParentId(planId, EduTrainingPlanStatus.DELETED.getCode());
+            coreDrillPlanMapper.updatePlanStatusByIdOrParentId(planId, DrillPlanStatus.DELETED.getCode());
             CoreDrillPlan plan = getById(planId);
             plan.setIssue(0);
             return coreDrillPlanMapper.updateById(plan);
@@ -792,7 +811,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
         );
     }
 
-    private List<CoreDrillPlan> buildPlanData(CoreDrillPlan plan, List<CoreDrillPlanToRole> planRoleList, boolean isPublish) {
+    private List<CoreDrillPlan> buildPlanData(CoreDrillPlan plan, List<CoreDrillPlanToRole> planRoleList, boolean isPublish, int status) {
         /*if (ObjectUtil.isEmpty(planRoleList)) {
             //获取执行角色
             LambdaQueryWrapper<CoreDrillPlanToRole> ros = new LambdaQueryWrapper<>();
@@ -840,6 +859,7 @@ public class CoreDrillPlanServiceImpl extends ServiceImpl<CoreDrillPlanMapper, C
             drillPlan.setParentId(plan.getId());
             drillPlan.setCreateTime(new Date());
             drillPlan.setUpdateTime(new Date());
+            this.updatePlanTime(plan, status);
             list.add(drillPlan);
 
             if (ObjectUtil.isNotEmpty(planExecOrgList)) {

+ 23 - 5
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/service/impl/CoreEduTrainingPlanServiceImpl.java

@@ -341,11 +341,15 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
                     .set(CoreEduTrainingPlan::getUpdateTime, new Date())
                     .set(CoreEduTrainingPlan::getUpdateBy, String.valueOf(SecurityUtils.getLoginUser().getSysUser().getId()))
             );
+            final Date today = new Date();
             for (Long pId : list) {
                 CompletableFuture.runAsync(() -> {
                     //如果不是省联社或者办事处,状态启用,并且是无周期或者立即生效
                     CoreEduTrainingPlanDataVo detailPlanData = getCoreEduTrainingPlanDataVo(pId);
-                    coreEduTrainingTaskService.createTaskForNow(detailPlanData, plan.getStartDate(), plan.getEndDate());
+                    //如果计划生效日期和今天是同一天或者在今天之前,那就可以创建任务
+                    if (DateUtil.isSameDay(detailPlanData.getEffectiveTime(), today) || detailPlanData.getEffectiveTime().before(today)) {
+                        coreEduTrainingTaskService.createTaskForNow(detailPlanData, plan.getStartDate(), plan.getEndDate());
+                    }
                 }, threadPoolTaskExecutor);
             }
 
@@ -454,7 +458,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 
             List<CoreEduTrainingPlan> planList = null;
             if (plan.getIssue() == 1) {
-                planList = buildPlanData(plan, null, false);
+                planList = buildPlanData(plan, null, false,0);
             } else {
                 planList = ListUtil.list(true, plan);
             }
@@ -683,7 +687,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
                 .eq(CoreEduTrainingPlan::getParentId, planId)
                 .select(CoreEduTrainingPlan::getId).list();
         if (planList.isEmpty()) {
-            planList = buildPlanData(plan, new ArrayList<>(), true);
+            planList = buildPlanData(plan, new ArrayList<>(), true,status);
         } else {
             planList.forEach(plan1 -> plan1.setPlanStatus(EduTrainingPlanStatus.USING.getCode()));
             List<Long> collect = planList.stream().map(CoreEduTrainingPlan::getId).collect(Collectors.toList());
@@ -692,6 +696,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
         //下发后修改为使用中
         plan.setPlanStatus(EduTrainingPlanStatus.USING.getCode());
         plan.setIssue(1);
+       this.updatePlanTime(plan,status);
         this.updateById(plan);
         if (ObjectUtil.equal(status, 1)) {
             //status=1:立即生效  status=0:下周期生效
@@ -718,6 +723,18 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
 
     }
 
+    private void updatePlanTime(CoreEduTrainingPlan plan, int status) {
+        plan.setPublishTime(new Date());
+        if (ObjectUtil.equal(status, 1)) {
+            //status=1:立即生效  status=0:下周期生效
+            plan.setBuildTaskNow(1);
+            plan.setEffectiveTime(new Date());
+        } else {
+            plan.setBuildTaskNow(0);
+            plan.setEffectiveTime(DateUtil.offsetDay(plan.getEndDate(), 1));
+        }
+    }
+
     public List<SysOrgVO> getPlanPublishOrgList(List<SysOrgVO> list) {
         //省联社/办事处/行社
         List<SysOrgVO> collect = list.stream().filter(org -> checkOrgType(org.getType())).collect(Collectors.toList());
@@ -734,7 +751,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
         return collect;
     }
 
-    private List<CoreEduTrainingPlan> buildPlanData(CoreEduTrainingPlan plan, List<CoreEduTrainingPlanToRole> planRoleList, Boolean isPublish) {
+    private List<CoreEduTrainingPlan> buildPlanData(CoreEduTrainingPlan plan, List<CoreEduTrainingPlanToRole> planRoleList, Boolean isPublish,int  status) {
         /*if (ObjectUtil.isEmpty(planRoleList)) {
             //获取执行角色
             LambdaQueryWrapper<CoreEduTrainingPlanToRole> ros = new LambdaQueryWrapper<>();
@@ -780,6 +797,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
             coreEduTrainingPlan.setParentId(plan.getId());
             coreEduTrainingPlan.setCreateTime(new Date());
             coreEduTrainingPlan.setUpdateTime(new Date());
+            this.updatePlanTime(coreEduTrainingPlan,status);
             list.add(coreEduTrainingPlan);
 
             if (ObjectUtil.isNotEmpty(planExecOrgList)) {
@@ -818,7 +836,6 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Integer revocationPlan(Long planId) {
-
         List<Long> list = coreEduTrainingPlanMapper.selectIdByParentId(planId);
         Integer isExecute = coreEduTrainingTaskMapper.selectCount(new LambdaQueryWrapper<CoreEduTrainingTask>()
                         .in(CoreEduTrainingTask::getPlanId, list)
@@ -834,6 +851,7 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
             update(new LambdaUpdateWrapper<CoreEduTrainingPlan>()
                     .eq(CoreEduTrainingPlan::getId, planId)
                     .set(CoreEduTrainingPlan::getIssue, 0)
+                    .set(CoreEduTrainingPlan::getWithdrawTime, new Date())
                     .set(CoreEduTrainingPlan::getPlanStatus, EduTrainingPlanStatus.DRAFT.getCode()));
             return 1;
         } else {

+ 12 - 2
soc-modules/soc-modules-core/src/main/resources/mapper/drill/CoreDrillPlanMapper.xml

@@ -597,6 +597,9 @@
         <result property="issue" column="issue"/>
         <result property="remark" column="remark"/>
         <result property="parentId" column="parent_id"/>
+        <result property="publishTime" column="publish_time"/>
+        <result property="withdrawTime" column="withdraw_time"/>
+        <result property="effectiveTime" column="effective_time"/>
         <result property="file" column="file_list"/>
         <collection property="planRoleList" ofType="com.xunmei.common.core.domain.edu.domain.CoreEduTrainingPlanToRole"
                     select="com.xunmei.core.drill.mapper.CoreDrillPlanToRoleMapper.selectListByPlanId" column="id">
@@ -655,9 +658,16 @@
 
     <update id="updatePlanStatusByIdOrParentId">
         update core_drill_plan
-        set plan_status = #{planStatus}
+        <set>
+            <if test="status != null">
+                plan_status = #{status},
+            </if>
+            <if test="status ==2">
+                withdraw_time=now(),
+            </if>
+        </set>
         where id = #{planId}
-           or parent_id = #{planId}
+        or parent_id = #{planId}
     </update>
 
     <update id="updatePlanStatusByIdList">

+ 13 - 2
soc-modules/soc-modules-core/src/main/resources/mapper/edu/CoreEduTrainingPlanMapper.xml

@@ -49,6 +49,9 @@
         <result property="standard" column="standard"/>
         <result property="issue" column="issue"/>
         <result property="parentId" column="parent_id"/>
+        <result property="publishTime" column="publish_time"/>
+        <result property="withdrawTime" column="withdraw_time"/>
+        <result property="effectiveTime" column="effective_time"/>
         <result property="file" column="file_list"/>
         <!--<collection property="planRoleList" ofType="com.xunmei.common.core.domain.edu.domain.CoreEduTrainingPlanToRole"
                     select="com.xunmei.core.edu.mapper.CoreEduTrainingPlanToRoleMapper.selectListByPlanId" column="id">
@@ -597,9 +600,17 @@
 
     <update id="updatePlanStatusByIdOrParentId">
         update core_edu_training_plan
-        set plan_status = #{status}
+        <set>
+            <if test="status != null">
+                plan_status = #{status},
+            </if>
+            <if test="status ==2">
+                withdraw_time=now(),
+            </if>
+        </set>
+
         where id = #{planId}
-           or parent_id = #{planId}
+        or parent_id = #{planId}
     </update>
 
     <update id="updatePlanStatusByIdList">