策略配置-策略模板修改
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
package com.xzzn.ems.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xzzn.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
@ -11,7 +12,7 @@ import com.xzzn.common.annotation.Excel;
|
||||
* 模板对象 ems_strategy_temp
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-07-12
|
||||
* @date 2025-07-13
|
||||
*/
|
||||
public class EmsStrategyTemp extends BaseEntity
|
||||
{
|
||||
@ -40,10 +41,32 @@ public class EmsStrategyTemp extends BaseEntity
|
||||
@Excel(name = "SDC上限 (%)")
|
||||
private BigDecimal sdcUp;
|
||||
|
||||
/** 开始时间 */
|
||||
@JsonFormat(pattern = "HH:mm")
|
||||
@Excel(name = "开始时间", width = 30, dateFormat = "HH:mm")
|
||||
private Date startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@JsonFormat(pattern = "HH:mm")
|
||||
@Excel(name = "结束时间", width = 30, dateFormat = "HH:mm")
|
||||
private Date endTime;
|
||||
|
||||
/** 充放功率 (kW) */
|
||||
@Excel(name = "充放功率 (kW)")
|
||||
private BigDecimal chargeDischargePower;
|
||||
|
||||
/** 充电状态,如“1-充电”、“2-待机” */
|
||||
@Excel(name = "充电状态,如“1-充电”、“2-待机”")
|
||||
private String chargeStatus;
|
||||
|
||||
/** 站点id */
|
||||
@Excel(name = "站点id")
|
||||
private String siteId;
|
||||
|
||||
/** 模板id */
|
||||
@Excel(name = "模板id")
|
||||
private String templateId;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
@ -104,6 +127,46 @@ public class EmsStrategyTemp extends BaseEntity
|
||||
return sdcUp;
|
||||
}
|
||||
|
||||
public void setStartTime(Date startTime)
|
||||
{
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Date getStartTime()
|
||||
{
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Date endTime)
|
||||
{
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public Date getEndTime()
|
||||
{
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setChargeDischargePower(BigDecimal chargeDischargePower)
|
||||
{
|
||||
this.chargeDischargePower = chargeDischargePower;
|
||||
}
|
||||
|
||||
public BigDecimal getChargeDischargePower()
|
||||
{
|
||||
return chargeDischargePower;
|
||||
}
|
||||
|
||||
public void setChargeStatus(String chargeStatus)
|
||||
{
|
||||
this.chargeStatus = chargeStatus;
|
||||
}
|
||||
|
||||
public String getChargeStatus()
|
||||
{
|
||||
return chargeStatus;
|
||||
}
|
||||
|
||||
public void setSiteId(String siteId)
|
||||
{
|
||||
this.siteId = siteId;
|
||||
@ -114,6 +177,16 @@ public class EmsStrategyTemp extends BaseEntity
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public void setTemplateId(String templateId)
|
||||
{
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public String getTemplateId()
|
||||
{
|
||||
return templateId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@ -123,12 +196,17 @@ public class EmsStrategyTemp extends BaseEntity
|
||||
.append("sdcLimit", getSdcLimit())
|
||||
.append("sdcDown", getSdcDown())
|
||||
.append("sdcUp", getSdcUp())
|
||||
.append("startTime", getStartTime())
|
||||
.append("endTime", getEndTime())
|
||||
.append("chargeDischargePower", getChargeDischargePower())
|
||||
.append("chargeStatus", getChargeStatus())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("siteId", getSiteId())
|
||||
.append("templateId", getTemplateId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,13 +22,13 @@ public class EmsStrategyTempTimeConfig extends BaseEntity
|
||||
private Long id;
|
||||
|
||||
/** 开始时间 */
|
||||
@JsonFormat(pattern = "HH:mm:ss")
|
||||
@Excel(name = "开始时间", width = 30, dateFormat = "HH:mm:ss")
|
||||
@JsonFormat(pattern = "HH:mm")
|
||||
@Excel(name = "开始时间", width = 30, dateFormat = "HH:mm")
|
||||
private Date startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@JsonFormat(pattern = "HH:mm:ss")
|
||||
@Excel(name = "结束时间", width = 30, dateFormat = "HH:mm:ss")
|
||||
@JsonFormat(pattern = "HH:mm")
|
||||
@Excel(name = "结束时间", width = 30, dateFormat = "HH:mm")
|
||||
private Date endTime;
|
||||
|
||||
/** 充放功率 (kW) */
|
||||
|
||||
@ -15,7 +15,7 @@ public class StrategyTempConfigRequest
|
||||
{
|
||||
|
||||
/** 模板id */
|
||||
private Long id;
|
||||
private String templateId;
|
||||
/** 站点id */
|
||||
private String siteId;
|
||||
|
||||
@ -37,12 +37,12 @@ public class StrategyTempConfigRequest
|
||||
/** 模板时间 */
|
||||
private List<EmsStrategyTempTimeConfig> timeConfigList;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
public String getTemplateId() {
|
||||
return templateId;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
public void setTemplateId(String templateId) {
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public void setStrategyId(Long strategyId)
|
||||
|
||||
@ -65,6 +65,9 @@ public interface EmsStrategyTempMapper
|
||||
// 获取模板名称和id
|
||||
public List<Map<String,String>> getTempNameList(@Param("strategyId")Long strategyId, @Param("siteId")String siteId);
|
||||
|
||||
// 删除模板
|
||||
public int deleteEmsStrategyTempByIds(Long id);
|
||||
// 根据模板id获取模板所有的时间配置
|
||||
public List<EmsStrategyTemp> selectStrategyTempByTempId(String templateId);
|
||||
|
||||
// 根据模板id全部删除
|
||||
public int deleteTempByTempId(String templateId);
|
||||
}
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
package com.xzzn.ems.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xzzn.ems.domain.EmsStrategyTempTimeConfig;
|
||||
|
||||
/**
|
||||
* 模板配置Mapper接口
|
||||
*
|
||||
* @author xzzn
|
||||
* @date 2025-07-12
|
||||
*/
|
||||
public interface EmsStrategyTempTimeConfigMapper
|
||||
{
|
||||
/**
|
||||
* 查询模板配置
|
||||
*
|
||||
* @param id 模板配置主键
|
||||
* @return 模板配置
|
||||
*/
|
||||
public EmsStrategyTempTimeConfig selectEmsStrategyTempTimeConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询模板配置列表
|
||||
*
|
||||
* @param emsStrategyTempTimeConfig 模板配置
|
||||
* @return 模板配置集合
|
||||
*/
|
||||
public List<EmsStrategyTempTimeConfig> selectEmsStrategyTempTimeConfigList(EmsStrategyTempTimeConfig emsStrategyTempTimeConfig);
|
||||
|
||||
/**
|
||||
* 新增模板配置
|
||||
*
|
||||
* @param emsStrategyTempTimeConfig 模板配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmsStrategyTempTimeConfig(EmsStrategyTempTimeConfig emsStrategyTempTimeConfig);
|
||||
|
||||
/**
|
||||
* 修改模板配置
|
||||
*
|
||||
* @param emsStrategyTempTimeConfig 模板配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmsStrategyTempTimeConfig(EmsStrategyTempTimeConfig emsStrategyTempTimeConfig);
|
||||
|
||||
/**
|
||||
* 删除模板配置
|
||||
*
|
||||
* @param id 模板配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsStrategyTempTimeConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除模板配置
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsStrategyTempTimeConfigByIds(Long[] ids);
|
||||
|
||||
// 获取模板的时间
|
||||
public List<EmsStrategyTempTimeConfig> getTimeListByTempId(Long templateId);
|
||||
|
||||
// 根据模板id删除时间配置
|
||||
public void deleteTimeConfigByTempId(Long templateId);
|
||||
}
|
||||
@ -5,7 +5,6 @@ import java.util.Map;
|
||||
|
||||
import com.xzzn.ems.domain.EmsStrategyTemp;
|
||||
import com.xzzn.ems.domain.vo.StrategyTempConfigRequest;
|
||||
import com.xzzn.ems.domain.vo.StrategyTempTimeConfigVo;
|
||||
|
||||
/**
|
||||
* 模板Service接口
|
||||
@ -15,13 +14,6 @@ import com.xzzn.ems.domain.vo.StrategyTempTimeConfigVo;
|
||||
*/
|
||||
public interface IEmsStrategyTempService
|
||||
{
|
||||
|
||||
// 获取该模板下的时间配置
|
||||
public List<StrategyTempTimeConfigVo> selectEmsStrategyTempList(Long id);
|
||||
|
||||
// 新增模板及时间配置
|
||||
public boolean addNewTempAndTimeConfig(StrategyTempConfigRequest requestVo);
|
||||
|
||||
/**
|
||||
* 修改模板
|
||||
*
|
||||
@ -30,23 +22,14 @@ public interface IEmsStrategyTempService
|
||||
*/
|
||||
public boolean updateEmsStrategyTemp(StrategyTempConfigRequest requestVo);
|
||||
|
||||
/**
|
||||
* 批量删除模板
|
||||
*
|
||||
* @param ids 需要删除的模板主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsStrategyTempByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除模板信息
|
||||
*
|
||||
* @param id 模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsStrategyTempById(Long id);
|
||||
|
||||
public List<Map<String,String>> getTempNameList(Long strategyId, String siteId);
|
||||
|
||||
public void deleteStrategyTempById(Long id);
|
||||
// 获取该模板下的时间配置
|
||||
public List<EmsStrategyTemp> selectEmsStrategyTempList(String templateId);
|
||||
|
||||
// 新增模板及时间配置
|
||||
public boolean addNewTempAndTimeConfig(StrategyTempConfigRequest requestVo);
|
||||
|
||||
//根据templateId删除模板
|
||||
public int deleteStrategyTempById(String templateId);
|
||||
}
|
||||
|
||||
@ -1,15 +1,13 @@
|
||||
package com.xzzn.ems.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.xzzn.common.utils.DateUtils;
|
||||
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.domain.vo.StrategyTempTimeConfigVo;
|
||||
import com.xzzn.ems.mapper.EmsStrategyTempTimeConfigMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xzzn.ems.mapper.EmsStrategyTempMapper;
|
||||
@ -26,10 +24,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Service
|
||||
public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
|
||||
{
|
||||
private static final String PREFIX= "Temp";
|
||||
@Autowired
|
||||
private EmsStrategyTempMapper emsStrategyTempMapper;
|
||||
@Autowired
|
||||
private EmsStrategyTempTimeConfigMapper emsStrategyTempTimeConfigMapper;
|
||||
|
||||
/**
|
||||
* 查询模板列表
|
||||
@ -38,26 +35,42 @@ public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
|
||||
* @return 模板
|
||||
*/
|
||||
@Override
|
||||
public List<StrategyTempTimeConfigVo> selectEmsStrategyTempList(Long templateId)
|
||||
public List<EmsStrategyTemp> selectEmsStrategyTempList(String templateId)
|
||||
{
|
||||
List<StrategyTempTimeConfigVo> dataList = new ArrayList<>();
|
||||
EmsStrategyTemp temp = emsStrategyTempMapper.selectEmsStrategyTempById(templateId);
|
||||
if (temp != null) {
|
||||
List<EmsStrategyTempTimeConfig> timeList = emsStrategyTempTimeConfigMapper.getTimeListByTempId(templateId);
|
||||
if (timeList != null && !timeList.isEmpty()) {
|
||||
for (EmsStrategyTempTimeConfig timeConfig : timeList) {
|
||||
StrategyTempTimeConfigVo vo = new StrategyTempTimeConfigVo();
|
||||
BeanUtils.copyProperties(timeConfig, vo);
|
||||
BeanUtils.copyProperties(temp, vo);
|
||||
dataList.add(vo);
|
||||
}
|
||||
} else {
|
||||
StrategyTempTimeConfigVo vo = new StrategyTempTimeConfigVo();
|
||||
BeanUtils.copyProperties(temp, vo);
|
||||
dataList.add(vo);
|
||||
}
|
||||
return emsStrategyTempMapper.selectStrategyTempByTempId(templateId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增模板和时间配置
|
||||
* @param requestVo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean addNewTempAndTimeConfig(StrategyTempConfigRequest requestVo) {
|
||||
// 随机生产模板id格式:Temp+时间戳
|
||||
String templateId = requestVo.getTemplateId();
|
||||
if (StringUtils.isEmpty(templateId)) {
|
||||
templateId = PREFIX + DateUtils.dateTimeNow();
|
||||
}
|
||||
return dataList;
|
||||
|
||||
EmsStrategyTemp publicTemp = new EmsStrategyTemp();
|
||||
BeanUtils.copyProperties(requestVo, publicTemp);
|
||||
publicTemp.setTemplateId(templateId);
|
||||
publicTemp.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
List<EmsStrategyTempTimeConfig> timeList = requestVo.getTimeConfigList();
|
||||
if (timeList != null && !timeList.isEmpty()) {
|
||||
for (EmsStrategyTempTimeConfig timeConfig : timeList) {
|
||||
EmsStrategyTemp temp = new EmsStrategyTemp();
|
||||
BeanUtils.copyProperties(publicTemp, temp);
|
||||
BeanUtils.copyProperties(timeConfig, temp);
|
||||
emsStrategyTempMapper.insertEmsStrategyTemp(temp);
|
||||
}
|
||||
} else {// 无时间配置只配置模板基本信息
|
||||
emsStrategyTempMapper.insertEmsStrategyTemp(publicTemp);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,88 +83,25 @@ public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateEmsStrategyTemp(StrategyTempConfigRequest requestVo)
|
||||
{
|
||||
Long id = requestVo.getId();
|
||||
// 根据模板id校验该模板是否存在
|
||||
EmsStrategyTemp temp = emsStrategyTempMapper.selectEmsStrategyTempById(id);
|
||||
if (temp == null) {
|
||||
return false;
|
||||
}
|
||||
// 更新模板数据
|
||||
BeanUtils.copyProperties(requestVo, temp);
|
||||
emsStrategyTempMapper.updateEmsStrategyTemp(temp);
|
||||
String templateId = requestVo.getTemplateId();
|
||||
// 无发匹配原数据
|
||||
// 全删
|
||||
emsStrategyTempMapper.deleteTempByTempId(templateId);
|
||||
|
||||
// 先删除再加
|
||||
emsStrategyTempTimeConfigMapper.deleteTimeConfigByTempId(id);
|
||||
|
||||
List<EmsStrategyTempTimeConfig> timeList = requestVo.getTimeConfigList();
|
||||
if (timeList != null) {
|
||||
for (EmsStrategyTempTimeConfig timeConfig : timeList) {
|
||||
timeConfig.setTemplateId(id);
|
||||
timeConfig.setCreateTime(DateUtils.getNowDate());
|
||||
timeConfig.setUpdateTime(DateUtils.getNowDate());
|
||||
emsStrategyTempTimeConfigMapper.insertEmsStrategyTempTimeConfig(timeConfig);
|
||||
}
|
||||
}
|
||||
// 重新新增
|
||||
addNewTempAndTimeConfig(requestVo);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除模板
|
||||
*
|
||||
* @param ids 需要删除的模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEmsStrategyTempByIds(Long[] ids)
|
||||
{
|
||||
return emsStrategyTempMapper.deleteEmsStrategyTempByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模板信息
|
||||
*
|
||||
* @param id 模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEmsStrategyTempById(Long id)
|
||||
{
|
||||
return emsStrategyTempMapper.deleteEmsStrategyTempById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String,String>> getTempNameList(Long strategyId, String siteId) {
|
||||
return emsStrategyTempMapper.getTempNameList(strategyId, siteId);
|
||||
}
|
||||
|
||||
// 新增模板和时间配置
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean addNewTempAndTimeConfig(StrategyTempConfigRequest requestVo) {
|
||||
EmsStrategyTemp emsStrategyTemp = new EmsStrategyTemp();
|
||||
BeanUtils.copyProperties(requestVo, emsStrategyTemp);
|
||||
emsStrategyTemp.setCreateTime(DateUtils.getNowDate());
|
||||
emsStrategyTempMapper.insertEmsStrategyTemp(emsStrategyTemp);
|
||||
|
||||
List<EmsStrategyTempTimeConfig> timeList = requestVo.getTimeConfigList();
|
||||
if (timeList != null) {
|
||||
for (EmsStrategyTempTimeConfig timeConfig : timeList) {
|
||||
timeConfig.setCreateTime(DateUtils.getNowDate());
|
||||
timeConfig.setTemplateId(emsStrategyTemp.getId());
|
||||
emsStrategyTempTimeConfigMapper.insertEmsStrategyTempTimeConfig(timeConfig);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteStrategyTempById(Long id) {
|
||||
// 先删除时间配置
|
||||
emsStrategyTempTimeConfigMapper.deleteTimeConfigByTempId(id);
|
||||
|
||||
// 再删除模板
|
||||
emsStrategyTempMapper.deleteEmsStrategyTempById(id);
|
||||
public int deleteStrategyTempById(String templateId) {
|
||||
return emsStrategyTempMapper.deleteTempByTempId(templateId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,16 +11,21 @@
|
||||
<result property="sdcLimit" column="sdc_limit" />
|
||||
<result property="sdcDown" column="sdc_down" />
|
||||
<result property="sdcUp" column="sdc_up" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="chargeDischargePower" column="charge_discharge_power" />
|
||||
<result property="chargeStatus" column="charge_status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="siteId" column="site_id" />
|
||||
<result property="templateId" column="template_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsStrategyTempVo">
|
||||
select id, strategy_id, template_name, sdc_limit, sdc_down, sdc_up, create_by, create_time, update_by, update_time, remark, site_id from ems_strategy_temp
|
||||
select id, strategy_id, template_name, sdc_limit, sdc_down, sdc_up, start_time, end_time, charge_discharge_power, charge_status, create_by, create_time, update_by, update_time, remark, site_id, template_id from ems_strategy_temp
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsStrategyTempList" parameterType="EmsStrategyTemp" resultMap="EmsStrategyTempResult">
|
||||
@ -31,7 +36,12 @@
|
||||
<if test="sdcLimit != null "> and sdc_limit = #{sdcLimit}</if>
|
||||
<if test="sdcDown != null "> and sdc_down = #{sdcDown}</if>
|
||||
<if test="sdcUp != null "> and sdc_up = #{sdcUp}</if>
|
||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="chargeDischargePower != null "> and charge_discharge_power = #{chargeDischargePower}</if>
|
||||
<if test="chargeStatus != null and chargeStatus != ''"> and charge_status = #{chargeStatus}</if>
|
||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||
<if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -48,12 +58,17 @@
|
||||
<if test="sdcLimit != null">sdc_limit,</if>
|
||||
<if test="sdcDown != null">sdc_down,</if>
|
||||
<if test="sdcUp != null">sdc_up,</if>
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="endTime != null">end_time,</if>
|
||||
<if test="chargeDischargePower != null">charge_discharge_power,</if>
|
||||
<if test="chargeStatus != null">charge_status,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="siteId != null">site_id,</if>
|
||||
<if test="templateId != null">template_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="strategyId != null">#{strategyId},</if>
|
||||
@ -61,12 +76,17 @@
|
||||
<if test="sdcLimit != null">#{sdcLimit},</if>
|
||||
<if test="sdcDown != null">#{sdcDown},</if>
|
||||
<if test="sdcUp != null">#{sdcUp},</if>
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="endTime != null">#{endTime},</if>
|
||||
<if test="chargeDischargePower != null">#{chargeDischargePower},</if>
|
||||
<if test="chargeStatus != null">#{chargeStatus},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="siteId != null">#{siteId},</if>
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -78,12 +98,17 @@
|
||||
<if test="sdcLimit != null">sdc_limit = #{sdcLimit},</if>
|
||||
<if test="sdcDown != null">sdc_down = #{sdcDown},</if>
|
||||
<if test="sdcUp != null">sdc_up = #{sdcUp},</if>
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
<if test="chargeDischargePower != null">charge_discharge_power = #{chargeDischargePower},</if>
|
||||
<if test="chargeStatus != null">charge_status = #{chargeStatus},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="siteId != null">site_id = #{siteId},</if>
|
||||
<if test="templateId != null">template_id = #{templateId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@ -100,7 +125,7 @@
|
||||
</delete>
|
||||
|
||||
<select id="getTempNameList" resultType="Map">
|
||||
select DISTINCT id as templateId,template_name as templateName
|
||||
select DISTINCT template_id as templateId,template_name as templateName
|
||||
from ems_strategy_temp
|
||||
where site_id = #{siteId}
|
||||
and strategy_id = #{strategyId}
|
||||
@ -109,4 +134,13 @@
|
||||
<select id="getStrategyTempByTempId" parameterType="String" resultType="int">
|
||||
select count(1) from ems_strategy_temp where template_id = #{templateId}
|
||||
</select>
|
||||
|
||||
<select id="selectStrategyTempByTempId" parameterType="String" resultMap="EmsStrategyTempResult">
|
||||
<include refid="selectEmsStrategyTempVo"/>
|
||||
where template_id = #{templateId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteTempByTempId" parameterType="String">
|
||||
delete from ems_strategy_temp where template_id = #{templateId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -1,105 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xzzn.ems.mapper.EmsStrategyTempTimeConfigMapper">
|
||||
|
||||
<resultMap type="EmsStrategyTempTimeConfig" id="EmsStrategyTempTimeConfigResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="chargeDischargePower" column="charge_discharge_power" />
|
||||
<result property="chargeStatus" column="charge_status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="templateId" column="template_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsStrategyTempTimeConfigVo">
|
||||
select id, start_time, end_time, charge_discharge_power, charge_status, create_by, create_time, update_by, update_time, remark, template_id from ems_strategy_temp_time_config
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsStrategyTempTimeConfigList" parameterType="EmsStrategyTempTimeConfig" resultMap="EmsStrategyTempTimeConfigResult">
|
||||
<include refid="selectEmsStrategyTempTimeConfigVo"/>
|
||||
<where>
|
||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="chargeDischargePower != null "> and charge_discharge_power = #{chargeDischargePower}</if>
|
||||
<if test="chargeStatus != null and chargeStatus != ''"> and charge_status = #{chargeStatus}</if>
|
||||
<if test="templateId != null "> and template_id = #{templateId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEmsStrategyTempTimeConfigById" parameterType="Long" resultMap="EmsStrategyTempTimeConfigResult">
|
||||
<include refid="selectEmsStrategyTempTimeConfigVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEmsStrategyTempTimeConfig" parameterType="EmsStrategyTempTimeConfig" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ems_strategy_temp_time_config
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="endTime != null">end_time,</if>
|
||||
<if test="chargeDischargePower != null">charge_discharge_power,</if>
|
||||
<if test="chargeStatus != null">charge_status,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="templateId != null">template_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="endTime != null">#{endTime},</if>
|
||||
<if test="chargeDischargePower != null">#{chargeDischargePower},</if>
|
||||
<if test="chargeStatus != null">#{chargeStatus},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEmsStrategyTempTimeConfig" parameterType="EmsStrategyTempTimeConfig">
|
||||
update ems_strategy_temp_time_config
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
<if test="chargeDischargePower != null">charge_discharge_power = #{chargeDischargePower},</if>
|
||||
<if test="chargeStatus != null">charge_status = #{chargeStatus},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="templateId != null">template_id = #{templateId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEmsStrategyTempTimeConfigById" parameterType="Long">
|
||||
delete from ems_strategy_temp_time_config where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmsStrategyTempTimeConfigByIds" parameterType="String">
|
||||
delete from ems_strategy_temp_time_config where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getTimeListByTempId" parameterType="Long" resultMap="EmsStrategyTempTimeConfigResult">
|
||||
<include refid="selectEmsStrategyTempTimeConfigVo"/>
|
||||
where template_id = #{templateId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteTimeConfigByTempId" parameterType="Long">
|
||||
delete from ems_strategy_temp_time_config where template_id = #{templateId}
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user