实时监测表
This commit is contained in:
parent
6511292d4a
commit
65190d56d1
|
@ -0,0 +1,104 @@
|
|||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
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.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.Realtime;
|
||||
import com.ruoyi.system.service.IRealtimeService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 实时状况Controller
|
||||
*
|
||||
* @author 徐天乐
|
||||
* @date 2024-11-24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/realtime")
|
||||
public class RealtimeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRealtimeService realtimeService;
|
||||
|
||||
/**
|
||||
* 查询实时状况列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:realtime:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Realtime realtime)
|
||||
{
|
||||
startPage();
|
||||
List<Realtime> list = realtimeService.selectRealtimeList(realtime);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出实时状况列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:realtime:export')")
|
||||
@Log(title = "实时状况", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Realtime realtime)
|
||||
{
|
||||
List<Realtime> list = realtimeService.selectRealtimeList(realtime);
|
||||
ExcelUtil<Realtime> util = new ExcelUtil<Realtime>(Realtime.class);
|
||||
util.exportExcel(response, list, "实时状况数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实时状况详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:realtime:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(realtimeService.selectRealtimeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增实时状况
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:realtime:add')")
|
||||
@Log(title = "实时状况", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Realtime realtime)
|
||||
{
|
||||
return toAjax(realtimeService.insertRealtime(realtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改实时状况
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:realtime:edit')")
|
||||
@Log(title = "实时状况", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Realtime realtime)
|
||||
{
|
||||
return toAjax(realtimeService.updateRealtime(realtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除实时状况
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:realtime:remove')")
|
||||
@Log(title = "实时状况", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(realtimeService.deleteRealtimeByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 实时状况对象 realtime
|
||||
*
|
||||
* @author 徐天乐
|
||||
* @date 2024-11-24
|
||||
*/
|
||||
public class Realtime extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** 实时负荷 */
|
||||
@Excel(name = "实时负荷")
|
||||
private String powertime;
|
||||
|
||||
/** 设备总数 */
|
||||
@Excel(name = "设备总数")
|
||||
private String equipmenttime;
|
||||
|
||||
/** 设备在线 */
|
||||
@Excel(name = "设备在线")
|
||||
private String onlinetime;
|
||||
|
||||
/** 警告次数 */
|
||||
@Excel(name = "警告次数")
|
||||
private String alarmtime;
|
||||
|
||||
/** 今日用电 */
|
||||
@Excel(name = "今日用电")
|
||||
private String electricitytime;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setPowertime(String powertime)
|
||||
{
|
||||
this.powertime = powertime;
|
||||
}
|
||||
|
||||
public String getPowertime()
|
||||
{
|
||||
return powertime;
|
||||
}
|
||||
public void setEquipmenttime(String equipmenttime)
|
||||
{
|
||||
this.equipmenttime = equipmenttime;
|
||||
}
|
||||
|
||||
public String getEquipmenttime()
|
||||
{
|
||||
return equipmenttime;
|
||||
}
|
||||
public void setOnlinetime(String onlinetime)
|
||||
{
|
||||
this.onlinetime = onlinetime;
|
||||
}
|
||||
|
||||
public String getOnlinetime()
|
||||
{
|
||||
return onlinetime;
|
||||
}
|
||||
public void setAlarmtime(String alarmtime)
|
||||
{
|
||||
this.alarmtime = alarmtime;
|
||||
}
|
||||
|
||||
public String getAlarmtime()
|
||||
{
|
||||
return alarmtime;
|
||||
}
|
||||
public void setElectricitytime(String electricitytime)
|
||||
{
|
||||
this.electricitytime = electricitytime;
|
||||
}
|
||||
|
||||
public String getElectricitytime()
|
||||
{
|
||||
return electricitytime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("powertime", getPowertime())
|
||||
.append("equipmenttime", getEquipmenttime())
|
||||
.append("onlinetime", getOnlinetime())
|
||||
.append("alarmtime", getAlarmtime())
|
||||
.append("electricitytime", getElectricitytime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.Realtime;
|
||||
|
||||
/**
|
||||
* 实时状况Mapper接口
|
||||
*
|
||||
* @author 徐天乐
|
||||
* @date 2024-11-24
|
||||
*/
|
||||
public interface RealtimeMapper
|
||||
{
|
||||
/**
|
||||
* 查询实时状况
|
||||
*
|
||||
* @param id 实时状况主键
|
||||
* @return 实时状况
|
||||
*/
|
||||
public Realtime selectRealtimeById(Long id);
|
||||
|
||||
/**
|
||||
* 查询实时状况列表
|
||||
*
|
||||
* @param realtime 实时状况
|
||||
* @return 实时状况集合
|
||||
*/
|
||||
public List<Realtime> selectRealtimeList(Realtime realtime);
|
||||
|
||||
/**
|
||||
* 新增实时状况
|
||||
*
|
||||
* @param realtime 实时状况
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRealtime(Realtime realtime);
|
||||
|
||||
/**
|
||||
* 修改实时状况
|
||||
*
|
||||
* @param realtime 实时状况
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRealtime(Realtime realtime);
|
||||
|
||||
/**
|
||||
* 删除实时状况
|
||||
*
|
||||
* @param id 实时状况主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRealtimeById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除实时状况
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRealtimeByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.Realtime;
|
||||
|
||||
/**
|
||||
* 实时状况Service接口
|
||||
*
|
||||
* @author 徐天乐
|
||||
* @date 2024-11-24
|
||||
*/
|
||||
public interface IRealtimeService
|
||||
{
|
||||
/**
|
||||
* 查询实时状况
|
||||
*
|
||||
* @param id 实时状况主键
|
||||
* @return 实时状况
|
||||
*/
|
||||
public Realtime selectRealtimeById(Long id);
|
||||
|
||||
/**
|
||||
* 查询实时状况列表
|
||||
*
|
||||
* @param realtime 实时状况
|
||||
* @return 实时状况集合
|
||||
*/
|
||||
public List<Realtime> selectRealtimeList(Realtime realtime);
|
||||
|
||||
/**
|
||||
* 新增实时状况
|
||||
*
|
||||
* @param realtime 实时状况
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRealtime(Realtime realtime);
|
||||
|
||||
/**
|
||||
* 修改实时状况
|
||||
*
|
||||
* @param realtime 实时状况
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRealtime(Realtime realtime);
|
||||
|
||||
/**
|
||||
* 批量删除实时状况
|
||||
*
|
||||
* @param ids 需要删除的实时状况主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRealtimeByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除实时状况信息
|
||||
*
|
||||
* @param id 实时状况主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRealtimeById(Long id);
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.RealtimeMapper;
|
||||
import com.ruoyi.system.domain.Realtime;
|
||||
import com.ruoyi.system.service.IRealtimeService;
|
||||
|
||||
/**
|
||||
* 实时状况Service业务层处理
|
||||
*
|
||||
* @author 徐天乐
|
||||
* @date 2024-11-24
|
||||
*/
|
||||
@Service
|
||||
public class RealtimeServiceImpl implements IRealtimeService
|
||||
{
|
||||
@Autowired
|
||||
private RealtimeMapper realtimeMapper;
|
||||
|
||||
/**
|
||||
* 查询实时状况
|
||||
*
|
||||
* @param id 实时状况主键
|
||||
* @return 实时状况
|
||||
*/
|
||||
@Override
|
||||
public Realtime selectRealtimeById(Long id)
|
||||
{
|
||||
return realtimeMapper.selectRealtimeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实时状况列表
|
||||
*
|
||||
* @param realtime 实时状况
|
||||
* @return 实时状况
|
||||
*/
|
||||
@Override
|
||||
public List<Realtime> selectRealtimeList(Realtime realtime)
|
||||
{
|
||||
return realtimeMapper.selectRealtimeList(realtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增实时状况
|
||||
*
|
||||
* @param realtime 实时状况
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRealtime(Realtime realtime)
|
||||
{
|
||||
return realtimeMapper.insertRealtime(realtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改实时状况
|
||||
*
|
||||
* @param realtime 实时状况
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRealtime(Realtime realtime)
|
||||
{
|
||||
return realtimeMapper.updateRealtime(realtime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除实时状况
|
||||
*
|
||||
* @param ids 需要删除的实时状况主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRealtimeByIds(Long[] ids)
|
||||
{
|
||||
return realtimeMapper.deleteRealtimeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除实时状况信息
|
||||
*
|
||||
* @param id 实时状况主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRealtimeById(Long id)
|
||||
{
|
||||
return realtimeMapper.deleteRealtimeById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
<?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.system.mapper.RealtimeMapper">
|
||||
|
||||
<resultMap type="Realtime" id="RealtimeResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="powertime" column="powertime" />
|
||||
<result property="equipmenttime" column="equipmenttime" />
|
||||
<result property="onlinetime" column="onlinetime" />
|
||||
<result property="alarmtime" column="alarmtime" />
|
||||
<result property="electricitytime" column="electricitytime" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRealtimeVo">
|
||||
select id, powertime, equipmenttime, onlinetime, alarmtime, electricitytime from realtime
|
||||
</sql>
|
||||
|
||||
<select id="selectRealtimeList" parameterType="Realtime" resultMap="RealtimeResult">
|
||||
<include refid="selectRealtimeVo"/>
|
||||
<where>
|
||||
<if test="powertime != null and powertime != ''"> and powertime = #{powertime}</if>
|
||||
<if test="equipmenttime != null and equipmenttime != ''"> and equipmenttime = #{equipmenttime}</if>
|
||||
<if test="onlinetime != null and onlinetime != ''"> and onlinetime = #{onlinetime}</if>
|
||||
<if test="alarmtime != null and alarmtime != ''"> and alarmtime = #{alarmtime}</if>
|
||||
<if test="electricitytime != null and electricitytime != ''"> and electricitytime = #{electricitytime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRealtimeById" parameterType="Long" resultMap="RealtimeResult">
|
||||
<include refid="selectRealtimeVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRealtime" parameterType="Realtime" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into realtime
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="powertime != null">powertime,</if>
|
||||
<if test="equipmenttime != null">equipmenttime,</if>
|
||||
<if test="onlinetime != null">onlinetime,</if>
|
||||
<if test="alarmtime != null">alarmtime,</if>
|
||||
<if test="electricitytime != null">electricitytime,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="powertime != null">#{powertime},</if>
|
||||
<if test="equipmenttime != null">#{equipmenttime},</if>
|
||||
<if test="onlinetime != null">#{onlinetime},</if>
|
||||
<if test="alarmtime != null">#{alarmtime},</if>
|
||||
<if test="electricitytime != null">#{electricitytime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRealtime" parameterType="Realtime">
|
||||
update realtime
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="powertime != null">powertime = #{powertime},</if>
|
||||
<if test="equipmenttime != null">equipmenttime = #{equipmenttime},</if>
|
||||
<if test="onlinetime != null">onlinetime = #{onlinetime},</if>
|
||||
<if test="alarmtime != null">alarmtime = #{alarmtime},</if>
|
||||
<if test="electricitytime != null">electricitytime = #{electricitytime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRealtimeById" parameterType="Long">
|
||||
delete from realtime where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRealtimeByIds" parameterType="String">
|
||||
delete from realtime where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue