策略曲线图修改
This commit is contained in:
@ -1,9 +1,12 @@
|
||||
package com.xzzn.framework.scheduler;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.xzzn.common.utils.DateUtils;
|
||||
import com.xzzn.common.utils.StringUtils;
|
||||
import com.xzzn.ems.domain.EmsStrategyCurve;
|
||||
import com.xzzn.ems.domain.EmsStrategyTemp;
|
||||
import com.xzzn.ems.domain.EmsStrategyTimeConfig;
|
||||
import com.xzzn.ems.domain.vo.StrategyPowerDataVo;
|
||||
import com.xzzn.ems.domain.vo.StrategyRunningVo;
|
||||
import com.xzzn.ems.mapper.*;
|
||||
import com.xzzn.framework.manager.ModbusConnectionManager;
|
||||
@ -20,6 +23,7 @@ import org.springframework.stereotype.Component;
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@ -53,8 +57,8 @@ public class StrategyPoller {
|
||||
this.mqttLifecycleManager = mqttLifecycleManager;
|
||||
}
|
||||
// 每1分钟触发(支持cron表达式动态配置)
|
||||
//@Scheduled(cron = "0 */5 * * * *")
|
||||
//@Async("strategyTaskExecutor")
|
||||
@Scheduled(cron = "0 */1 * * * *")
|
||||
@Async("strategyTaskExecutor")
|
||||
public void pollAllDevices() {
|
||||
logger.info("开始执行策略数据轮询...");
|
||||
List<StrategyRunningVo> strategyRunningVoList = emsStrategyRunningMapper.getRunningList(null);
|
||||
@ -71,35 +75,31 @@ public class StrategyPoller {
|
||||
logger.error("策略下方{}任务失败", strategyVo.getId(), e);
|
||||
}
|
||||
});
|
||||
/*
|
||||
try {
|
||||
pollSingleDevice(device);
|
||||
} catch (Exception e) {
|
||||
logger.error("调度设备{}任务失败", device.getId(), e);
|
||||
}*/
|
||||
/*activeDevices.forEach(device -> {
|
||||
try {
|
||||
CompletableFuture.runAsync(() -> processData(device))
|
||||
.exceptionally(e -> {
|
||||
logger.error("设备{}轮询异常", device.getId(), e);
|
||||
return null;
|
||||
});
|
||||
} catch (Exception e) {
|
||||
logger.error("调度设备{}任务失败", device.getId(), e);
|
||||
}
|
||||
});*/
|
||||
}
|
||||
// 处理获取到的数据,发到mqtt服务上
|
||||
private void processData(StrategyRunningVo strategyVo) {
|
||||
logger.info("策略下发数据处理开始");
|
||||
// 根据运行策略获取主副策略的模板数据
|
||||
Long minStrategyId = strategyVo.getMainStrategyId();
|
||||
Long mainStrategyId = strategyVo.getMainStrategyId();
|
||||
Long auxStrategyId = strategyVo.getAuxStrategyId();
|
||||
String siteId = strategyVo.getSiteId();
|
||||
// 处理主策略数据
|
||||
if (minStrategyId != null && StringUtils.isNotBlank(siteId)) {
|
||||
if (mainStrategyId != null && StringUtils.isNotBlank(siteId)) {
|
||||
dealStrategyCurveData(mainStrategyId, siteId);
|
||||
}
|
||||
// 处理副策略数据
|
||||
if (auxStrategyId != null && StringUtils.isNotBlank(siteId)) {
|
||||
dealStrategyCurveData(auxStrategyId, siteId);
|
||||
}
|
||||
|
||||
// 策略数据下发-下方格式暂无
|
||||
|
||||
logger.info("策略下发结束");
|
||||
}
|
||||
|
||||
private void dealStrategyCurveData(Long mainStrategyId, String siteId) {
|
||||
// 获取当前策略的所有模板
|
||||
List<Map<String, String>> temps = emsStrategyTempMapper.getTempNameList(minStrategyId,siteId);
|
||||
List<Map<String, String>> temps = emsStrategyTempMapper.getTempNameList(mainStrategyId,siteId);
|
||||
if (temps != null && temps.size() > 0) {
|
||||
for (Map<String, String> temp : temps) {
|
||||
String tempId = temp.get("templateId");
|
||||
@ -107,33 +107,42 @@ public class StrategyPoller {
|
||||
if (timeConfigs != null && timeConfigs.size() > 0) {
|
||||
for (EmsStrategyTimeConfig timeConfig : timeConfigs) {
|
||||
EmsStrategyCurve curve = new EmsStrategyCurve();
|
||||
curve.setStrategyId(minStrategyId);
|
||||
curve.setSiteId(strategyVo.getSiteId());
|
||||
curve.setStrategyId(mainStrategyId);
|
||||
curve.setSiteId(siteId);
|
||||
curve.setTemplateId(tempId);
|
||||
curve.setCreateBy("system");
|
||||
curve.setCreateTime(DateUtils.getNowDate());
|
||||
curve.setUpdateBy("system");
|
||||
curve.setUpdateTime(DateUtils.getNowDate());
|
||||
// 时间设置
|
||||
String[] dateList= dealWithMonth(Integer.parseInt(timeConfig.getMonth().toString()));
|
||||
int month = Integer.parseInt(timeConfig.getMonth().toString());
|
||||
String[] dateList= dealWithMonth(month);
|
||||
curve.setMonth(Long.valueOf(month));
|
||||
curve.setStartDate(DateUtils.dateTime(DateUtils.YYYY_MM_DD,dateList[0]));
|
||||
curve.setEndDate(DateUtils.dateTime(DateUtils.YYYY_MM_DD,dateList[1]));
|
||||
// powerData暂时不处理
|
||||
|
||||
// 策略数据下发-下方格式暂无
|
||||
// powerData-存json格式
|
||||
List<EmsStrategyTemp> powerConfig = emsStrategyTempMapper.selectStrategyTempByTempId(tempId);
|
||||
List<StrategyPowerDataVo> powerDataVoList = new ArrayList<>();
|
||||
for (int i = 0; i < powerConfig.size(); i++) {
|
||||
EmsStrategyTemp powerTemp = powerConfig.get(i);
|
||||
StrategyPowerDataVo powerDataVo = new StrategyPowerDataVo();
|
||||
powerDataVo.setPowerData(powerTemp.getChargeDischargePower());
|
||||
powerDataVo.setEndTime(DateUtils.parseDateToStr("HH:mm:ss",powerTemp.getEndTime()));
|
||||
powerDataVo.setStartTime(DateUtils.parseDateToStr("HH:mm:ss",powerTemp.getStartTime()));
|
||||
powerDataVoList.add(powerDataVo);
|
||||
}
|
||||
curve.setPowerData(powerDataVoList !=null ? JSON.toJSON(powerDataVoList).toString() : "");
|
||||
|
||||
// 记录推送记录
|
||||
emsStrategyCurveMapper.insertEmsStrategyCurve(curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 处理副策略数据
|
||||
if (auxStrategyId != null && StringUtils.isNotBlank(siteId)) {
|
||||
|
||||
// 设置已下发
|
||||
timeConfig.setIsPost(0);
|
||||
emsStrategyTimeConfigMapper.updateEmsStrategyTimeConfig(timeConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("策略下发结束");
|
||||
}
|
||||
|
||||
private String[] dealWithMonth(int month) {
|
||||
|
||||
@ -50,6 +50,14 @@ public class EmsStrategyCurve extends BaseEntity
|
||||
@Excel(name = "模板id")
|
||||
private String templateId;
|
||||
|
||||
/** 月份,1-12 */
|
||||
@Excel(name = "月份,1-12")
|
||||
private Long month;
|
||||
|
||||
/** 是否删除 0-已删除 1-未删除 */
|
||||
@Excel(name = "是否删除 0-已删除 1-未删除")
|
||||
private Long isDelete;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
@ -128,6 +136,22 @@ public class EmsStrategyCurve extends BaseEntity
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public Long getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(Long month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public Long getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(Long isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@ -144,6 +168,8 @@ public class EmsStrategyCurve extends BaseEntity
|
||||
.append("remark", getRemark())
|
||||
.append("siteId", getSiteId())
|
||||
.append("templateId", getTemplateId())
|
||||
.append("month", getMonth())
|
||||
.append("isDelete", getIsDelete())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +38,10 @@ public class EmsStrategyTimeConfig extends BaseEntity
|
||||
@Excel(name = "模版id")
|
||||
private String templateId;
|
||||
|
||||
/** 是否下发 0-已下发 1-未下发 */
|
||||
@Excel(name = "是否下发 0-已下发 1-未下发")
|
||||
private int isPost;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
@ -98,6 +102,14 @@ public class EmsStrategyTimeConfig extends BaseEntity
|
||||
return templateId;
|
||||
}
|
||||
|
||||
public int getIsPost() {
|
||||
return isPost;
|
||||
}
|
||||
|
||||
public void setIsPost(int isPost) {
|
||||
this.isPost = isPost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@ -112,6 +124,7 @@ public class EmsStrategyTimeConfig extends BaseEntity
|
||||
.append("remark", getRemark())
|
||||
.append("siteId", getSiteId())
|
||||
.append("templateId", getTemplateId())
|
||||
.append("isPost", getIsPost())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xzzn.ems.domain.vo;
|
||||
|
||||
import com.xzzn.common.annotation.Excel;
|
||||
import com.xzzn.ems.domain.EmsStrategyCurve;
|
||||
|
||||
import java.util.List;
|
||||
@ -13,13 +14,39 @@ import java.util.List;
|
||||
public class StrategyCurveVo
|
||||
{
|
||||
|
||||
/** 站点id */
|
||||
private String siteId;
|
||||
|
||||
/** 关联的策略ID */
|
||||
private Long strategyId;
|
||||
|
||||
/** 模板名称 */
|
||||
private String templateName;
|
||||
|
||||
/** 模板id */
|
||||
private String templateId;
|
||||
|
||||
List<EmsStrategyCurve> cureList;
|
||||
/** 月份 */
|
||||
private Long month;
|
||||
|
||||
/** 模板时间功率 */
|
||||
List<StrategyPowerDataVo> powerList;
|
||||
|
||||
public String getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public void setSiteId(String siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public Long getStrategyId() {
|
||||
return strategyId;
|
||||
}
|
||||
|
||||
public void setStrategyId(Long strategyId) {
|
||||
this.strategyId = strategyId;
|
||||
}
|
||||
|
||||
public String getTemplateName() {
|
||||
return templateName;
|
||||
@ -29,14 +56,6 @@ public class StrategyCurveVo
|
||||
this.templateName = templateName;
|
||||
}
|
||||
|
||||
public List<EmsStrategyCurve> getCureList() {
|
||||
return cureList;
|
||||
}
|
||||
|
||||
public void setCureList(List<EmsStrategyCurve> cureList) {
|
||||
this.cureList = cureList;
|
||||
}
|
||||
|
||||
public String getTemplateId() {
|
||||
return templateId;
|
||||
}
|
||||
@ -44,4 +63,20 @@ public class StrategyCurveVo
|
||||
public void setTemplateId(String templateId) {
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public Long getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(Long month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public List<StrategyPowerDataVo> getPowerList() {
|
||||
return powerList;
|
||||
}
|
||||
|
||||
public void setPowerList(List<StrategyPowerDataVo> powerList) {
|
||||
this.powerList = powerList;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xzzn.ems.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xzzn.ems.domain.EmsStrategyCurve;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 策曲线Mapper接口
|
||||
@ -65,4 +66,8 @@ public interface EmsStrategyCurveMapper
|
||||
* @return
|
||||
*/
|
||||
public List<EmsStrategyCurve> getTemplateCurve(String templateId);
|
||||
|
||||
public void physicalDeleteCurve(@Param("strategyId")Long strategyId,@Param("siteId")String siteId);
|
||||
// 根据模版id 删除推送的曲线图数据
|
||||
public void physicalDeleteByTemplateId(String templateId);
|
||||
}
|
||||
|
||||
@ -4,10 +4,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.xzzn.common.utils.DateUtils;
|
||||
import com.xzzn.common.utils.StringUtils;
|
||||
import com.xzzn.ems.domain.EmsStrategyTemp;
|
||||
import com.xzzn.ems.domain.vo.StrategyCurveVo;
|
||||
import com.xzzn.ems.domain.vo.StrategyPowerDataVo;
|
||||
import com.xzzn.ems.mapper.EmsStrategyTempMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -113,19 +115,29 @@ public class EmsStrategyCurveServiceImpl implements IEmsStrategyCurveService
|
||||
|
||||
if (tempList != null && !tempList.isEmpty()) {
|
||||
for (Map<String,String> map : tempList) {
|
||||
StrategyCurveVo vo = new StrategyCurveVo();
|
||||
String tempName = map.get("templateName");
|
||||
String tempId = map.get("templateId");
|
||||
vo.setTemplateName(tempName);
|
||||
vo.setTemplateId(tempId);
|
||||
|
||||
if (StringUtils.isNotEmpty(tempId)) {
|
||||
List<EmsStrategyCurve> taskList = emsStrategyCurveMapper.getTemplateCurve(tempId);
|
||||
vo.setCureList(taskList);
|
||||
}
|
||||
|
||||
for (int i = 0; i < taskList.size(); i++) {
|
||||
StrategyCurveVo vo = new StrategyCurveVo();
|
||||
vo.setTemplateName(tempName);
|
||||
vo.setTemplateId(tempId);
|
||||
vo.setStrategyId(taskList.get(i).getStrategyId());
|
||||
vo.setSiteId(taskList.get(i).getSiteId());
|
||||
vo.setMonth(taskList.get(i).getMonth());
|
||||
// 时间功率
|
||||
String powerJson = taskList.get(i).getPowerData();
|
||||
List<StrategyPowerDataVo> powerList = JSON.parseArray(powerJson, StrategyPowerDataVo.class);
|
||||
vo.setPowerList(powerList);
|
||||
|
||||
dataList.add(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dataList;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import com.xzzn.common.utils.StringUtils;
|
||||
import com.xzzn.common.utils.bean.BeanUtils;
|
||||
import com.xzzn.ems.domain.EmsStrategyTempTimeConfig;
|
||||
import com.xzzn.ems.domain.vo.StrategyTempConfigRequest;
|
||||
import com.xzzn.ems.mapper.EmsStrategyCurveMapper;
|
||||
import com.xzzn.ems.mapper.EmsStrategyTimeConfigMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -30,6 +31,8 @@ public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
|
||||
private EmsStrategyTempMapper emsStrategyTempMapper;
|
||||
@Autowired
|
||||
private EmsStrategyTimeConfigMapper emsStrategyTimeConfigMapper;
|
||||
@Autowired
|
||||
private EmsStrategyCurveMapper emsStrategyCurveMapper;
|
||||
|
||||
/**
|
||||
* 查询模板列表
|
||||
@ -95,6 +98,9 @@ public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
|
||||
// 全删
|
||||
emsStrategyTempMapper.deleteTempByTempId(templateId);
|
||||
|
||||
|
||||
// 根据模版id 删除推送的曲线图数据
|
||||
emsStrategyCurveMapper.physicalDeleteByTemplateId(templateId);
|
||||
// 重新新增
|
||||
addNewTempAndTimeConfig(requestVo);
|
||||
|
||||
@ -111,6 +117,9 @@ public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
|
||||
public int deleteStrategyTempById(String templateId) {
|
||||
// 先更新配置该模板的月份数据
|
||||
emsStrategyTimeConfigMapper.cleanTemplateId(templateId);
|
||||
// 根据模版id 删除推送的曲线图数据
|
||||
emsStrategyCurveMapper.physicalDeleteByTemplateId(templateId);
|
||||
|
||||
return emsStrategyTempMapper.deleteTempByTempId(templateId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,9 @@ package com.xzzn.ems.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.xzzn.common.utils.DateUtils;
|
||||
import com.xzzn.common.utils.StringUtils;
|
||||
import com.xzzn.ems.domain.vo.StrategyTimeConfigVo;
|
||||
import com.xzzn.ems.mapper.EmsStrategyCurveMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xzzn.ems.mapper.EmsStrategyTimeConfigMapper;
|
||||
@ -20,6 +22,8 @@ public class EmsStrategyTimeConfigServiceImpl implements IEmsStrategyTimeConfigS
|
||||
{
|
||||
@Autowired
|
||||
private EmsStrategyTimeConfigMapper emsStrategyTimeConfigMapper;
|
||||
@Autowired
|
||||
private EmsStrategyCurveMapper emsStrategyCurveMapper;
|
||||
|
||||
/**
|
||||
* 查询时间配置
|
||||
@ -57,6 +61,9 @@ public class EmsStrategyTimeConfigServiceImpl implements IEmsStrategyTimeConfigS
|
||||
if (timeConfigList != null) {
|
||||
for (EmsStrategyTimeConfig strategyTimeConfig : timeConfigList) {
|
||||
Long id = strategyTimeConfig.getId();
|
||||
Long strategyId = strategyTimeConfig.getStrategyId();
|
||||
String siteId = strategyTimeConfig.getSiteId();
|
||||
strategyTimeConfig.setIsPost(1);//默认未下发
|
||||
// 新增
|
||||
if (id == null) {
|
||||
strategyTimeConfig.setCreateTime(DateUtils.getNowDate());
|
||||
@ -65,6 +72,10 @@ public class EmsStrategyTimeConfigServiceImpl implements IEmsStrategyTimeConfigS
|
||||
strategyTimeConfig.setUpdateTime(DateUtils.getNowDate());
|
||||
emsStrategyTimeConfigMapper.updateEmsStrategyTimeConfig(strategyTimeConfig);
|
||||
}
|
||||
// 处理曲线图:物理删除该策略的曲线图
|
||||
if (StringUtils.isNotEmpty(siteId) && strategyId != null) {
|
||||
emsStrategyCurveMapper.physicalDeleteCurve(strategyId,siteId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@ -18,10 +18,12 @@
|
||||
<result property="remark" column="remark" />
|
||||
<result property="siteId" column="site_id" />
|
||||
<result property="templateId" column="template_id" />
|
||||
<result property="month" column="month" />
|
||||
<result property="isDelete" column="isDelete" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsStrategyCurveVo">
|
||||
select id, strategy_id, task_number, start_date, end_date, power_data, create_by, create_time, update_by, update_time, remark, site_id, template_id from ems_strategy_curve
|
||||
select id, strategy_id, task_number, start_date, end_date, power_data, create_by, create_time, update_by, update_time, remark, site_id, template_id, month, isDelete from ems_strategy_curve
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsStrategyCurveList" parameterType="EmsStrategyCurve" resultMap="EmsStrategyCurveResult">
|
||||
@ -34,6 +36,8 @@
|
||||
<if test="powerData != null and powerData != ''"> and power_data = #{powerData}</if>
|
||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||
<if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
|
||||
<if test="month != null "> and month = #{month}</if>
|
||||
<if test="isDelete != null "> and isDelete = #{isDelete}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -57,6 +61,8 @@
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="siteId != null">site_id,</if>
|
||||
<if test="templateId != null">template_id,</if>
|
||||
<if test="month != null">month,</if>
|
||||
<if test="isDelete != null">isDelete,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="strategyId != null">#{strategyId},</if>
|
||||
@ -71,6 +77,8 @@
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="siteId != null">#{siteId},</if>
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="month != null">#{month},</if>
|
||||
<if test="isDelete != null">#{isDelete},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -89,6 +97,8 @@
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="siteId != null">site_id = #{siteId},</if>
|
||||
<if test="templateId != null">template_id = #{templateId},</if>
|
||||
<if test="month != null">month = #{month},</if>
|
||||
<if test="isDelete != null">isDelete = #{isDelete},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@ -107,6 +117,18 @@
|
||||
<select id="getTemplateCurve" parameterType="String" resultMap="EmsStrategyCurveResult">
|
||||
<include refid="selectEmsStrategyCurveVo"/>
|
||||
<where> template_id = #{templateId}
|
||||
and isDelete = 1
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="physicalDeleteCurve">
|
||||
update ems_strategy_curve set isDelete = 0
|
||||
where site_id = #{siteId}
|
||||
and strategy_id = #{strategyId}
|
||||
</update>
|
||||
|
||||
<update id="physicalDeleteByTemplateId">
|
||||
update ems_strategy_curve set isDelete = 0
|
||||
where template_id = #{templateId}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -16,10 +16,11 @@
|
||||
<result property="remark" column="remark" />
|
||||
<result property="siteId" column="site_id" />
|
||||
<result property="templateId" column="template_id" />
|
||||
<result property="isPost" column="isPost" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsStrategyTimeConfigVo">
|
||||
select id, strategy_id, month, charge_discharge_mode, create_by, create_time, update_by, update_time, remark, site_id, template_id from ems_strategy_time_config
|
||||
select id, strategy_id, month, charge_discharge_mode, create_by, create_time, update_by, update_time, remark, site_id, template_id, isPost from ems_strategy_time_config
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsStrategyTimeConfigList" parameterType="EmsStrategyTimeConfig" resultMap="EmsStrategyTimeConfigResult">
|
||||
@ -30,6 +31,7 @@
|
||||
<if test="chargeDischargeMode != null and chargeDischargeMode != ''"> and charge_discharge_mode = #{chargeDischargeMode}</if>
|
||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||
<if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
|
||||
<if test="isPost != null "> and isPost = #{isPost}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -51,6 +53,7 @@
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="siteId != null">site_id,</if>
|
||||
<if test="templateId != null">template_id,</if>
|
||||
<if test="isPost != null">isPost,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="strategyId != null">#{strategyId},</if>
|
||||
@ -63,6 +66,7 @@
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="siteId != null">#{siteId},</if>
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="isPost != null">#{isPost},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -79,6 +83,7 @@
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="siteId != null">site_id = #{siteId},</if>
|
||||
<if test="templateId != null">template_id = #{templateId},</if>
|
||||
<if test="isPost != null">isPost = #{isPost},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@ -99,7 +104,9 @@
|
||||
t.month,
|
||||
t.charge_discharge_mode as chargeDischargeMode,
|
||||
t.template_id as templateId,
|
||||
temp.template_name as templateName
|
||||
temp.template_name as templateName,
|
||||
t.site_id as siteId,
|
||||
t.strategy_id as strategyId
|
||||
from ems_strategy_time_config t
|
||||
LEFT JOIN ems_strategy_temp temp on t.template_id = temp.template_id
|
||||
where t.site_id = #{siteId}
|
||||
@ -114,5 +121,6 @@
|
||||
<select id="getAllTimeConfigByTempId" parameterType="String" resultMap="EmsStrategyTimeConfigResult">
|
||||
<include refid="selectEmsStrategyTimeConfigVo"/>
|
||||
where template_id = #{templateId}
|
||||
and isPost = 1
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user