lv.wenbin 9 months ago
parent
commit
c52a07e3dd

+ 21 - 36
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/OpEnergyStrategyController.java

@@ -1,27 +1,25 @@
 package com.ruoyi.ems.controller;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.common.core.web.page.TableDataInfo;
+import com.ruoyi.common.log.annotation.Log;
+import com.ruoyi.common.log.enums.BusinessType;
+import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.ruoyi.ems.domain.OpEnergyStrategy;
+import com.ruoyi.ems.service.IOpEnergyStrategyService;
 import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.log.annotation.Log;
-import com.ruoyi.common.log.enums.BusinessType;
-import com.ruoyi.common.security.annotation.RequiresPermissions;
-import com.ruoyi.ems.domain.OpEnergyStrategy;
-import com.ruoyi.ems.service.IOpEnergyStrategyService;
-import com.ruoyi.common.core.web.controller.BaseController;
-import com.ruoyi.common.core.web.domain.AjaxResult;
-import com.ruoyi.common.core.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.web.page.TableDataInfo;
+
+import java.util.List;
 
 /**
  * 能源策略Controller
@@ -35,41 +33,28 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
 public class OpEnergyStrategyController extends BaseController
 {
     @Autowired
-    private IOpEnergyStrategyService admOpEnergyStrategyService;
+    private IOpEnergyStrategyService strategyService;
 
     /**
      * 查询能源策略列表
      */
     @RequiresPermissions("power-mgr:strategy:list")
     @GetMapping("/list")
-    public TableDataInfo list(OpEnergyStrategy admOpEnergyStrategy)
+    public TableDataInfo list(OpEnergyStrategy strategy)
     {
         startPage();
-        List<OpEnergyStrategy> list = admOpEnergyStrategyService.selectOpEnergyStrategyList(admOpEnergyStrategy);
+        List<OpEnergyStrategy> list = strategyService.selectStrategyList(strategy);
         return getDataTable(list);
     }
 
     /**
-     * 导出能源策略列表
-     */
-    @RequiresPermissions("power-mgr:strategy:export")
-    @Log(title = "能源策略", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, OpEnergyStrategy admOpEnergyStrategy)
-    {
-        List<OpEnergyStrategy> list = admOpEnergyStrategyService.selectOpEnergyStrategyList(admOpEnergyStrategy);
-        ExcelUtil<OpEnergyStrategy> util = new ExcelUtil<OpEnergyStrategy>(OpEnergyStrategy.class);
-        util.exportExcel(response, list, "能源策略数据");
-    }
-
-    /**
      * 获取能源策略详细信息
      */
     @RequiresPermissions("power-mgr:strategy:query")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id)
     {
-        return success(admOpEnergyStrategyService.selectOpEnergyStrategyById(id));
+        return success(strategyService.selectStrategyById(id));
     }
 
     /**
@@ -78,9 +63,9 @@ public class OpEnergyStrategyController extends BaseController
     @RequiresPermissions("power-mgr:strategy:add")
     @Log(title = "能源策略", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody OpEnergyStrategy admOpEnergyStrategy)
+    public AjaxResult add(@RequestBody OpEnergyStrategy strategy)
     {
-        return toAjax(admOpEnergyStrategyService.insertOpEnergyStrategy(admOpEnergyStrategy));
+        return toAjax(strategyService.insertStrategy(strategy));
     }
 
     /**
@@ -89,9 +74,9 @@ public class OpEnergyStrategyController extends BaseController
     @RequiresPermissions("power-mgr:strategy:edit")
     @Log(title = "能源策略", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody OpEnergyStrategy admOpEnergyStrategy)
+    public AjaxResult edit(@RequestBody OpEnergyStrategy strategy)
     {
-        return toAjax(admOpEnergyStrategyService.updateOpEnergyStrategy(admOpEnergyStrategy));
+        return toAjax(strategyService.updateStrategy(strategy));
     }
 
     /**
@@ -102,6 +87,6 @@ public class OpEnergyStrategyController extends BaseController
 	@DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids)
     {
-        return toAjax(admOpEnergyStrategyService.deleteOpEnergyStrategyByIds(ids));
+        return toAjax(strategyService.deleteStrategyByIds(ids));
     }
 }

+ 52 - 56
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/OpEnergyStrategy.java

@@ -1,9 +1,8 @@
 package com.ruoyi.ems.domain;
 
+import com.ruoyi.common.core.web.domain.BaseEntity;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
-import com.ruoyi.common.core.annotation.Excel;
-import com.ruoyi.common.core.web.domain.BaseEntity;
 
 /**
  * 能源策略对象 adm_op_energy_strategy
@@ -18,118 +17,115 @@ public class OpEnergyStrategy extends BaseEntity
     /** 序号 */
     private Long id;
 
+    /** 区域代码 */
+    private String areaCode;
+
     /** 策略代码 */
-    @Excel(name = "策略代码")
     private String strategyCode;
 
     /** 策略名称 */
-    @Excel(name = "策略名称")
+
     private String strategyName;
 
     /** 策略描述 */
-    @Excel(name = "策略描述")
     private String strategyDesc;
 
-    /** 1:源网协调,2:源荷互动 */
-    @Excel(name = "1:源网协调,2:源荷互动")
+    /** 策略类型 */
     private Integer strategyType;
 
-    /** 0:固定策略 1:规则引擎 2:定时执行(cron)99:手动执行 */
-    @Excel(name = "0:固定策略 1:规则引擎 2:定时执行", readConverterExp = "c=ron")
+    /** 策略状态 */
+    private Integer strategyState;
+
+    /** 执行模式 1:定时执行(cron)99:手动执行 */
     private Integer execMode;
 
     /** 执行规则 */
-    @Excel(name = "执行规则")
     private String execRule;
 
-    /** 允许修改标记 */
-    @Excel(name = "允许修改标记")
-    private Integer allowModify;
+    public Long getId() {
+        return id;
+    }
 
-    public void setId(Long id)
-    {
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public Long getId()
-    {
-        return id;
+    public String getAreaCode() {
+        return areaCode;
     }
-    public void setStrategyCode(String strategyCode)
-    {
-        this.strategyCode = strategyCode;
+
+    public void setAreaCode(String areaCode) {
+        this.areaCode = areaCode;
     }
 
-    public String getStrategyCode()
-    {
+    public String getStrategyCode() {
         return strategyCode;
     }
-    public void setStrategyName(String strategyName)
-    {
-        this.strategyName = strategyName;
+
+    public void setStrategyCode(String strategyCode) {
+        this.strategyCode = strategyCode;
     }
 
-    public String getStrategyName()
-    {
+    public String getStrategyName() {
         return strategyName;
     }
-    public void setStrategyDesc(String strategyDesc)
-    {
-        this.strategyDesc = strategyDesc;
+
+    public void setStrategyName(String strategyName) {
+        this.strategyName = strategyName;
     }
 
-    public String getStrategyDesc()
-    {
+    public String getStrategyDesc() {
         return strategyDesc;
     }
-    public void setStrategyType(Integer strategyType)
-    {
-        this.strategyType = strategyType;
+
+    public void setStrategyDesc(String strategyDesc) {
+        this.strategyDesc = strategyDesc;
     }
 
-    public Integer getStrategyType()
-    {
+    public Integer getStrategyType() {
         return strategyType;
     }
-    public void setExecMode(Integer execMode)
-    {
-        this.execMode = execMode;
+
+    public void setStrategyType(Integer strategyType) {
+        this.strategyType = strategyType;
+    }
+
+    public Integer getStrategyState() {
+        return strategyState;
     }
 
-    public Integer getExecMode()
-    {
+    public void setStrategyState(Integer strategyState) {
+        this.strategyState = strategyState;
+    }
+
+    public Integer getExecMode() {
         return execMode;
     }
-    public void setExecRule(String execRule)
-    {
-        this.execRule = execRule;
+
+    public void setExecMode(Integer execMode) {
+        this.execMode = execMode;
     }
 
-    public String getExecRule()
-    {
+    public String getExecRule() {
         return execRule;
     }
-    public void setAllowModify(Integer allowModify)
-    {
-        this.allowModify = allowModify;
-    }
 
-    public Integer getAllowModify()
-    {
-        return allowModify;
+    public void setExecRule(String execRule) {
+        this.execRule = execRule;
     }
 
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
             .append("id", getId())
+            .append("areaCode", getAreaCode())
             .append("strategyCode", getStrategyCode())
             .append("strategyName", getStrategyName())
             .append("strategyDesc", getStrategyDesc())
             .append("strategyType", getStrategyType())
+            .append("strategyState", getStrategyState())
             .append("execMode", getExecMode())
             .append("execRule", getExecRule())
-            .append("allowModify", getAllowModify())
             .append("createTime", getCreateTime())
             .append("updateTime", getUpdateTime())
             .toString();

+ 9 - 9
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/OpEnergyStrategyMapper.java

@@ -17,31 +17,31 @@ public interface OpEnergyStrategyMapper
      * @param id 能源策略主键
      * @return 能源策略
      */
-     OpEnergyStrategy selectOpEnergyStrategyById(Long id);
+     OpEnergyStrategy selectStrategyById(Long id);
 
     /**
      * 查询能源策略列表
      * 
-     * @param opEnergyStrategy 能源策略
+     * @param strategy 能源策略
      * @return 能源策略集合
      */
-     List<OpEnergyStrategy> selectOpEnergyStrategyList(OpEnergyStrategy opEnergyStrategy);
+     List<OpEnergyStrategy> selectStrategyList(OpEnergyStrategy strategy);
 
     /**
      * 新增能源策略
      * 
-     * @param opEnergyStrategy 能源策略
+     * @param strategy 能源策略
      * @return 结果
      */
-     int insertOpEnergyStrategy(OpEnergyStrategy opEnergyStrategy);
+     int insertStrategy(OpEnergyStrategy strategy);
 
     /**
      * 修改能源策略
      * 
-     * @param opEnergyStrategy 能源策略
+     * @param strategy 能源策略
      * @return 结果
      */
-     int updateOpEnergyStrategy(OpEnergyStrategy opEnergyStrategy);
+     int updateStrategy(OpEnergyStrategy strategy);
 
     /**
      * 删除能源策略
@@ -49,7 +49,7 @@ public interface OpEnergyStrategyMapper
      * @param id 能源策略主键
      * @return 结果
      */
-     int deleteOpEnergyStrategyById(Long id);
+     int deleteStrategyById(Long id);
 
     /**
      * 批量删除能源策略
@@ -57,5 +57,5 @@ public interface OpEnergyStrategyMapper
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-     int deleteOpEnergyStrategyByIds(Long[] ids);
+     int deleteStrategyByIds(Long[] ids);
 }

+ 6 - 6
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IOpEnergyStrategyService.java

@@ -17,7 +17,7 @@ public interface IOpEnergyStrategyService
      * @param id 能源策略主键
      * @return 能源策略
      */
-     OpEnergyStrategy selectOpEnergyStrategyById(Long id);
+     OpEnergyStrategy selectStrategyById(Long id);
 
     /**
      * 查询能源策略列表
@@ -25,7 +25,7 @@ public interface IOpEnergyStrategyService
      * @param opEnergyStrategy 能源策略
      * @return 能源策略集合
      */
-     List<OpEnergyStrategy> selectOpEnergyStrategyList(OpEnergyStrategy opEnergyStrategy);
+     List<OpEnergyStrategy> selectStrategyList(OpEnergyStrategy opEnergyStrategy);
 
     /**
      * 新增能源策略
@@ -33,7 +33,7 @@ public interface IOpEnergyStrategyService
      * @param opEnergyStrategy 能源策略
      * @return 结果
      */
-     int insertOpEnergyStrategy(OpEnergyStrategy opEnergyStrategy);
+     int insertStrategy(OpEnergyStrategy opEnergyStrategy);
 
     /**
      * 修改能源策略
@@ -41,7 +41,7 @@ public interface IOpEnergyStrategyService
      * @param opEnergyStrategy 能源策略
      * @return 结果
      */
-     int updateOpEnergyStrategy(OpEnergyStrategy opEnergyStrategy);
+     int updateStrategy(OpEnergyStrategy opEnergyStrategy);
 
     /**
      * 批量删除能源策略
@@ -49,7 +49,7 @@ public interface IOpEnergyStrategyService
      * @param ids 需要删除的能源策略主键集合
      * @return 结果
      */
-     int deleteOpEnergyStrategyByIds(Long[] ids);
+     int deleteStrategyByIds(Long[] ids);
 
     /**
      * 删除能源策略信息
@@ -57,5 +57,5 @@ public interface IOpEnergyStrategyService
      * @param id 能源策略主键
      * @return 结果
      */
-     int deleteOpEnergyStrategyById(Long id);
+     int deleteStrategyById(Long id);
 }

+ 18 - 20
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/OpEnergyStrategyServiceImpl.java

@@ -1,12 +1,12 @@
 package com.ruoyi.ems.service.impl;
 
-import java.util.List;
-import com.ruoyi.common.core.utils.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.ems.mapper.OpEnergyStrategyMapper;
 import com.ruoyi.ems.domain.OpEnergyStrategy;
+import com.ruoyi.ems.mapper.OpEnergyStrategyMapper;
 import com.ruoyi.ems.service.IOpEnergyStrategyService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
 
 /**
  * 能源策略Service业务层处理
@@ -18,7 +18,7 @@ import com.ruoyi.ems.service.IOpEnergyStrategyService;
 public class OpEnergyStrategyServiceImpl implements IOpEnergyStrategyService
 {
     @Autowired
-    private OpEnergyStrategyMapper opEnergyStrategyMapper;
+    private OpEnergyStrategyMapper strategyMapper;
 
     /**
      * 查询能源策略
@@ -27,9 +27,9 @@ public class OpEnergyStrategyServiceImpl implements IOpEnergyStrategyService
      * @return 能源策略
      */
     @Override
-    public OpEnergyStrategy selectOpEnergyStrategyById(Long id)
+    public OpEnergyStrategy selectStrategyById(Long id)
     {
-        return opEnergyStrategyMapper.selectOpEnergyStrategyById(id);
+        return strategyMapper.selectStrategyById(id);
     }
 
     /**
@@ -39,9 +39,9 @@ public class OpEnergyStrategyServiceImpl implements IOpEnergyStrategyService
      * @return 能源策略
      */
     @Override
-    public List<OpEnergyStrategy> selectOpEnergyStrategyList(OpEnergyStrategy admOpEnergyStrategy)
+    public List<OpEnergyStrategy> selectStrategyList(OpEnergyStrategy admOpEnergyStrategy)
     {
-        return opEnergyStrategyMapper.selectOpEnergyStrategyList(admOpEnergyStrategy);
+        return strategyMapper.selectStrategyList(admOpEnergyStrategy);
     }
 
     /**
@@ -51,10 +51,9 @@ public class OpEnergyStrategyServiceImpl implements IOpEnergyStrategyService
      * @return 结果
      */
     @Override
-    public int insertOpEnergyStrategy(OpEnergyStrategy admOpEnergyStrategy)
+    public int insertStrategy(OpEnergyStrategy admOpEnergyStrategy)
     {
-        admOpEnergyStrategy.setCreateTime(DateUtils.getNowDate());
-        return opEnergyStrategyMapper.insertOpEnergyStrategy(admOpEnergyStrategy);
+        return strategyMapper.insertStrategy(admOpEnergyStrategy);
     }
 
     /**
@@ -64,10 +63,9 @@ public class OpEnergyStrategyServiceImpl implements IOpEnergyStrategyService
      * @return 结果
      */
     @Override
-    public int updateOpEnergyStrategy(OpEnergyStrategy admOpEnergyStrategy)
+    public int updateStrategy(OpEnergyStrategy admOpEnergyStrategy)
     {
-        admOpEnergyStrategy.setUpdateTime(DateUtils.getNowDate());
-        return opEnergyStrategyMapper.updateOpEnergyStrategy(admOpEnergyStrategy);
+        return strategyMapper.updateStrategy(admOpEnergyStrategy);
     }
 
     /**
@@ -77,9 +75,9 @@ public class OpEnergyStrategyServiceImpl implements IOpEnergyStrategyService
      * @return 结果
      */
     @Override
-    public int deleteOpEnergyStrategyByIds(Long[] ids)
+    public int deleteStrategyByIds(Long[] ids)
     {
-        return opEnergyStrategyMapper.deleteOpEnergyStrategyByIds(ids);
+        return strategyMapper.deleteStrategyByIds(ids);
     }
 
     /**
@@ -89,8 +87,8 @@ public class OpEnergyStrategyServiceImpl implements IOpEnergyStrategyService
      * @return 结果
      */
     @Override
-    public int deleteOpEnergyStrategyById(Long id)
+    public int deleteStrategyById(Long id)
     {
-        return opEnergyStrategyMapper.deleteOpEnergyStrategyById(id);
+        return strategyMapper.deleteStrategyById(id);
     }
 }

+ 1 - 1
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecUseHMapper.xml

@@ -164,7 +164,7 @@
             and u.obj_type = 1
             <if test="objCode != null and objCode != ''">and f.facs_code = #{objCode}</if>
             <if test="areaCode != null and areaCode != '' and areaCode != '-1'">and u.area_code = #{areaCode}</if>
-            <if test="startRecTime != null  and startRecTime != '' and endRecTime != null and endRecTime !=''">
+            <if test="startRecTime != null and startRecTime != '' and endRecTime != null and endRecTime !=''">
                 and u.record_time &gt;= #{startRecTime} and u.record_time &lt;= #{endRecTime}
             </if>
         </where>

+ 25 - 30
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/OpEnergyStrategyMapper.xml

@@ -4,88 +4,83 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.ems.mapper.OpEnergyStrategyMapper">
 
-    <resultMap type="com.ruoyi.ems.domain.OpEnergyStrategy" id="OpEnergyStrategyResult">
+    <resultMap type="com.ruoyi.ems.domain.OpEnergyStrategy" id="StrategyResult">
         <result property="id"    column="id"    />
+        <result property="areaCode"        column="area_code"    />
         <result property="strategyCode"    column="strategy_code"    />
         <result property="strategyName"    column="strategy_name"    />
         <result property="strategyDesc"    column="strategy_desc"    />
         <result property="strategyType"    column="strategy_type"    />
-        <result property="execMode"    column="exec_mode"    />
-        <result property="execRule"    column="exec_rule"    />
-        <result property="allowModify"    column="allow_modify"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateTime"    column="update_time"    />
+        <result property="strategyState"   column="strategy_state"    />
+        <result property="execMode"        column="exec_mode"    />
+        <result property="execRule"        column="exec_rule"    />
     </resultMap>
 
-    <sql id="selectOpEnergyStrategyVo">
-        select id, strategy_code, strategy_name, strategy_desc, strategy_type, exec_mode, exec_rule, allow_modify, create_time, update_time from adm_op_energy_strategy
+    <sql id="selectStrategyVo">
+        select s.id, s.area_code, s.strategy_code, s.strategy_name, s.strategy_desc, s.strategy_type, s.strategy_state, s.exec_mode, s.exec_rule from adm_op_energy_strategy s
     </sql>
 
-    <select id="selectOpEnergyStrategyList" parameterType="com.ruoyi.ems.domain.OpEnergyStrategy" resultMap="OpEnergyStrategyResult">
-        <include refid="selectOpEnergyStrategyVo"/>
+    <select id="selectStrategyList" parameterType="com.ruoyi.ems.domain.OpEnergyStrategy" resultMap="StrategyResult">
+        <include refid="selectStrategyVo"/>
         <where>
-            <if test="strategyCode != null  and strategyCode != ''"> and strategy_code = #{strategyCode}</if>
-            <if test="strategyName != null  and strategyName != ''"> and strategy_name like concat('%', #{strategyName}, '%')</if>
-            <if test="strategyDesc != null  and strategyDesc != ''"> and strategy_desc = #{strategyDesc}</if>
+            <if test="areaCode != null and areaCode != '' and areaCode != '-1'"> and area_code = #{areaCode}</if>
+            <if test="strategyCode != null and strategyCode != ''"> and strategy_code = #{strategyCode}</if>
             <if test="strategyType != null "> and strategy_type = #{strategyType}</if>
             <if test="execMode != null "> and exec_mode = #{execMode}</if>
-            <if test="execRule != null  and execRule != ''"> and exec_rule = #{execRule}</if>
-            <if test="allowModify != null "> and allow_modify = #{allowModify}</if>
+            <if test="strategyName != null  and strategyName != ''"> and strategy_name like concat('%', #{strategyName}, '%')</if>
         </where>
     </select>
 
-    <select id="selectOpEnergyStrategyById" parameterType="Long" resultMap="OpEnergyStrategyResult">
-        <include refid="selectOpEnergyStrategyVo"/>
+    <select id="selectStrategyById" parameterType="Long" resultMap="StrategyResult">
+        <include refid="selectStrategyVo"/>
         where id = #{id}
     </select>
 
-    <insert id="insertOpEnergyStrategy" parameterType="com.ruoyi.ems.domain.OpEnergyStrategy" useGeneratedKeys="true" keyProperty="id">
+    <insert id="insertStrategy" parameterType="com.ruoyi.ems.domain.OpEnergyStrategy" useGeneratedKeys="true" keyProperty="id">
         insert into adm_op_energy_strategy
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">area_code,</if>
             <if test="strategyCode != null and strategyCode != ''">strategy_code,</if>
             <if test="strategyName != null and strategyName != ''">strategy_name,</if>
             <if test="strategyDesc != null">strategy_desc,</if>
             <if test="strategyType != null">strategy_type,</if>
+            <if test="strategyState != null">strategy_state,</if>
             <if test="execMode != null">exec_mode,</if>
             <if test="execRule != null">exec_rule,</if>
-            <if test="allowModify != null">allow_modify,</if>
-            <if test="createTime != null">create_time,</if>
-            <if test="updateTime != null">update_time,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
             <if test="strategyCode != null and strategyCode != ''">#{strategyCode},</if>
             <if test="strategyName != null and strategyName != ''">#{strategyName},</if>
             <if test="strategyDesc != null">#{strategyDesc},</if>
             <if test="strategyType != null">#{strategyType},</if>
+            <if test="strategyState != null">#{strategyState},</if>
             <if test="execMode != null">#{execMode},</if>
             <if test="execRule != null">#{execRule},</if>
-            <if test="allowModify != null">#{allowModify},</if>
-            <if test="createTime != null">#{createTime},</if>
-            <if test="updateTime != null">#{updateTime},</if>
          </trim>
     </insert>
 
-    <update id="updateOpEnergyStrategy" parameterType="com.ruoyi.ems.domain.OpEnergyStrategy">
+    <update id="updateStrategy" parameterType="com.ruoyi.ems.domain.OpEnergyStrategy">
         update adm_op_energy_strategy
         <trim prefix="SET" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
+            <if test="strategyCode != null and strategyCode != ''">strategy_code = #{strategyCode},</if>
             <if test="strategyCode != null and strategyCode != ''">strategy_code = #{strategyCode},</if>
             <if test="strategyName != null and strategyName != ''">strategy_name = #{strategyName},</if>
             <if test="strategyDesc != null">strategy_desc = #{strategyDesc},</if>
             <if test="strategyType != null">strategy_type = #{strategyType},</if>
+            <if test="strategyState != null">strategy_state = #{strategyState},</if>
             <if test="execMode != null">exec_mode = #{execMode},</if>
             <if test="execRule != null">exec_rule = #{execRule},</if>
-            <if test="allowModify != null">allow_modify = #{allowModify},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
-            <if test="updateTime != null">update_time = #{updateTime},</if>
         </trim>
         where id = #{id}
     </update>
 
-    <delete id="deleteOpEnergyStrategyById" parameterType="Long">
+    <delete id="deleteStrategyById" parameterType="Long">
         delete from adm_op_energy_strategy where id = #{id}
     </delete>
 
-    <delete id="deleteOpEnergyStrategyByIds" parameterType="String">
+    <delete id="deleteStrategyByIds" parameterType="String">
         delete from adm_op_energy_strategy where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}

+ 3 - 3
ems-cloud/sql/ems_server.sql

@@ -684,10 +684,10 @@ create table adm_op_energy_strategy  (
   `area_code`         varchar(32)     not null                     comment '地块代码',
   `strategy_code`     varchar(16)     not null                     comment '策略代码',
   `strategy_name`     varchar(32)     not null                     comment '策略名称',
-  `strategy_desc`     varchar(128)    default null                 comment '策略描述',
   `strategy_type`     int             not null                     comment '1:源网协调,2:源荷互动, 3:网储互动,4:其他',
-  `strategy_state`    int             not null                     comment '0:关闭 1:启动',
-  `exec_mode`         int             not null                     comment '1:定时执行(cron)99:手动执行',
+  `strategy_state`    int             default null                 comment '0:关闭 1:启动',
+  `strategy_desc`     varchar(128)    default null                 comment '策略描述',
+  `exec_mode`         int             default null                 comment '1:定时执行(cron)99:手动执行',
   `exec_rule`         varchar(64)     default null                 comment '执行规则',
   `create_time`       datetime        default CURRENT_TIMESTAMP    comment '创建时间',
   `update_time`       datetime        default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '更新时间',

+ 3 - 6
ems-cloud/sql/ems_sys.sql

@@ -827,7 +827,6 @@ insert into sys_dict_type values(10, '系统状态', 'sys_common_status',   '0',
 INSERT INTO `sys_dict_type` VALUES (100, '设备状态', 'sys_device_stat', '0', 'admin', '2024-08-07 10:21:42', '', NULL, NULL);
 INSERT INTO `sys_dict_type` VALUES (101, '策略类型', 'strategy_type', '0', 'admin', '2024-08-08 14:45:51', 'admin', '2024-08-08 14:46:11', '1:源网协调,2:源荷互动');
 INSERT INTO `sys_dict_type` VALUES (102, '执行模式', 'exec_mode', '0', 'admin', '2024-08-08 14:48:15', '', NULL, '0:固定策略 1:规则引擎 2:定时执行(cron)99:手动执行');
-INSERT INTO `sys_dict_type` VALUES (103, '是否允许修改标记', 'allow_modify', '0', 'admin', '2024-08-08 17:00:42', '', NULL, NULL);
 INSERT INTO `sys_dict_type` VALUES (104, '计量类型', 'meter_type', '0', 'admin', '2024-08-09 10:23:03', 'admin', '2024-08-09 10:23:30', '计量类型 0:不区分 1:峰电计量  2:谷电计量');
 INSERT INTO `sys_dict_type` VALUES (105, '设施对象类型', 'obj_type', '0', 'admin', '2024-08-12 14:22:40', 'admin', '2024-08-28 15:33:20', '对象类型 0:园区,1:区块,2:设施,3:设备');
 INSERT INTO `sys_dict_type` VALUES (106, '标签', 'basecfg_lable', '0', 'admin', '2024-08-19 10:44:49', '', NULL, NULL);
@@ -897,12 +896,10 @@ INSERT INTO `sys_dict_data` VALUES (101, 0, '故障', '1', 'sys_device_stat', NU
 INSERT INTO `sys_dict_data` VALUES (102, 0, '未运行', '2', 'sys_device_stat', NULL, 'default', 'N', '0', 'admin', '2024-08-07 10:23:48', 'admin', '2024-08-07 11:13:00', NULL);
 INSERT INTO `sys_dict_data` VALUES (103, 0, '源网协调', '1', 'strategy_type', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:46:37', '', NULL, NULL);
 INSERT INTO `sys_dict_data` VALUES (104, 0, '源荷互动', '2', 'strategy_type', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:46:55', '', NULL, NULL);
-INSERT INTO `sys_dict_data` VALUES (105, 0, '固定策略', '0', 'exec_mode', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:48:38', '', NULL, NULL);
-INSERT INTO `sys_dict_data` VALUES (106, 0, '规则引擎', '1', 'exec_mode', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:48:51', '', NULL, NULL);
-INSERT INTO `sys_dict_data` VALUES (107, 0, '定时执行(cron)', '2', 'exec_mode', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:49:06', '', NULL, NULL);
+INSERT INTO `sys_dict_data` VALUES (105, 0, '网储互动', '3', 'strategy_type', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:46:55', '', NULL, NULL);
+INSERT INTO `sys_dict_data` VALUES (106, 0, '其他',    '4', 'strategy_type', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:46:55', '', NULL, NULL);
+INSERT INTO `sys_dict_data` VALUES (107, 0, '定时执行(cron)', '1', 'exec_mode', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:49:06', '', NULL, NULL);
 INSERT INTO `sys_dict_data` VALUES (108, 0, '手动执行', '99', 'exec_mode', NULL, 'default', 'N', '0', 'admin', '2024-08-08 14:49:34', '', NULL, '手动执行');
-INSERT INTO `sys_dict_data` VALUES (109, 0, '是', '0', 'allow_modify', NULL, 'default', 'N', '0', 'admin', '2024-08-08 17:01:57', 'admin', '2024-08-08 17:03:14', NULL);
-INSERT INTO `sys_dict_data` VALUES (110, 0, '否', '1', 'allow_modify', NULL, 'default', 'N', '0', 'admin', '2024-08-08 17:03:04', '', NULL, NULL);
 INSERT INTO `sys_dict_data` VALUES (111, 0, '不区分', '0', 'meter_type', NULL, 'default', 'N', '0', 'admin', '2024-08-09 10:23:59', '', NULL, '0:不区分 ');
 INSERT INTO `sys_dict_data` VALUES (112, 0, '峰电计量', '1', 'meter_type', NULL, 'default', 'N', '0', 'admin', '2024-08-09 10:24:14', '', NULL, '1:峰电计量  ');
 INSERT INTO `sys_dict_data` VALUES (113, 0, '谷电计量', '2', 'meter_type', NULL, 'default', 'N', '0', 'admin', '2024-08-09 10:24:24', '', NULL, '2:谷电计量');