Commit 15c52d69 authored by ZWT's avatar ZWT

feat(能源管理系统): 间开制度管理

1.开发中短期间开优化模块-中短期优化详情接口,完成接口冒烟测试并生成接口文档;
2.开发间开优化历史模块-优化历史分页列表接口,完成接口冒烟测试并生成接口文档;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 3e214daf
...@@ -3,6 +3,7 @@ package pps.core.base.service; ...@@ -3,6 +3,7 @@ package pps.core.base.service;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.pagehelper.page.PageMethod; import com.github.pagehelper.page.PageMethod;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -96,8 +97,26 @@ public class BasePowerLineService { ...@@ -96,8 +97,26 @@ public class BasePowerLineService {
if (Objects.isNull(entity)) { if (Objects.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
//删除线路关联信息 //删除井口关联信息
this.deleteLineRelation(context, lineId); BasePowerLineWellheadMapper wellheadMapper = context.getBean(BasePowerLineWellheadMapper.class);
wellheadMapper.delete(new LambdaQueryWrapper<BasePowerLineWellheadEnt>()
.eq(BasePowerLineWellheadEnt::getLineId, lineId)
);
//删除光伏关联信息
BasePowerLinePlantMapper plantMapper = context.getBean(BasePowerLinePlantMapper.class);
plantMapper.delete(new LambdaQueryWrapper<BasePowerLinePlantEnt>()
.eq(BasePowerLinePlantEnt::getLineId, lineId)
);
//删除储能关联信息
BasePowerLineStorageMapper storageMapper = context.getBean(BasePowerLineStorageMapper.class);
storageMapper.delete(new LambdaQueryWrapper<BasePowerLineStorageEnt>()
.eq(BasePowerLineStorageEnt::getLineId, lineId)
);
//删除柴发关联信息
BasePowerLineDieselMapper dieselMapper = context.getBean(BasePowerLineDieselMapper.class);
dieselMapper.delete(new LambdaQueryWrapper<BasePowerLineDieselEnt>()
.eq(BasePowerLineDieselEnt::getLineId, lineId)
);
//新增关联信息 //新增关联信息
this.saveLineRelation(lineId, ouId, session, input.getWellheadInputs(), input.getPlantInputs(), input.getStorageInputs(), input.getDieselInputs()); this.saveLineRelation(lineId, ouId, session, input.getWellheadInputs(), input.getPlantInputs(), input.getStorageInputs(), input.getDieselInputs());
XCopyUtils.copyObject(input, entity); XCopyUtils.copyObject(input, entity);
...@@ -129,9 +148,34 @@ public class BasePowerLineService { ...@@ -129,9 +148,34 @@ public class BasePowerLineService {
if (Objects.isNull(entity)) { if (Objects.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
//删除线路关联信息 mapper.update(null, new LambdaUpdateWrapper<BasePowerLineEnt>()
this.deleteLineRelation(context, lineId); .eq(BaseModel::getId, lineId)
mapper.deleteById(entity); .set(BaseModel::getIsDeleted, BusinessConstant.ZERO)
);
//删除井口关联信息
BasePowerLineWellheadMapper wellheadMapper = context.getBean(BasePowerLineWellheadMapper.class);
wellheadMapper.update(null, new LambdaUpdateWrapper<BasePowerLineWellheadEnt>()
.eq(BasePowerLineWellheadEnt::getLineId, lineId)
.set(BaseModel::getIsDeleted, BusinessConstant.ZERO)
);
//删除光伏关联信息
BasePowerLinePlantMapper plantMapper = context.getBean(BasePowerLinePlantMapper.class);
plantMapper.update(null, new LambdaUpdateWrapper<BasePowerLinePlantEnt>()
.eq(BasePowerLinePlantEnt::getLineId, lineId)
.set(BaseModel::getIsDeleted, BusinessConstant.ZERO)
);
//删除储能关联信息
BasePowerLineStorageMapper storageMapper = context.getBean(BasePowerLineStorageMapper.class);
storageMapper.update(null, new LambdaUpdateWrapper<BasePowerLineStorageEnt>()
.eq(BasePowerLineStorageEnt::getLineId, lineId)
.set(BaseModel::getIsDeleted, BusinessConstant.ZERO)
);
//删除柴发关联信息
BasePowerLineDieselMapper dieselMapper = context.getBean(BasePowerLineDieselMapper.class);
dieselMapper.update(null, new LambdaUpdateWrapper<BasePowerLineDieselEnt>()
.eq(BasePowerLineDieselEnt::getLineId, lineId)
.set(BaseModel::getIsDeleted, BusinessConstant.ZERO)
);
return XServiceResult.OK; return XServiceResult.OK;
}); });
} }
...@@ -386,33 +430,4 @@ public class BasePowerLineService { ...@@ -386,33 +430,4 @@ public class BasePowerLineService {
BaseUtils.batchInsert(BasePowerLineDieselMapper.class, BasePowerLineDieselEnt.class, diesels); BaseUtils.batchInsert(BasePowerLineDieselMapper.class, BasePowerLineDieselEnt.class, diesels);
} }
} }
/**
* 删除线路关系信息
*
* @param context 上下文
* @param lineId 行id
*/
private void deleteLineRelation(XContext context, String lineId) {
//删除井口关联信息
BasePowerLineWellheadMapper wellheadMapper = context.getBean(BasePowerLineWellheadMapper.class);
wellheadMapper.delete(new LambdaQueryWrapper<BasePowerLineWellheadEnt>()
.eq(BasePowerLineWellheadEnt::getLineId, lineId)
);
//删除光伏关联信息
BasePowerLinePlantMapper plantMapper = context.getBean(BasePowerLinePlantMapper.class);
plantMapper.delete(new LambdaQueryWrapper<BasePowerLinePlantEnt>()
.eq(BasePowerLinePlantEnt::getLineId, lineId)
);
//删除储能关联信息
BasePowerLineStorageMapper storageMapper = context.getBean(BasePowerLineStorageMapper.class);
storageMapper.delete(new LambdaQueryWrapper<BasePowerLineStorageEnt>()
.eq(BasePowerLineStorageEnt::getLineId, lineId)
);
//删除柴发关联信息
BasePowerLineDieselMapper dieselMapper = context.getBean(BasePowerLineDieselMapper.class);
dieselMapper.delete(new LambdaQueryWrapper<BasePowerLineDieselEnt>()
.eq(BasePowerLineDieselEnt::getLineId, lineId)
);
}
} }
...@@ -64,7 +64,8 @@ ...@@ -64,7 +64,8 @@
, ( SELECT COUNT( 1 ) FROM base_power_line_wellhead w WHERE base_power_line.id = w.line_id ) AS wellhead_count , ( SELECT COUNT( 1 ) FROM base_power_line_wellhead w WHERE base_power_line.id = w.line_id ) AS wellhead_count
from base_power_line from base_power_line
where where
ou_id in is_deleted = 1
AND ou_id in
<foreach collection="ouList" open="(" close=")" separator="," item="item"> <foreach collection="ouList" open="(" close=")" separator="," item="item">
#{item} #{item}
</foreach> </foreach>
......
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