Commit efbfde61 authored by 吴俊凯's avatar 吴俊凯

Merge branch 'dev_upgrade-1225' into dev_upgrede-1225-wjk

# Conflicts: # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyPlanServiceImpl.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/ContingencyPlanService.java 代码冲突合并
parents 76ac4874 e255d280
......@@ -10,11 +10,11 @@ import java.util.Map;
*/
public enum ContingencyPlanStatusEnum {
DRAFT("草稿","1"),
AVAILABLE("可用","2"),
NOAVAILABLE("不可用", "3"),
SIMULATION_START("模拟启动", "4"),
ONGOING("进行中", "5");
DRAFT("草稿",1),
AVAILABLE("可用",2),
NOAVAILABLE("不可用", 3),
SIMULATION_START("模拟启动", 4),
ONGOING("进行中", 5);
/**
* 名称,描述
*/
......@@ -22,14 +22,14 @@ public enum ContingencyPlanStatusEnum {
/**
* 编码
*/
private String code;
private Integer code;
private ContingencyPlanStatusEnum(String name, String code){
private ContingencyPlanStatusEnum(String name, Integer code){
this.name = name;
this.code = code;
}
public static ContingencyPlanStatusEnum getEnum(String code) {
public static ContingencyPlanStatusEnum getEnum(Integer code) {
ContingencyPlanStatusEnum checkStatusEnum = null;
for(ContingencyPlanStatusEnum type: ContingencyPlanStatusEnum.values()) {
if (type.getCode().equals(code)) {
......@@ -37,21 +37,9 @@ public enum ContingencyPlanStatusEnum {
break;
}
}
return checkStatusEnum;
}
public static List<Map<String,String>> getEnumList() {
List<Map<String,String>> nameList = new ArrayList<>();
for (ContingencyPlanStatusEnum c: ContingencyPlanStatusEnum.values()) {
Map<String, String> map = new HashMap<String, String>();
map.put("name", c.getName());
map.put("code", c.getCode());
nameList.add(map);
}
return nameList;
}
public String getName() {
return name;
}
......@@ -60,11 +48,11 @@ public enum ContingencyPlanStatusEnum {
this.name = name;
}
public String getCode() {
public Integer getCode() {
return code;
}
public void setCode(String code) {
public void setCode(Integer code) {
this.code = code;
}
......
......@@ -38,7 +38,8 @@ public class PlanDetail extends BasicEntity {
/**
* 适用范围
*/
private String range;
@Column(name="plan_range")
private String planRange;
/**
* 编写部门
......@@ -95,5 +96,11 @@ public class PlanDetail extends BasicEntity {
@Column(name="is_delete")
private Boolean isDelete;
/**
* 录入时间
*/
@Column(name="input_time")
private Date inputTime;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -22,20 +22,20 @@ public class PlanDoc extends BasicEntity {
/**
* 预案ID
*/
@Column(name="plan_name")
@Column(name="plan_id")
private Long planId;
/**
* 文档ID
*/
@Column(name="plan_name")
@Column(name="doc_id")
private Long docId;
/**
* 删除状态
*/
@Column(name="plan_name")
@Column(name="is_delete")
private Boolean isDelete;
private static final long serialVersionUID = 1L;
......
......@@ -22,7 +22,7 @@ public class PlanRule extends BasicEntity {
* 规则ID
*/
@Column(name="rule_id")
private Long ruleId;
private String ruleId;
/**
* 预案ID
......
......@@ -666,7 +666,7 @@ public class ContingencyAction implements CustomerAction {
Optional<PlanDetail> optionalPlanDetail = planDetailDao.findById(planOperationRecord.getPlanId());
if(optionalPlanDetail.get()!=null){
PlanDetail planDetail = optionalPlanDetail.get();
planDetail.setStatus(Integer.parseInt(ContingencyPlanStatusEnum.AVAILABLE.getCode()));
planDetail.setStatus(ContingencyPlanStatusEnum.AVAILABLE.getCode());
planDetailDao.save(planDetail);
}
}
......
package com.yeejoin.amos.fas.business.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.service.intfc.ContingencyPlanService;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyPlanService;
import com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil2;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import com.yeejoin.amos.fas.business.vo.PlanDetailVo;
import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("/api/contingencyPlan")
@Api("预案api")
@Api(tags = "预案api")
public class ContingencyPlanController extends BaseController {
@Autowired
private ContingencyPlanService contingencyPlanService;
private IContingencyPlanService contingencyPlanService;
/**
* 创建数字预案
*/
@Permission
@ApiOperation(value = "创建数字预案", notes = "创建数字预案")
@PostMapping(value = "", produces = "application/json;charset=UTF-8")
public ResponseModel createPlan(@RequestBody PlanDetailVo planDetail) {
if (null == planDetail) {
return CommonResponseUtil2.failure("参数有误");
}
AgencyUserModel curUser = getUserInfo();
planDetail.setCreator(curUser.getUserId());
planDetail.setOrgCode(getOrgCode(getSelectedOrgInfo()));
return CommonResponseUtil2.success(contingencyPlanService.createPlan(planDetail));
}
/**
* 修改数字预案
*/
@Permission
@ApiOperation(value = "修改数字预案", notes = "修改数字预案")
@PutMapping(value = "", produces = "application/json;charset=UTF-8")
public ResponseModel editPlan(@RequestBody PlanDetailVo planDetail) {
if (null == planDetail) {
return CommonResponseUtil2.failure("参数有误");
}
AgencyUserModel curUser = getUserInfo();
planDetail.setReviser(curUser.getUserId());
planDetail.setUpdateTime(new Date());
return CommonResponseUtil2.success(contingencyPlanService.editPlan(planDetail));
}
/**
* 查看数字预案详情
*/
@Permission
@ApiOperation(value = "查看数字预案详情", notes = "查看数字预案详情")
@GetMapping(value = "/{id}", produces = "application/json;charset=UTF-8")
public ResponseModel createPlan(@PathVariable(value = "id") Long id) {
if (null == id) {
return CommonResponseUtil2.failure("参数有误");
}
return CommonResponseUtil2.success(contingencyPlanService.detail(id));
}
/**
* 数字预案分页查询
*/
@Permission
@ApiOperation(value = "数字预案分页查询", notes = "数字预案分页查询")
@GetMapping(value = "/page", produces = "application/json;charset=UTF-8")
public ResponseModel pageFilter(@RequestParam(value = "current") int current,
@RequestParam(value = "planName", required = false) String planName,
@RequestParam(value = "classifyId", required = false) Long[] classifyId,
@RequestParam(value = "planRange", required = false) String[] planRange,
@RequestParam(value = "editOrgName", required = false) String editOrgName,
@RequestParam(value = "implementationTimeLeft", required = false) Date implementationTimeLeft,
@RequestParam(value = "implementationTimeRight", required = false) Date implementationTimeRight,
@RequestParam(value = "size") int size) {
if (current < 1 || size < 1) {
throw new YeeException("分页参数有误");
}
Page page = new Page(current, size);
return CommonResponseUtil2.success(contingencyPlanService.pageFilter(page, planName, classifyId, planRange, editOrgName, implementationTimeLeft, implementationTimeRight));
}
/**
* 启用预案
*/
@Permission
@ApiOperation(value = "启用预案", notes = "启用预案")
@PutMapping(value = "/activate", produces = "application/json;charset=UTF-8")
public ResponseModel activatePlan(@RequestBody List<Long> idList) {
if (null == idList || idList.isEmpty()) {
return CommonResponseUtil2.failure("参数有误");
}
return CommonResponseUtil2.success(contingencyPlanService.activatePlan(idList));
}
/**
* 停用预案
*/
@Permission
@ApiOperation(value = "停用预案", notes = "停用预案")
@PutMapping(value = "/deactivate", produces = "application/json;charset=UTF-8")
public ResponseModel deactivatePlan(@RequestBody List<Long> idList) {
if (null == idList || idList.isEmpty()) {
return CommonResponseUtil2.failure("参数有误");
}
return CommonResponseUtil2.success(contingencyPlanService.deactivatePlan(idList));
}
/**
* 删除预案
*/
@Permission
@ApiOperation(value = "删除预案", notes = "删除预案")
@DeleteMapping(value = "/{ids}", produces = "application/json;charset=UTF-8")
public ResponseModel deletePlan(@PathVariable(value = "ids") String idStr) {
if (StringUtils.isBlank(idStr)) {
return CommonResponseUtil2.failure("参数有误");
}
String[] idArr = idStr.split(",");
List<Long> idList = new ArrayList();
for (String id : idArr) {
if (id.trim().length() > 0 && StringUtils.isNumeric(id.trim())) {
idList.add(Long.valueOf(id.trim()));
}
}
return CommonResponseUtil2.success(contingencyPlanService.delete(idList));
}
@Permission
@ApiOperation(value = "获取数字预案绑定的资源Id", notes = "查看数字预案详情")
@GetMapping(value = "/bind-source/{type}", produces = "application/json;charset=UTF-8")
public ResponseModel getPlanBindSource(@PathVariable(value = "type") String type) {
switch (type) {
case "doc":
return CommonResponseUtil2.success(contingencyPlanService.getPlanUsedDocs());
case "rule":
return CommonResponseUtil2.success(contingencyPlanService.getPlanUsedRules());
case "equipment":
return CommonResponseUtil2.success(contingencyPlanService.getPlanUsedEquipments());
default:
throw new YeeException("无效的类型参数");
}
}
@ApiOperation(value = "启动")
@RequestMapping(value = "/start", method = RequestMethod.POST)
public ResponseModel start(@RequestBody ContingencyPlanParamVo vo) {
......
package com.yeejoin.amos.fas.business.dao.mapper;
import org.springframework.stereotype.Repository;
@Repository
public interface PlanClassifyTreeMapper extends BaseMapper {
}
package com.yeejoin.amos.fas.business.dao.mapper;
import com.yeejoin.amos.fas.business.vo.PlanDetailVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* <h1><h1>
*
......@@ -10,4 +15,33 @@ import org.springframework.stereotype.Repository;
*/
@Repository
public interface PlanDetailMapper {
/**
* 更新预案状态
* @param idList id
* @param status 状态
* @return
*/
int updatePlanStatusByIdList(@Param("idList") List<Long> idList, @Param("status") Integer status);
/**
* 更新删除状态
* @param idList id
* @param isDelete 是否删除
* @return
*/
int updateIsDeleteByIdList(@Param("idList") List<Long> idList, @Param("isDelete") Boolean isDelete);
/**
* 筛选预案获得总数
* @return
*/
Integer filterCount(@Param("planName") String planName, @Param("classifyId") Long[] classifyId, @Param("planRange") String[] planRange, @Param("editOrgName") String editOrgName, @Param("implementationTimeLeft") Date implementationTimeLeft, @Param("implementationTimeRight") Date implementationTimeRight);
/**
* 筛选预案获得分页记录
* @return
*/
List<PlanDetailVo> filterList(@Param("planName") String planName, @Param("classifyId") Long[] classifyId, @Param("planRange") String[] planRange, @Param("editOrgName") String editOrgName, @Param("implementationTimeLeft") Date implementationTimeLeft, @Param("implementationTimeRight") Date implementationTimeRight, @Param("start") int start, @Param("size") int size);
}
package com.yeejoin.amos.fas.business.dao.mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* <h1><h1>
*
......@@ -10,4 +14,14 @@ import org.springframework.stereotype.Repository;
*/
@Repository
public interface PlanDocMapper {
/**
* 更新删除状态
* @param idList id
* @param isDelete 是否删除
* @return
*/
int updateIsDeleteByPlanIdList(@Param("planIdList") List<Long> idList, @Param("isDelete") Boolean isDelete);
int logicDeleteByDocIdList(@Param("docIdList") List<Long> idList);
}
package com.yeejoin.amos.fas.business.dao.mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <h1><h1>
*
......@@ -10,4 +13,14 @@ import org.springframework.stereotype.Repository;
*/
@Repository
public interface PlanEquipmentMapper {
/**
* 更新删除状态
* @param idList id
* @param isDelete 是否删除
* @return
*/
int updateIsDeleteByPlanIdList(@Param("planIdList") List<Long> idList, @Param("isDelete") Boolean isDelete);
int logicDeleteByEquipIdList(@Param("equipIdList") List<Long> idList);
}
package com.yeejoin.amos.fas.business.dao.mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <h1><h1>
*
......@@ -10,4 +13,15 @@ import org.springframework.stereotype.Repository;
*/
@Repository
public interface PlanRuleMapper {
/**
* 更新删除状态
* @param idList id
* @param isDelete 是否删除
* @return
*/
int updateIsDeleteByPlanIdList(@Param("planIdList") List<Long> idList, @Param("isDelete") Boolean isDelete);
int logicDeleteByRuleIdList(@Param("ruleIdList") List<String> idList);
}
......@@ -9,7 +9,7 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository("iEquipmentFireEquipmentDao")
@Repository
public interface IEquipmentFireEquipmentDao extends BaseDao<EquipmentFireEquipment, Long> {
/**
......
......@@ -6,7 +6,7 @@ import org.springframework.stereotype.Repository;
import java.util.List;
@Repository("IPlanClassifyTreeDao")
@Repository
public interface IPlanClassifyTreeDao extends BaseDao<PlanClassifyTree, Long> {
......
......@@ -4,6 +4,8 @@ import com.yeejoin.amos.fas.dao.entity.PlanDetail;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <h1><h1>
*
......@@ -16,4 +18,5 @@ public interface IPlanDetailDao extends BaseDao<PlanDetail, Long> {
@Query(value="SELECT count(*) from c_plan_detail where status in (?1) AND is_delete = 0 ", nativeQuery = true)
int findByStatus(Integer[] status);
List<PlanDetail> getPlanDetailsByIdInAndIsDelete(List<Long> idList, Boolean isDelete);
}
......@@ -3,6 +3,8 @@ package com.yeejoin.amos.fas.business.dao.repository;
import com.yeejoin.amos.fas.dao.entity.PlanDoc;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <h1><h1>
*
......@@ -11,4 +13,10 @@ import org.springframework.stereotype.Repository;
*/
@Repository
public interface IPlanDocDao extends BaseDao<PlanDoc, Long> {
void deleteByPlanId(Long planId);
List<PlanDoc> getPlanDocsByPlanId(Long planId);
List<PlanDoc> findAllByIsDelete(Boolean isDelete);
}
......@@ -4,6 +4,8 @@ import com.yeejoin.amos.fas.dao.entity.PlanEquipment;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <h1><h1>
*
......@@ -14,4 +16,10 @@ import org.springframework.stereotype.Repository;
public interface IPlanEquipmentDao extends BaseDao<PlanEquipment, Long> {
@Query(value="SELECT * from c_plan_equipment where fire_equipment_id = ?1 AND is_delete = 0 ", nativeQuery = true)
PlanEquipment findByFireEquipmentId(Long fireEquipmentId);
void deleteByPlanId(long planId);
List<PlanEquipment> getPlanDocsByPlanId(Long planId);
List<PlanEquipment> findAllByIsDelete(Boolean isDelete);
}
......@@ -3,6 +3,9 @@ package com.yeejoin.amos.fas.business.dao.repository;
import com.yeejoin.amos.fas.dao.entity.PlanRule;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* <h1><h1>
*
......@@ -11,4 +14,10 @@ import org.springframework.stereotype.Repository;
*/
@Repository
public interface IPlanRuleDao extends BaseDao<PlanRule, Long>{
void deleteByPlanId(long planId);
List<PlanRule> getPlanDocsByPlanId(Long planId);
List<PlanRule> findAllByIsDelete(Boolean isDelete);
}
package com.yeejoin.amos.fas.business.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper;
import com.yeejoin.amos.component.rule.config.ClazzUtils;
import com.yeejoin.amos.fas.business.dao.mapper.*;
import com.yeejoin.amos.fas.business.dao.repository.*;
import com.yeejoin.amos.fas.business.service.intfc.ContingencyPlanService;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyPlanService;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService;
import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
import com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo;
import com.yeejoin.amos.fas.business.vo.PlanDetailVo;
import com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum;
import com.yeejoin.amos.fas.common.enums.PlanRecordStatusEnum;
import com.yeejoin.amos.fas.core.enums.NumberEnum;
import com.yeejoin.amos.fas.core.enums.ReserveEnum;
import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.exception.YeeException;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.*;
/**
*@program: YeeAmosFireAutoSysRoot
*@description: 预案实现类
*@author: wujunkai
*@create: 2021-01-14 14:59
* @program: YeeAmosFireAutoSysRoot
* @description: 预案实现类
* @author: wujunkai
* @create: 2021-01-14 14:59
*/
@Service("ContingencyPlanService")
public class ContingencyPlanServiceImpl implements ContingencyPlanService {
@Autowired
private IPlanDetailDao planDetailDao;
@Service
public class ContingencyPlanServiceImpl implements IContingencyPlanService {
private final Logger logger = LogManager.getLogger(ContingencyPlanServiceImpl.class);
@Autowired
private IEquipmentService equipmentService;
@Autowired
......@@ -34,32 +45,64 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
@Autowired
private IPlanOperationRecordDao planOperationRecordDao;
@Autowired
<<<<<<< HEAD
private IEquipmentFireEquipmentDao equipmentFireEquipmentDao;
=======
private IEquipmentFireEquipmentDao equipmentFireEquipmentDao;
@Qualifier("iEquipmentDao")
>>>>>>> dev_upgrade-1225
@Autowired
private IEquipmentDao equipmentDao;
private final PlanOperationRecordMapper planOperationRecordMapper;
private final IPlanDetailDao planDetailDao;
private final IPlanDocDao planDocDao;
private final IPlanEquipmentDao planEquipmentDao;
private final IPlanRuleDao planRuleDao;
private final IPlanClassifyTreeDao classifyTreeDao;
private final PlanDetailMapper planDetailMapper;
private final PlanEquipmentMapper planEquipmentMapper;
private final PlanRuleMapper planRuleMapper;
private final PlanDocMapper planDocMapper;
private final EmqKeeper emqKeeper;
@Autowired
private IPlanEquipmentDao planEquipmentDao;
@Autowired
private PlanOperationRecordMapper planOperationRecordMapper;
public ContingencyPlanServiceImpl(IPlanDetailDao planDetailDao, IPlanDocDao planDocDao, IPlanEquipmentDao planEquipmentDao,
IPlanRuleDao planRuleDao, IPlanClassifyTreeDao classifyTreeDao, PlanDetailMapper planDetailMapper,
PlanEquipmentMapper planEquipmentMapper, PlanRuleMapper planRuleMapper, PlanDocMapper planDocMapper,
PlanOperationRecordMapper planOperationRecordMapper, EmqKeeper emqKeeper) {
this.planDetailDao = planDetailDao;
this.planDocDao = planDocDao;
this.planEquipmentDao = planEquipmentDao;
this.planRuleDao = planRuleDao;
this.classifyTreeDao = classifyTreeDao;
this.planDetailMapper = planDetailMapper;
this.planEquipmentMapper = planEquipmentMapper;
this.planRuleMapper = planRuleMapper;
this.planDocMapper = planDocMapper;
this.planOperationRecordMapper = planOperationRecordMapper;
this.emqKeeper = emqKeeper;
}
@Override
public String planStart(ContingencyPlanParamVo vo){
ReserveEnum reserveEnum= null;
public String planStart(ContingencyPlanParamVo vo) {
ReserveEnum reserveEnum = null;
//模拟启动
if(ContingencyPlanStatusEnum.SIMULATION_START.getCode().equals(vo.getStatus())){
Integer[] statusArray = (Integer[]) Arrays.asList(ContingencyPlanStatusEnum.SIMULATION_START.getCode(),ContingencyPlanStatusEnum.ONGOING.getCode()).toArray();
int count =planDetailDao.findByStatus(statusArray);
if (ContingencyPlanStatusEnum.SIMULATION_START.getCode().equals(vo.getStatus())) {
Integer[] statusArray = (Integer[]) Arrays.asList(ContingencyPlanStatusEnum.SIMULATION_START.getCode(), ContingencyPlanStatusEnum.ONGOING.getCode()).toArray();
int count = planDetailDao.findByStatus(statusArray);
if (count > NumberEnum.ZERO.getValue()) {
return ReserveEnum.RUNNING.getText();
}
}else if(ContingencyPlanStatusEnum.ONGOING.getCode().equals(vo.getStatus())){
//自动启动
} else if (ContingencyPlanStatusEnum.ONGOING.getCode().equals(vo.getStatus())) {
//自动启动
Integer[] statusArray = (Integer[]) Arrays.asList(ContingencyPlanStatusEnum.ONGOING.getCode()).toArray();
int count =planDetailDao.findByStatus(statusArray);
int count = planDetailDao.findByStatus(statusArray);
if (count > NumberEnum.ZERO.getValue()) {
return ReserveEnum.RUNNING.getText();
}
}else {
} else {
return "预控启动状态不正确";
}
Optional<PlanDetail> PlanDetailOp = planDetailDao.findById(Long.valueOf(vo.getPlanId()));
......@@ -69,16 +112,16 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
planOperationRecord.setPlanId(PlanDetailOp.get().getId());
planOperationRecord.setIsDelete(true);
planOperationRecord.setStartTime(new Date());
planOperationRecord.setPlanPattern(Integer.parseInt(vo.getStatus()));
planOperationRecord.setPlanPattern(vo.getStatus());
PlanOperationRecord result = planOperationRecordDao.save(planOperationRecord);
//预案启动
if(PlanDetailOp.get()!=null){
if (PlanDetailOp.get() != null) {
Equipment equipment = equipmentService.queryOne(PlanDetailOp.get().getId());
//预案启动
reserveEnum = riskSourceService.startEquipReserve(equipment.getId(),equipment.getCode(),result.getId());
if(ReserveEnum.RUN.getStatus() == reserveEnum.getStatus()){
PlanDetail planDetail = PlanDetailOp.get();
planDetail.setStatus(Integer.parseInt(ContingencyPlanStatusEnum.SIMULATION_START.getCode()));
reserveEnum = riskSourceService.startEquipReserve(equipment.getId(), equipment.getCode(), result.getId());
if (ReserveEnum.RUN == reserveEnum) {
PlanDetail planDetail = PlanDetailOp.get();
planDetail.setStatus(ContingencyPlanStatusEnum.SIMULATION_START.getCode());
planDetailDao.save(planDetail);
}
}
......@@ -88,13 +131,13 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
@Override
public ContingencyPlanParamVo equipmentScene(Long equipmentId) {
ContingencyPlanParamVo vo = null;
List<EquipmentFireEquipment> equipmentFireEquipmentList = equipmentFireEquipmentDao.findAllByEquipmentId(equipmentId);
if(equipmentFireEquipmentList.size()>0){
Optional<Equipment> equipmentOptional = equipmentDao.findById(equipmentFireEquipmentList.get(0).getEquipmentId());
if(equipmentOptional.get()!=null){
PlanEquipment planEquipment = planEquipmentDao.findByFireEquipmentId(equipmentOptional.get().getId());
if(planEquipment!=null){
vo =new ContingencyPlanParamVo();
List<EquipmentFireEquipment> equipmentFireEquipmentList = equipmentFireEquipmentDao.findAllByEquipmentId(equipmentId);
if (equipmentFireEquipmentList.size() > 0) {
Equipment equipment = equipmentDao.findById(equipmentFireEquipmentList.get(0).getEquipmentId()).orElse(null);
if (equipment != null) {
PlanEquipment planEquipment = planEquipmentDao.findByFireEquipmentId(equipment.getId());
if (planEquipment != null) {
vo = new ContingencyPlanParamVo();
vo.setPlanId(planEquipment.getPlanId().toString());
vo.setStatus(ContingencyPlanStatusEnum.ONGOING.getCode());
return vo;
......@@ -105,6 +148,7 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
}
@Override
<<<<<<< HEAD
public Page recordListByPage(int current, int pageSize,String planName) {
Map<String,Object> params = new HashMap<>();
params.put("planName",planName);
......@@ -112,6 +156,15 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
params.put("pageSize",pageSize);
List<HashMap<String,Object>> result = planOperationRecordMapper.PlanOperationRecordListByPage(params);
Integer count = planOperationRecordMapper.PlanOperationRecordListByCount(params);
=======
public Page recordListByPage(String planName, int pageNumber, int pageSize) {
Map<String, Object> params = new HashMap<>();
params.put("planName", planName);
params.put("pageNumber", pageNumber);
params.put("pageSize", pageSize);
List<HashMap<String, Object>> result = planOperationRecordMapper.PlanOperationRecordListByPage(params);
Integer count = planOperationRecordMapper.PlanOperationRecordListByCount(params);
>>>>>>> dev_upgrade-1225
Page page = new Page();
page.setRecords(result);
page.setTotal(count);
......@@ -120,4 +173,261 @@ public class ContingencyPlanServiceImpl implements ContingencyPlanService {
return page;
}
@Override
public PlanDetailVo createPlan(PlanDetailVo planDetail) {
PlanDoc planDoc = planDetail.getPlanDoc();
PlanRule planRule = planDetail.getPlanRule();
List<PlanEquipment> planEquipment = planDetail.getPlanEquipment();
if (StringUtils.isBlank(planDetail.getPlanName()) || null == planDetail.getClassifyId()
|| null == planDoc || null == planDoc.getDocId()
|| null == planRule || null == planRule.getRuleId()
|| null == planEquipment || planEquipment.isEmpty()) {
throw new YeeException("参数错误");
}
planEquipment.forEach(equipment -> {
if (null == equipment || null == equipment.getFireEquipmentId()) {
throw new YeeException("参数错误");
}
});
// 状态为草稿
planDetail.setStatus(ContingencyPlanStatusEnum.DRAFT.getCode());
planDetail.setIsDelete(false);
PlanDetail planEntity = new PlanDetail();
BeanUtils.copyProperties(planDetail, planEntity);
long planId = planDetailDao.save(planEntity).getId();
planDetail.setId(planId);
planDoc.setPlanId(planId);
planDoc.setIsDelete(false);
planDocDao.save(planDoc);
planRule.setPlanId(planId);
planRule.setIsDelete(false);
planRuleDao.save(planRule);
planEquipment.forEach(equipment -> {
equipment.setPlanId(planId);
equipment.setIsDelete(false);
});
planEquipmentDao.saveAll(planEquipment);
return planDetail;
}
@Override
public PlanDetailVo editPlan(PlanDetailVo planDetail) {
PlanDoc planDoc = planDetail.getPlanDoc();
PlanRule planRule = planDetail.getPlanRule();
List<PlanEquipment> planEquipment = planDetail.getPlanEquipment();
if (StringUtils.isBlank(planDetail.getPlanName()) || null == planDetail.getClassifyId()
|| null == planDoc || null == planDoc.getDocId()
|| null == planRule || null == planRule.getRuleId()
|| null == planEquipment || planEquipment.isEmpty()) {
throw new YeeException("参数错误");
}
planEquipment.forEach(equipment -> {
if (null == equipment || null == equipment.getFireEquipmentId()) {
throw new YeeException("参数错误");
}
});
long planId = planDetail.getId();
PlanDetail oldPlan = planDetailDao.findById(planId).orElse(null);
if (null == oldPlan) {
throw new YeeException("数据不存在");
}
if (ContingencyPlanStatusEnum.getEnum(oldPlan.getStatus()) == ContingencyPlanStatusEnum.DRAFT
|| ContingencyPlanStatusEnum.getEnum(oldPlan.getStatus()) == ContingencyPlanStatusEnum.NOAVAILABLE) {
// 状态设置为草稿
planDetail.setStatus(ContingencyPlanStatusEnum.DRAFT.getCode());
} else {
throw new YeeException("不可编辑的状态");
}
PlanDetail planEntity = new PlanDetail();
BeanUtils.copyProperties(planDetail, planEntity);
planDetailDao.saveAndFlush(planEntity);
planDoc.setPlanId(planId);
planDoc.setIsDelete(false);
planDocDao.deleteByPlanId(planId);
planDocDao.save(planDoc);
planRule.setPlanId(planId);
planDoc.setIsDelete(false);
planRuleDao.deleteByPlanId(planId);
planRuleDao.save(planRule);
planEquipment.forEach(equipment -> {
equipment.setPlanId(planId);
planDoc.setIsDelete(false);
});
planEquipmentDao.deleteByPlanId(planId);
planEquipmentDao.saveAll(planEquipment);
return planDetail;
}
@Override
public PlanDetailVo detail(Long id) {
PlanDetail detail = planDetailDao.findById(id).orElse(null);
if (null == detail) {
throw new YeeException("数据不存在");
}
PlanDetailVo detailVo = new PlanDetailVo();
BeanUtils.copyProperties(detail, detailVo);
List<PlanDoc> docs = planDocDao.getPlanDocsByPlanId(id);
if (!docs.isEmpty()) {
detailVo.setPlanDoc(docs.get(0));
}
List<PlanRule> rules = planRuleDao.getPlanDocsByPlanId(id);
if (!rules.isEmpty()) {
detailVo.setPlanRule(rules.get(0));
}
List<PlanEquipment> equipments = planEquipmentDao.getPlanDocsByPlanId(id);
detailVo.setPlanEquipment(equipments);
//TODO-设置执行次数
detailVo.setExecutionTimes(0);
PlanClassifyTree classifyTree = classifyTreeDao.findById(detailVo.getClassifyId()).orElse(null);
if (null != classifyTree) {
detailVo.setClassifyName(classifyTree.getClassifyName());
}
return detailVo;
}
@Override
public List<PlanDetail> activatePlan(List<Long> idList) {
List<PlanDetail> planDetailList = planDetailDao.getPlanDetailsByIdInAndIsDelete(idList, false);
if (!planDetailList.isEmpty()) {
planDetailList.forEach(plan -> {
if (ContingencyPlanStatusEnum.getEnum(plan.getStatus()) != ContingencyPlanStatusEnum.DRAFT
&& ContingencyPlanStatusEnum.getEnum(plan.getStatus()) != ContingencyPlanStatusEnum.AVAILABLE
&& ContingencyPlanStatusEnum.getEnum(plan.getStatus()) != ContingencyPlanStatusEnum.NOAVAILABLE) {
throw new YeeException("包含不可启用的状态");
}
plan.setStatus(ContingencyPlanStatusEnum.AVAILABLE.getCode());
});
planDetailMapper.updatePlanStatusByIdList(idList, ContingencyPlanStatusEnum.AVAILABLE.getCode());
}
return planDetailList;
}
@Override
public List<PlanDetail> deactivatePlan(List<Long> idList) {
List<PlanDetail> planDetailList = planDetailDao.getPlanDetailsByIdInAndIsDelete(idList, false);
if (!planDetailList.isEmpty()) {
planDetailList.forEach(plan -> {
if (ContingencyPlanStatusEnum.getEnum(plan.getStatus()) != ContingencyPlanStatusEnum.AVAILABLE
&& ContingencyPlanStatusEnum.getEnum(plan.getStatus()) != ContingencyPlanStatusEnum.NOAVAILABLE) {
throw new YeeException("包含不可禁用的状态");
}
plan.setStatus(ContingencyPlanStatusEnum.NOAVAILABLE.getCode());
});
planDetailMapper.updatePlanStatusByIdList(idList, ContingencyPlanStatusEnum.NOAVAILABLE.getCode());
}
return planDetailList;
}
@Override
public Boolean delete(List<Long> idList) {
planDetailMapper.updateIsDeleteByIdList(idList, true);
planDocMapper.updateIsDeleteByPlanIdList(idList, true);
planEquipmentMapper.updateIsDeleteByPlanIdList(idList, true);
planRuleMapper.updateIsDeleteByPlanIdList(idList, true);
return true;
}
@Override
public Page<PlanDetailVo> pageFilter(Page page, String planName, Long[] classifyId, String[] planRange, String editOrgName, Date implementationTimeLeft, Date implementationTimeRight) {
int total = planDetailMapper.filterCount(planName, classifyId, planRange, editOrgName, implementationTimeLeft, implementationTimeRight);
page.setTotal(total);
long start = (page.getCurrent() - 1) * page.getSize();
if (total == 0) {
page.setCurrent(1);
} else {
if (total < start) {
page.setCurrent(1);
start = 0;
}
List<PlanDetailVo> planList = planDetailMapper.filterList(planName, classifyId, planRange, editOrgName, implementationTimeLeft, implementationTimeRight, (int) start, (int) page.getSize());
page.setRecords(planList);
}
return page;
}
@Override
public Map<Long, Long> getPlanUsedDocs() {
Map<Long, Long> resMap = new HashMap<>(64);
List<PlanDoc> usedList = planDocDao.findAllByIsDelete(false);
if (!usedList.isEmpty()) {
usedList.forEach(planDoc -> resMap.put(planDoc.getDocId(), planDoc.getPlanId()));
}
return resMap;
}
@Override
public Map<String, Long> getPlanUsedRules() {
Map<String, Long> resMap = new HashMap<>(64);
List<PlanRule> usedList = planRuleDao.findAllByIsDelete(false);
if (!usedList.isEmpty()) {
usedList.forEach(planRule -> resMap.put(planRule.getRuleId(), planRule.getPlanId()));
}
return resMap;
}
@Override
public Map<Long, Long> getPlanUsedEquipments() {
Map<Long, Long> resMap = new HashMap<>(64);
List<PlanEquipment> usedList = planEquipmentDao.findAllByIsDelete(false);
if (!usedList.isEmpty()) {
usedList.forEach(planEquipment -> resMap.put(planEquipment.getFireEquipmentId(), planEquipment.getPlanId()));
}
return resMap;
}
@Override
public void subscribeTopic() {
try {
emqKeeper.getMqttClient().subscribe(DELETE_SYNC_PLAN_DOC, (s, mqttMessage) -> {
System.out.println(s);
byte[] payload = mqttMessage.getPayload();
try {
List<Long> ids = (List<Long>) ClazzUtils.deserializableObject(payload);
if (!ValidationUtil.isEmpty(ids)) {
planDocMapper.logicDeleteByDocIdList(ids);
}
} catch (Exception e) {
logger.error("预案文档删除同步出错", e);
}
});
} catch (MqttException e) {
logger.fatal("订阅文档删除同步消息失败,资源删除或取消无法同步", e);
}
try {
emqKeeper.getMqttClient().subscribe(DELETE_SYNC_PLAN_RULE, (s, mqttMessage) -> {
System.out.println(s);
byte[] payload = mqttMessage.getPayload();
try {
List<String> ids = (List<String>) ClazzUtils.deserializableObject(payload);
if (!ValidationUtil.isEmpty(ids)) {
planRuleMapper.logicDeleteByRuleIdList(ids);
}
} catch (Exception e) {
logger.error("预案规则删除同步出错", e);
}
});
} catch (MqttException e) {
logger.fatal("订阅规则删除同步消息失败,资源删除或取消无法同步", e);
}
/*try {
emqKeeper.getMqttClient().subscribe(DELETE_SYNC_PLAN_EQUIP, (s, mqttMessage) -> {
System.out.println(s);
byte[] payload = mqttMessage.getPayload();
try {
List<Long> ids = (List<Long>) ClazzUtils.deserializableObject(payload);
if (!ValidationUtil.isEmpty(ids)) {
planEquipmentMapper.logicDeleteByEquipIdList(ids);
}
} catch (Exception e) {
logger.error("预案保护对象删除同步出错", e);
}
});
} catch (MqttException e) {
logger.fatal("订阅保护对象删除同步消息失败,资源删除或取消无法同步", e);
}*/
}
}
\ No newline at end of file
......@@ -2,10 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificMapper;
import com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.ImpEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.*;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao;
......@@ -72,6 +69,9 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private PlanEquipmentMapper planEquipmentMapper;
// @Autowired
// private IFmeaEquipmentPointDao iFmeaEquipmentPointDao;
......@@ -109,6 +109,7 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Override
@Transactional
public String[] delete(String[] idArray) throws Exception {
List<Long> idList = new ArrayList<>();
for (String id : idArray) {
Optional<Equipment> equipment1 = iEquipmentDao.findById(Long.parseLong(id));
Equipment equipment=null;
......@@ -125,10 +126,12 @@ public class EquipmentServiceImpl implements IEquipmentService {
} else {
throw new Exception("找不到指定的对象:" + id);
}
idList.add(Long.valueOf(id));
//删除重点设备关联关系
equipmentFireEquipmentDao.deleteByEquipmentId(Long.valueOf(id));
}
// 同步至数字预案
planEquipmentMapper.logicDeleteByEquipIdList(idList);
return idArray;
}
......
package com.yeejoin.amos.fas.business.service.intfc;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.business.vo.PlanDetailVo;
import com.yeejoin.amos.fas.dao.entity.PlanDetail;
import com.yeejoin.amos.fas.exception.YeeException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @author wjk
* @date 2021-01-14
* 预案操作
*/
public interface IContingencyPlanService {
String DELETE_SYNC_PLAN_DOC = "DELETE_SYNC_PLAN_DOC";
String DELETE_SYNC_PLAN_RULE = "DELETE_SYNC_PLAN_RULE";
String DELETE_SYNC_PLAN_EQUIP = "DELETE_SYNC_PLAN_EQUIP";
String planStart(ContingencyPlanParamVo vo);
ContingencyPlanParamVo equipmentScene(Long equipmentId);
Page recordListByPage (String planName, int pageNumber, int pageSize);
/**
* 创建
* @param planDetail
* @return
*/
@Transactional(rollbackFor = {YeeException.class, Exception.class})
PlanDetailVo createPlan(PlanDetailVo planDetail);
/**
* 编辑
* @param planDetail
* @return
*/
@Transactional(rollbackFor = {YeeException.class, Exception.class})
PlanDetailVo editPlan(PlanDetailVo planDetail);
/**
* 单个详情
* @param id
* @return
*/
PlanDetailVo detail(Long id);
/**
* 启用
* @param idList
* @return
*/
List<PlanDetail> activatePlan(List<Long> idList);
/**
* 停用
* @param idList
* @return
*/
List<PlanDetail> deactivatePlan(List<Long> idList);
/**
* 删除
* @param idList
* @return
*/
@Transactional(rollbackFor = {YeeException.class, Exception.class})
Boolean delete(List<Long> idList);
/**
* 分页查询
* @param page 分页
* @param planName 预案名称
* @param classifyId 预案类型
* @param planRange 适用范围
* @param editOrgName 编写部门
* @param implementationTimeLeft 实施时间左界限
* @param implementationTimeRight 实施时间右界限
* @return Page
*/
Page<PlanDetailVo> pageFilter(Page page, String planName, Long[] classifyId, String[] planRange, String editOrgName, Date implementationTimeLeft, Date implementationTimeRight);
/**
* 查询预案使用的文档ID
* @return
*/
Map<Long, Long> getPlanUsedDocs();
/**
* 查询预案使用的规则ID
* @return
*/
Map<String, Long> getPlanUsedRules();
/**
* 查询预案使用的装备ID
* @return
*/
Map<Long, Long> getPlanUsedEquipments();
/**
* 监听文档取消发布/规则、装备删除动态
*/
void subscribeTopic();
}
......@@ -6,7 +6,7 @@ public class ContingencyPlanParamVo {
public String planId;
public String status;
public Integer status;
public String getPlanId() {
return planId;
......@@ -16,11 +16,11 @@ public class ContingencyPlanParamVo {
this.planId = planId;
}
public String getStatus() {
public Integer getStatus() {
return status;
}
public void setStatus(String status) {
public void setStatus(Integer status) {
this.status = status;
}
}
......
package com.yeejoin.amos.fas.business.vo;
import com.yeejoin.amos.fas.dao.entity.*;
import lombok.Data;
import java.util.List;
/**
* <h1><h1>
*
* @author tiantao
* @date 2021/1/15 11:18
*/
@Data
public class PlanDetailVo extends PlanDetail {
/**
* 预案所属分类名称
*/
private String classifyName;
/**
* 绑定规则
*/
private PlanRule planRule;
/**
* 绑定文档
*/
private PlanDoc planDoc;
/**
* 绑定装备
*/
private List<PlanEquipment> planEquipment;
/**
* 执行次数
*/
private int executionTimes;
}
package com.yeejoin.amos.fas.config;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyPlanService;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentHandlerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
......@@ -18,10 +19,13 @@ import org.springframework.stereotype.Component;
public class ApplicationRunnerImpl implements ApplicationRunner {
@Autowired
IEquipmentHandlerService equipmentHandlerService;
private IEquipmentHandlerService equipmentHandlerService;
@Autowired
private IContingencyPlanService contingencyPlanService;
@Override
public void run(ApplicationArguments args) throws Exception {
equipmentHandlerService.subscribeTopic();
contingencyPlanService.subscribeTopic();
}
}
......@@ -2,4 +2,105 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.PlanDetailMapper">
<update id="updatePlanStatusByIdList" parameterType="list">
UPDATE c_plan_detail SET status = #{status} WHERE id IN
<foreach collection="idList" separator="," item="id" open="(" close=")">
#{id}
</foreach>
</update>
<update id="updateIsDeleteByIdList" parameterType="list">
UPDATE c_plan_detail SET is_delete = #{isDelete} WHERE id IN
<foreach collection="idList" separator="," item="id" open="(" close=")">
#{id}
</foreach>
</update>
<select id="filterCount" parameterType="string" resultType="int">
SELECT
count(1)
FROM
c_plan_detail cpd
<where>
<if test="planName != null and planName.length > 0">
AND plan_name LIKE concat('%', #{planName}, '%')
</if>
<if test="classifyId != null and classifyId.size > 0">
AND classify_id IN
<foreach collection="classifyId" separator="," item="cid" open="(" close=")">
#{cid}
</foreach>
</if>
<if test="planRange != null and planRange.size > 0">
AND plan_range IN
<foreach collection="planRange" separator="," item="pr" open="(" close=")">
#{pr}
</foreach>
</if>
<if test="editOrgName != null and editOrgName.length > 0">
AND edit_org_name LIKE concat('%', #{editOrgName}, '%')
</if>
<if test="implementationTimeLeft != null">
AND implementation_time <![CDATA[ >= ]]> #{implementationTimeLeft}
</if>
<if test="implementationTimeRight != null">
AND implementation_time <![CDATA[ < ]]> #{implementationTimeRight}
</if>
AND is_delete = 0
</where>
</select>
<select id="filterList" parameterType="string" resultType="com.yeejoin.amos.fas.business.vo.PlanDetailVo">
SELECT
id
, create_date createDate
, plan_name planName
, code
, classify_id classifyId
, plan_range planRange
, edit_org_name editOrgName
, edition
, implementation_time implementationTime
, remark
, status
, creator
, reviser
, update_time updateTime
, org_code orgCode
, is_delete isDelete
, input_time inputTime
, (SELECT classify_name FROM c_plan_classify_tree cpct WHERE id = cpd.classify_id) classifyName
, (SELECT count(1) FROM c_plan_operation_record cpor WHERE plan_id = cpd.id) executionTimes
FROM
c_plan_detail cpd
<where>
<if test="planName != null and planName.length > 0">
AND plan_name LIKE concat('%', #{planName}, '%')
</if>
<if test="classifyId != null and classifyId.size > 0">
AND classify_id IN
<foreach collection="classifyId" separator="," item="cid" open="(" close=")">
#{cid}
</foreach>
</if>
<if test="planRange != null and planRange.size > 0">
AND plan_range IN
<foreach collection="planRange" separator="," item="pr" open="(" close=")">
#{pr}
</foreach>
</if>
<if test="editOrgName != null and editOrgName.length > 0">
AND edit_org_name LIKE concat('%', #{editOrgName}, '%')
</if>
<if test="implementationTimeLeft != null">
AND implementation_time <![CDATA[ >= ]]> #{implementationTimeLeft}
</if>
<if test="implementationTimeRight != null">
AND implementation_time <![CDATA[ < ]]> #{implementationTimeRight}
</if>
AND is_delete = 0
</where>
ORDER BY create_date ASC
LIMIT #{start}, #{size}
</select>
</mapper>
\ No newline at end of file
......@@ -2,4 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.PlanDocMapper">
<update id="updateIsDeleteByPlanIdList" parameterType="list">
UPDATE c_plan_doc SET is_delete = #{isDelete} WHERE plan_id IN
<foreach collection="planIdList" separator="," item="planId" open="(" close=")">
#{planId}
</foreach>
</update>
<update id="logicDeleteByDocIdList" parameterType="list">
UPDATE c_plan_doc SET is_delete = 1 WHERE doc_id IN
<foreach collection="docIdList" separator="," item="docId" open="(" close=")">
#{docId}
</foreach>
</update>
</mapper>
\ No newline at end of file
......@@ -2,4 +2,18 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.PlanEquipmentMapper">
<update id="updateIsDeleteByPlanIdList" parameterType="list">
UPDATE c_plan_equipment SET is_delete = #{isDelete} WHERE plan_id IN
<foreach collection="planIdList" separator="," item="planId" open="(" close=")">
#{planId}
</foreach>
</update>
<update id="logicDeleteByEquipIdList" parameterType="list">
UPDATE c_plan_equipment SET is_delete = 1 WHERE fire_equipment_id IN
<foreach collection="equipIdList" separator="," item="equipId" open="(" close=")">
#{equipId}
</foreach>
</update>
</mapper>
\ No newline at end of file
......@@ -2,4 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.PlanRuleMapper">
<update id="updateIsDeleteByPlanIdList" parameterType="list">
UPDATE c_plan_rule SET is_delete = #{isDelete} WHERE plan_id IN
<foreach collection="planIdList" separator="," item="planId" open="(" close=")">
#{planId}
</foreach>
</update>
<update id="logicDeleteByRuleIdList" parameterType="list">
UPDATE c_plan_rule SET is_delete = 1 WHERE rule_id IN
<foreach collection="ruleIdList" separator="," item="ruleId" open="(" close=")">
#{ruleId}
</foreach>
</update>
</mapper>
\ No newline at end of file
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