chen.cheng 1 éve
szülő
commit
ca7cea608b

+ 105 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AdmEmsElecLoadIndexController.java

@@ -0,0 +1,105 @@
+package com.ruoyi.ems.controller;
+
+import java.util.List;
+import java.io.IOException;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+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.AdmEmsElecLoadIndex;
+import com.ruoyi.ems.service.IAdmEmsElecLoadIndexService;
+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;
+
+/**
+ * 电力负荷设施指标Controller
+ * 
+ * @author ruoyi
+ * @date 2024-08-09
+ */
+@RestController
+@RequestMapping("/loadIndex")
+public class AdmEmsElecLoadIndexController extends BaseController
+{
+    @Autowired
+    private IAdmEmsElecLoadIndexService admEmsElecLoadIndexService;
+
+    /**
+     * 查询电力负荷设施指标列表
+     */
+    @RequiresPermissions("ems:loadIndex:list")
+    @GetMapping("/list")
+    public TableDataInfo list(AdmEmsElecLoadIndex admEmsElecLoadIndex)
+    {
+        startPage();
+        List<AdmEmsElecLoadIndex> list = admEmsElecLoadIndexService.selectAdmEmsElecLoadIndexList(admEmsElecLoadIndex);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出电力负荷设施指标列表
+     */
+    @RequiresPermissions("ems:loadIndex:export")
+    @Log(title = "电力负荷设施指标", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, AdmEmsElecLoadIndex admEmsElecLoadIndex)
+    {
+        List<AdmEmsElecLoadIndex> list = admEmsElecLoadIndexService.selectAdmEmsElecLoadIndexList(admEmsElecLoadIndex);
+        ExcelUtil<AdmEmsElecLoadIndex> util = new ExcelUtil<AdmEmsElecLoadIndex>(AdmEmsElecLoadIndex.class);
+        util.exportExcel(response, list, "电力负荷设施指标数据");
+    }
+
+    /**
+     * 获取电力负荷设施指标详细信息
+     */
+    @RequiresPermissions("ems:loadIndex:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(admEmsElecLoadIndexService.selectAdmEmsElecLoadIndexById(id));
+    }
+
+    /**
+     * 新增电力负荷设施指标
+     */
+    @RequiresPermissions("ems:loadIndex:add")
+    @Log(title = "电力负荷设施指标", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody AdmEmsElecLoadIndex admEmsElecLoadIndex)
+    {
+        return toAjax(admEmsElecLoadIndexService.insertAdmEmsElecLoadIndex(admEmsElecLoadIndex));
+    }
+
+    /**
+     * 修改电力负荷设施指标
+     */
+    @RequiresPermissions("ems:loadIndex:edit")
+    @Log(title = "电力负荷设施指标", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody AdmEmsElecLoadIndex admEmsElecLoadIndex)
+    {
+        return toAjax(admEmsElecLoadIndexService.updateAdmEmsElecLoadIndex(admEmsElecLoadIndex));
+    }
+
+    /**
+     * 删除电力负荷设施指标
+     */
+    @RequiresPermissions("ems:loadIndex:remove")
+    @Log(title = "电力负荷设施指标", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(admEmsElecLoadIndexService.deleteAdmEmsElecLoadIndexByIds(ids));
+    }
+}

+ 158 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AdmEmsElecLoadIndex.java

@@ -0,0 +1,158 @@
+package com.ruoyi.ems.domain;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.annotation.Excel;
+import com.ruoyi.common.core.web.domain.BaseEntity;
+
+/**
+ * 电力负荷设施指标对象 adm_ems_elec_load_index
+ *
+ * @author ruoyi
+ * @date 2024-08-09
+ */
+public class AdmEmsElecLoadIndex extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 序号
+     */
+    private Long id;
+
+    /**
+     * 园区代码
+     */
+    @Excel(name = "园区代码")
+    private String areaCode;
+
+    /**
+     * 设施代码
+     */
+    @Excel(name = "设施代码")
+    private String facsCode;
+
+    @Excel(name = "园区名称")
+    private String areaName;
+
+    @Excel(name = "设施名称")
+    private String facsName;
+
+    /**
+     * 日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date date;
+
+    /**
+     * 时间
+     */
+    private Date time;
+
+    /**
+     * 电压 (千伏)
+     */
+    @Excel(name = "电压 ", readConverterExp = "千=伏")
+    private Double voltage;
+
+    /**
+     * 电流 (安培)
+     */
+    @Excel(name = "电流 ", readConverterExp = "安=培")
+    private Double amperage;
+
+    /**
+     * 功率 (千瓦)
+     */
+    @Excel(name = "功率 ", readConverterExp = "千=瓦")
+    private Double power;
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setAreaCode(String areaCode) {
+        this.areaCode = areaCode;
+    }
+
+    public String getAreaCode() {
+        return areaCode;
+    }
+
+    public void setFacsCode(String facsCode) {
+        this.facsCode = facsCode;
+    }
+
+    public String getFacsCode() {
+        return facsCode;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setTime(Date time) {
+        this.time = time;
+    }
+
+    public Date getTime() {
+        return time;
+    }
+
+    public void setVoltage(Double voltage) {
+        this.voltage = voltage;
+    }
+
+    public Double getVoltage() {
+        return voltage;
+    }
+
+    public void setAmperage(Double amperage) {
+        this.amperage = amperage;
+    }
+
+    public Double getAmperage() {
+        return amperage;
+    }
+
+    public void setPower(Double power) {
+        this.power = power;
+    }
+
+    public Double getPower() {
+        return power;
+    }
+
+    public String getAreaName() {
+        return areaName;
+    }
+
+    public void setAreaName(String areaName) {
+        this.areaName = areaName;
+    }
+
+    public String getFacsName() {
+        return facsName;
+    }
+
+    public void setFacsName(String facsName) {
+        this.facsName = facsName;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId()).append("areaCode", getAreaCode()).append("facsCode", getFacsCode()).append("date", getDate()).append("time", getTime()).append("voltage", getVoltage()).append("amperage", getAmperage()).append("power", getPower()).toString();
+    }
+}

+ 61 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AdmEmsElecLoadIndexMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.ems.mapper;
+
+import java.util.List;
+import com.ruoyi.ems.domain.AdmEmsElecLoadIndex;
+
+/**
+ * 电力负荷设施指标Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-08-09
+ */
+public interface AdmEmsElecLoadIndexMapper 
+{
+    /**
+     * 查询电力负荷设施指标
+     * 
+     * @param id 电力负荷设施指标主键
+     * @return 电力负荷设施指标
+     */
+    public AdmEmsElecLoadIndex selectAdmEmsElecLoadIndexById(Long id);
+
+    /**
+     * 查询电力负荷设施指标列表
+     * 
+     * @param admEmsElecLoadIndex 电力负荷设施指标
+     * @return 电力负荷设施指标集合
+     */
+    public List<AdmEmsElecLoadIndex> selectAdmEmsElecLoadIndexList(AdmEmsElecLoadIndex admEmsElecLoadIndex);
+
+    /**
+     * 新增电力负荷设施指标
+     * 
+     * @param admEmsElecLoadIndex 电力负荷设施指标
+     * @return 结果
+     */
+    public int insertAdmEmsElecLoadIndex(AdmEmsElecLoadIndex admEmsElecLoadIndex);
+
+    /**
+     * 修改电力负荷设施指标
+     * 
+     * @param admEmsElecLoadIndex 电力负荷设施指标
+     * @return 结果
+     */
+    public int updateAdmEmsElecLoadIndex(AdmEmsElecLoadIndex admEmsElecLoadIndex);
+
+    /**
+     * 删除电力负荷设施指标
+     * 
+     * @param id 电力负荷设施指标主键
+     * @return 结果
+     */
+    public int deleteAdmEmsElecLoadIndexById(Long id);
+
+    /**
+     * 批量删除电力负荷设施指标
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteAdmEmsElecLoadIndexByIds(Long[] ids);
+}

+ 61 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAdmEmsElecLoadIndexService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.ems.service;
+
+import java.util.List;
+import com.ruoyi.ems.domain.AdmEmsElecLoadIndex;
+
+/**
+ * 电力负荷设施指标Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-08-09
+ */
+public interface IAdmEmsElecLoadIndexService 
+{
+    /**
+     * 查询电力负荷设施指标
+     * 
+     * @param id 电力负荷设施指标主键
+     * @return 电力负荷设施指标
+     */
+    public AdmEmsElecLoadIndex selectAdmEmsElecLoadIndexById(Long id);
+
+    /**
+     * 查询电力负荷设施指标列表
+     * 
+     * @param admEmsElecLoadIndex 电力负荷设施指标
+     * @return 电力负荷设施指标集合
+     */
+    public List<AdmEmsElecLoadIndex> selectAdmEmsElecLoadIndexList(AdmEmsElecLoadIndex admEmsElecLoadIndex);
+
+    /**
+     * 新增电力负荷设施指标
+     * 
+     * @param admEmsElecLoadIndex 电力负荷设施指标
+     * @return 结果
+     */
+    public int insertAdmEmsElecLoadIndex(AdmEmsElecLoadIndex admEmsElecLoadIndex);
+
+    /**
+     * 修改电力负荷设施指标
+     * 
+     * @param admEmsElecLoadIndex 电力负荷设施指标
+     * @return 结果
+     */
+    public int updateAdmEmsElecLoadIndex(AdmEmsElecLoadIndex admEmsElecLoadIndex);
+
+    /**
+     * 批量删除电力负荷设施指标
+     * 
+     * @param ids 需要删除的电力负荷设施指标主键集合
+     * @return 结果
+     */
+    public int deleteAdmEmsElecLoadIndexByIds(Long[] ids);
+
+    /**
+     * 删除电力负荷设施指标信息
+     * 
+     * @param id 电力负荷设施指标主键
+     * @return 结果
+     */
+    public int deleteAdmEmsElecLoadIndexById(Long id);
+}

+ 93 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AdmEmsElecLoadIndexServiceImpl.java

@@ -0,0 +1,93 @@
+package com.ruoyi.ems.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.ems.mapper.AdmEmsElecLoadIndexMapper;
+import com.ruoyi.ems.domain.AdmEmsElecLoadIndex;
+import com.ruoyi.ems.service.IAdmEmsElecLoadIndexService;
+
+/**
+ * 电力负荷设施指标Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-08-09
+ */
+@Service
+public class AdmEmsElecLoadIndexServiceImpl implements IAdmEmsElecLoadIndexService 
+{
+    @Autowired
+    private AdmEmsElecLoadIndexMapper admEmsElecLoadIndexMapper;
+
+    /**
+     * 查询电力负荷设施指标
+     * 
+     * @param id 电力负荷设施指标主键
+     * @return 电力负荷设施指标
+     */
+    @Override
+    public AdmEmsElecLoadIndex selectAdmEmsElecLoadIndexById(Long id)
+    {
+        return admEmsElecLoadIndexMapper.selectAdmEmsElecLoadIndexById(id);
+    }
+
+    /**
+     * 查询电力负荷设施指标列表
+     * 
+     * @param admEmsElecLoadIndex 电力负荷设施指标
+     * @return 电力负荷设施指标
+     */
+    @Override
+    public List<AdmEmsElecLoadIndex> selectAdmEmsElecLoadIndexList(AdmEmsElecLoadIndex admEmsElecLoadIndex)
+    {
+        return admEmsElecLoadIndexMapper.selectAdmEmsElecLoadIndexList(admEmsElecLoadIndex);
+    }
+
+    /**
+     * 新增电力负荷设施指标
+     * 
+     * @param admEmsElecLoadIndex 电力负荷设施指标
+     * @return 结果
+     */
+    @Override
+    public int insertAdmEmsElecLoadIndex(AdmEmsElecLoadIndex admEmsElecLoadIndex)
+    {
+        return admEmsElecLoadIndexMapper.insertAdmEmsElecLoadIndex(admEmsElecLoadIndex);
+    }
+
+    /**
+     * 修改电力负荷设施指标
+     * 
+     * @param admEmsElecLoadIndex 电力负荷设施指标
+     * @return 结果
+     */
+    @Override
+    public int updateAdmEmsElecLoadIndex(AdmEmsElecLoadIndex admEmsElecLoadIndex)
+    {
+        return admEmsElecLoadIndexMapper.updateAdmEmsElecLoadIndex(admEmsElecLoadIndex);
+    }
+
+    /**
+     * 批量删除电力负荷设施指标
+     * 
+     * @param ids 需要删除的电力负荷设施指标主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAdmEmsElecLoadIndexByIds(Long[] ids)
+    {
+        return admEmsElecLoadIndexMapper.deleteAdmEmsElecLoadIndexByIds(ids);
+    }
+
+    /**
+     * 删除电力负荷设施指标信息
+     * 
+     * @param id 电力负荷设施指标主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAdmEmsElecLoadIndexById(Long id)
+    {
+        return admEmsElecLoadIndexMapper.deleteAdmEmsElecLoadIndexById(id);
+    }
+}

+ 99 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AdmEmsElecLoadIndexMapper.xml

@@ -0,0 +1,99 @@
+<?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.ruoyi.ems.mapper.AdmEmsElecLoadIndexMapper">
+
+    <resultMap type="com.ruoyi.ems.domain.AdmEmsElecLoadIndex" id="AdmEmsElecLoadIndexResult">
+        <result property="id"    column="id"    />
+        <result property="areaCode"    column="area_code"    />
+        <result property="facsCode"    column="facs_code"    />
+        <result property="date"    column="date"    />
+        <result property="time"    column="time"    />
+        <result property="voltage"    column="voltage"    />
+        <result property="amperage"    column="amperage"    />
+        <result property="power"    column="power"    />
+    </resultMap>
+
+    <sql id="selectAdmEmsElecLoadIndexVo">
+        SELECT
+            loadIndex.id,
+            loadIndex.area_code,
+            loadIndex.facs_code,
+            area.area_name,
+            facs.facs_name,
+            DATE,
+            TIME,
+            voltage,
+            amperage,
+            power
+        FROM
+            adm_ems_elec_load_index loadIndex
+            INNER JOIN adm_ems_facs facs ON loadIndex.facs_code = facs.facs_code
+            INNER JOIN adm_service_area area ON loadIndex.area_code = area.area_code
+    </sql>
+
+    <select id="selectAdmEmsElecLoadIndexList" parameterType="com.ruoyi.ems.domain.AdmEmsElecLoadIndex" resultType="com.ruoyi.ems.domain.AdmEmsElecLoadIndex">
+        <include refid="selectAdmEmsElecLoadIndexVo"/>
+        <where>
+            <if test="areaCode != null  and areaCode != ''"> and area_code = #{areaCode}</if>
+            <if test="facsCode != null  and facsCode != ''"> and facs_code = #{facsCode}</if>
+            <if test="date != null "> and date = #{date}</if>
+            <if test="voltage != null "> and voltage = #{voltage}</if>
+            <if test="amperage != null "> and amperage = #{amperage}</if>
+            <if test="power != null "> and power = #{power}</if>
+        </where>
+    </select>
+
+    <select id="selectAdmEmsElecLoadIndexById" parameterType="Long" resultMap="AdmEmsElecLoadIndexResult">
+        <include refid="selectAdmEmsElecLoadIndexVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertAdmEmsElecLoadIndex" parameterType="com.ruoyi.ems.domain.AdmEmsElecLoadIndex" useGeneratedKeys="true" keyProperty="id">
+        insert into adm_ems_elec_load_index
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">area_code,</if>
+            <if test="facsCode != null and facsCode != ''">facs_code,</if>
+            <if test="date != null">date,</if>
+            <if test="time != null">time,</if>
+            <if test="voltage != null">voltage,</if>
+            <if test="amperage != null">amperage,</if>
+            <if test="power != null">power,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
+            <if test="facsCode != null and facsCode != ''">#{facsCode},</if>
+            <if test="date != null">#{date},</if>
+            <if test="time != null">#{time},</if>
+            <if test="voltage != null">#{voltage},</if>
+            <if test="amperage != null">#{amperage},</if>
+            <if test="power != null">#{power},</if>
+         </trim>
+    </insert>
+
+    <update id="updateAdmEmsElecLoadIndex" parameterType="com.ruoyi.ems.domain.AdmEmsElecLoadIndex">
+        update adm_ems_elec_load_index
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
+            <if test="facsCode != null and facsCode != ''">facs_code = #{facsCode},</if>
+            <if test="date != null">date = #{date},</if>
+            <if test="time != null">time = #{time},</if>
+            <if test="voltage != null">voltage = #{voltage},</if>
+            <if test="amperage != null">amperage = #{amperage},</if>
+            <if test="power != null">power = #{power},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteAdmEmsElecLoadIndexById" parameterType="Long">
+        delete from adm_ems_elec_load_index where id = #{id}
+    </delete>
+
+    <delete id="deleteAdmEmsElecLoadIndexByIds" parameterType="String">
+        delete from adm_ems_elec_load_index where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>