Commit 0fb14657 by “zcwang”

Merge remote-tracking branch 'origin/feature-changeFlow-221110' into feature-changeFlow-221110

parents be6931ff f8d93fb2
package com.netease.mail.yanxuan.change.biz.service.change; package com.netease.mail.yanxuan.change.biz.service.change;
import com.netease.mail.yanxuan.change.dal.entity.ChangeConfig;
import com.netease.mail.yanxuan.change.dal.entity.ChangeExecConfig; import com.netease.mail.yanxuan.change.dal.entity.ChangeExecConfig;
import java.util.List; import java.util.List;
...@@ -19,4 +20,7 @@ public interface ChangeExecConfigService { ...@@ -19,4 +20,7 @@ public interface ChangeExecConfigService {
Boolean deleteChangeExecConfig(Long id); Boolean deleteChangeExecConfig(Long id);
Boolean deleteChangeConfig(Long changeTemplateId);
} }
...@@ -100,10 +100,18 @@ public class AdminChangeConfigServiceImpl implements AdminChangeConfigService { ...@@ -100,10 +100,18 @@ public class AdminChangeConfigServiceImpl implements AdminChangeConfigService {
} }
@Override @Override
@Transactional
public AjaxResult deleteChange(Long id) { public AjaxResult deleteChange(Long id) {
//删除 变更配置 行动方案 缓存内删除 ChangeConfig changeConfig = changeConfigService.queryChangeConfig(id);
//变更类型表数据信息伪删 if (changeConfig == null){
return null; return AjaxResult.of(ResponseCodeEnum.NO_FOUND);
}
changeConfigService.deleteChangeConfig(id);
List<ChangeType> changeTypes = typeService.queryChangeType(changeConfig.getParentChangeClassId(), changeConfig.getSonChangeClassId(), true);
typeService.deleteChangeType(changeTypes);
execConfigService.deleteChangeConfig(id);
// 缓存内删除
return AjaxResult.success();
} }
/** /**
......
...@@ -48,4 +48,10 @@ public class ChangeExecConfigServiceImpl implements ChangeExecConfigService { ...@@ -48,4 +48,10 @@ public class ChangeExecConfigServiceImpl implements ChangeExecConfigService {
mapper.deleteById(id); mapper.deleteById(id);
return true; return true;
} }
@Override
public Boolean deleteChangeConfig(Long changeTemplateId) {
mapper.deleteChangeConfig(changeTemplateId);
return true;
}
} }
...@@ -9,6 +9,8 @@ import com.netease.mail.yanxuan.change.dal.meta.model.po.ChangeTypePo; ...@@ -9,6 +9,8 @@ import com.netease.mail.yanxuan.change.dal.meta.model.po.ChangeTypePo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.util.*; import java.util.*;
/** /**
...@@ -70,8 +72,12 @@ public class ChangeTypeServiceImpl implements ChangeTypeService { ...@@ -70,8 +72,12 @@ public class ChangeTypeServiceImpl implements ChangeTypeService {
throw ExceptionFactory.createParamFail(); throw ExceptionFactory.createParamFail();
} }
for (ChangeType changeType : changeTypes){ for (ChangeType changeType : changeTypes){
changeType.setDelete(1); Example example = new Example(ChangeType.class);
mapper.updateByPrimaryKeySelective(changeType); Example.Criteria criteria = example.createCriteria();
criteria.orEqualTo("id",changeType.getId());
changeType.setDeleteType(1);
changeType.setUpdateTime(System.currentTimeMillis());
mapper.updateByExampleSelective(changeType,example);
} }
return true; return true;
} }
......
...@@ -45,7 +45,7 @@ public class ChangeType { ...@@ -45,7 +45,7 @@ public class ChangeType {
/** /**
* 是否删除 * 是否删除
*/ */
private Integer delete; private Integer deleteType;
/** /**
* 创建时间 * 创建时间
......
...@@ -33,4 +33,7 @@ public interface ChangeExecConfigMapper extends tk.mybatis.mapper.common.Mapper< ...@@ -33,4 +33,7 @@ public interface ChangeExecConfigMapper extends tk.mybatis.mapper.common.Mapper<
"from TB_YX_QC_CHANGE_EXEC_CONFIG where change_template_id = #{id} " + "from TB_YX_QC_CHANGE_EXEC_CONFIG where change_template_id = #{id} " +
"group by change_exec_department order by coreDepartment DESC LIMIT 1;") "group by change_exec_department order by coreDepartment DESC LIMIT 1;")
ChangeExecConfigPo queryChangeDepartment(@Param("id")Long id); ChangeExecConfigPo queryChangeDepartment(@Param("id")Long id);
@Delete("delete from TB_YX_QC_CHANGE_EXEC_CONFIG where change_template_id = #{changeTemplateId}")
int deleteChangeConfig(@Param("changeTemplateId")Long changeTemplateId);
} }
\ No newline at end of file
...@@ -20,19 +20,19 @@ import java.util.List; ...@@ -20,19 +20,19 @@ import java.util.List;
@Mapper @Mapper
public interface ChangeTypeMapper extends tk.mybatis.mapper.common.Mapper<ChangeType> { public interface ChangeTypeMapper extends tk.mybatis.mapper.common.Mapper<ChangeType> {
@Select("select * from TB_YX_QC_CHANGE_TYPE where type_name = #{typeName} and `delete` = 0") @Select("select * from TB_YX_QC_CHANGE_TYPE where type_name = #{typeName} and delete_type = 0")
ChangeType queryTypeName(@Param("typeName") String typeName); ChangeType queryTypeName(@Param("typeName") String typeName);
@Select("select * from TB_YX_QC_CHANGE_TYPE where id in(#{id},#{sonChangeClassId}) and `delete` = #{delete} ") @Select("select * from TB_YX_QC_CHANGE_TYPE where id in(#{id},#{sonChangeClassId}) and delete_type = #{deleteType} ")
List<ChangeType> queryTypes( List<ChangeType> queryTypes(
@Param("id") Long id, @Param("id") Long id,
@Param("sonChangeClassId")Long sonChangeClassId, @Param("sonChangeClassId")Long sonChangeClassId,
@Param("delete")Integer delete); @Param("deleteType")Integer deleteType);
@Select("select * from TB_YX_QC_CHANGE_TYPE where `delete` = 0 ") @Select("select * from TB_YX_QC_CHANGE_TYPE where delete_type = 0 ")
List<ChangeTypePo> queryArrayChangeTypes(); List<ChangeTypePo> queryArrayChangeTypes();
@Select("select * from TB_YX_QC_CHANGE_TYPE where parent_id = #{id} and `delete` = 0") @Select("select * from TB_YX_QC_CHANGE_TYPE where parent_id = #{id} and delete_type = 0")
List<ChangeType> queryParent(@Param("id") Long id); List<ChangeType> queryParent(@Param("id") Long id);
} }
\ No newline at end of file
...@@ -85,7 +85,6 @@ public class ChangeConfigController { ...@@ -85,7 +85,6 @@ public class ChangeConfigController {
@PostMapping("/delete") @PostMapping("/delete")
public AjaxResult deleteChange( public AjaxResult deleteChange(
@RequestBody Long id){ @RequestBody Long id){
return service.deleteChange(id); return service.deleteChange(id);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment