change - add设备实时状态接口
parent
cd028831b8
commit
3c84d4d15a
@ -0,0 +1,99 @@
|
||||
package com.hw.dms.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.hw.common.log.annotation.Log;
|
||||
import com.hw.common.log.enums.BusinessType;
|
||||
import com.hw.common.security.annotation.RequiresPermissions;
|
||||
import com.hw.dms.domain.DmsRealtimeStatus;
|
||||
import com.hw.dms.service.IDmsRealtimeStatusService;
|
||||
import com.hw.common.core.web.controller.BaseController;
|
||||
import com.hw.common.core.web.domain.AjaxResult;
|
||||
import com.hw.common.core.utils.poi.ExcelUtil;
|
||||
import com.hw.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备实时状态Controller
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dmsRealtimeStatus")
|
||||
public class DmsRealtimeStatusController extends BaseController {
|
||||
@Autowired
|
||||
private IDmsRealtimeStatusService dmsRealtimeStatusService;
|
||||
|
||||
/**
|
||||
* 查询设备实时状态列表
|
||||
*/
|
||||
@RequiresPermissions("dms:dmsRealtimeStatus:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DmsRealtimeStatus dmsRealtimeStatus) {
|
||||
startPage();
|
||||
List<DmsRealtimeStatus> list = dmsRealtimeStatusService.selectDmsRealtimeStatusList(dmsRealtimeStatus);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备实时状态列表
|
||||
*/
|
||||
@RequiresPermissions("dms:dmsRealtimeStatus:export")
|
||||
@Log(title = "设备实时状态", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DmsRealtimeStatus dmsRealtimeStatus) {
|
||||
List<DmsRealtimeStatus> list = dmsRealtimeStatusService.selectDmsRealtimeStatusList(dmsRealtimeStatus);
|
||||
ExcelUtil<DmsRealtimeStatus> util = new ExcelUtil<DmsRealtimeStatus>(DmsRealtimeStatus.class);
|
||||
util.exportExcel(response, list, "设备实时状态数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备实时状态详细信息
|
||||
*/
|
||||
@RequiresPermissions("dms:dmsRealtimeStatus:query")
|
||||
@GetMapping(value = "/{statusId}")
|
||||
public AjaxResult getInfo(@PathVariable("statusId") Long statusId) {
|
||||
return success(dmsRealtimeStatusService.selectDmsRealtimeStatusByStatusId(statusId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备实时状态
|
||||
*/
|
||||
@RequiresPermissions("dms:dmsRealtimeStatus:add")
|
||||
@Log(title = "设备实时状态", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DmsRealtimeStatus dmsRealtimeStatus) {
|
||||
return toAjax(dmsRealtimeStatusService.insertDmsRealtimeStatus(dmsRealtimeStatus));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备实时状态
|
||||
*/
|
||||
@RequiresPermissions("dms:dmsRealtimeStatus:edit")
|
||||
@Log(title = "设备实时状态", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody DmsRealtimeStatus dmsRealtimeStatus) {
|
||||
return toAjax(dmsRealtimeStatusService.updateDmsRealtimeStatus(dmsRealtimeStatus));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备实时状态
|
||||
*/
|
||||
@RequiresPermissions("dms:dmsRealtimeStatus:remove")
|
||||
@Log(title = "设备实时状态", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{statusIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] statusIds) {
|
||||
return toAjax(dmsRealtimeStatusService.deleteDmsRealtimeStatusByStatusIds(statusIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
package com.hw.dms.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.hw.common.core.annotation.Excel;
|
||||
import com.hw.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备实时状态对象 dms_realtime_status
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
public class DmsRealtimeStatus extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
private Long statusId;
|
||||
|
||||
/**
|
||||
* 设备状态编号
|
||||
*/
|
||||
@Excel(name = "设备状态编号")
|
||||
private String statusCode;
|
||||
|
||||
/**
|
||||
* 设备状态名称
|
||||
*/
|
||||
@Excel(name = "设备状态名称")
|
||||
private String statusName;
|
||||
|
||||
/**
|
||||
* 设备状态值
|
||||
*/
|
||||
@Excel(name = "设备状态值")
|
||||
private String statusValue;
|
||||
|
||||
/**
|
||||
* 所属设备id
|
||||
*/
|
||||
@Excel(name = "所属设备id")
|
||||
private Long deviceId;
|
||||
|
||||
/** 设备名称 */
|
||||
@Excel(name = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date creatTime;
|
||||
|
||||
public String getDeviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setDeviceName(String deviceName) {
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public void setStatusId(Long statusId) {
|
||||
this.statusId = statusId;
|
||||
}
|
||||
|
||||
public Long getStatusId() {
|
||||
return statusId;
|
||||
}
|
||||
|
||||
public void setStatusCode(String statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
|
||||
public String getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public void setStatusName(String statusName) {
|
||||
this.statusName = statusName;
|
||||
}
|
||||
|
||||
public String getStatusName() {
|
||||
return statusName;
|
||||
}
|
||||
|
||||
public void setStatusValue(String statusValue) {
|
||||
this.statusValue = statusValue;
|
||||
}
|
||||
|
||||
public String getStatusValue() {
|
||||
return statusValue;
|
||||
}
|
||||
|
||||
public void setDeviceId(Long deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setCreatTime(Date creatTime) {
|
||||
this.creatTime = creatTime;
|
||||
}
|
||||
|
||||
public Date getCreatTime() {
|
||||
return creatTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("statusId", getStatusId())
|
||||
.append("statusCode", getStatusCode())
|
||||
.append("statusName", getStatusName())
|
||||
.append("statusValue", getStatusValue())
|
||||
.append("deviceId", getDeviceId())
|
||||
.append("creatTime", getCreatTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.hw.dms.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hw.dms.domain.DmsRealtimeStatus;
|
||||
|
||||
/**
|
||||
* 设备实时状态Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
public interface DmsRealtimeStatusMapper {
|
||||
/**
|
||||
* 查询设备实时状态
|
||||
*
|
||||
* @param statusId 设备实时状态主键
|
||||
* @return 设备实时状态
|
||||
*/
|
||||
public DmsRealtimeStatus selectDmsRealtimeStatusByStatusId(Long statusId);
|
||||
|
||||
/**
|
||||
* 查询设备实时状态列表
|
||||
*
|
||||
* @param dmsRealtimeStatus 设备实时状态
|
||||
* @return 设备实时状态集合
|
||||
*/
|
||||
public List<DmsRealtimeStatus> selectDmsRealtimeStatusList(DmsRealtimeStatus dmsRealtimeStatus);
|
||||
|
||||
/**
|
||||
* 新增设备实时状态
|
||||
*
|
||||
* @param dmsRealtimeStatus 设备实时状态
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDmsRealtimeStatus(DmsRealtimeStatus dmsRealtimeStatus);
|
||||
|
||||
/**
|
||||
* 修改设备实时状态
|
||||
*
|
||||
* @param dmsRealtimeStatus 设备实时状态
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDmsRealtimeStatus(DmsRealtimeStatus dmsRealtimeStatus);
|
||||
|
||||
/**
|
||||
* 删除设备实时状态
|
||||
*
|
||||
* @param statusId 设备实时状态主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDmsRealtimeStatusByStatusId(Long statusId);
|
||||
|
||||
/**
|
||||
* 批量删除设备实时状态
|
||||
*
|
||||
* @param statusIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDmsRealtimeStatusByStatusIds(Long[] statusIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.hw.dms.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hw.dms.domain.DmsRealtimeStatus;
|
||||
|
||||
/**
|
||||
* 设备实时状态Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
public interface IDmsRealtimeStatusService {
|
||||
/**
|
||||
* 查询设备实时状态
|
||||
*
|
||||
* @param statusId 设备实时状态主键
|
||||
* @return 设备实时状态
|
||||
*/
|
||||
public DmsRealtimeStatus selectDmsRealtimeStatusByStatusId(Long statusId);
|
||||
|
||||
/**
|
||||
* 查询设备实时状态列表
|
||||
*
|
||||
* @param dmsRealtimeStatus 设备实时状态
|
||||
* @return 设备实时状态集合
|
||||
*/
|
||||
public List<DmsRealtimeStatus> selectDmsRealtimeStatusList(DmsRealtimeStatus dmsRealtimeStatus);
|
||||
|
||||
/**
|
||||
* 新增设备实时状态
|
||||
*
|
||||
* @param dmsRealtimeStatus 设备实时状态
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDmsRealtimeStatus(DmsRealtimeStatus dmsRealtimeStatus);
|
||||
|
||||
/**
|
||||
* 修改设备实时状态
|
||||
*
|
||||
* @param dmsRealtimeStatus 设备实时状态
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDmsRealtimeStatus(DmsRealtimeStatus dmsRealtimeStatus);
|
||||
|
||||
/**
|
||||
* 批量删除设备实时状态
|
||||
*
|
||||
* @param statusIds 需要删除的设备实时状态主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDmsRealtimeStatusByStatusIds(Long[] statusIds);
|
||||
|
||||
/**
|
||||
* 删除设备实时状态信息
|
||||
*
|
||||
* @param statusId 设备实时状态主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDmsRealtimeStatusByStatusId(Long statusId);
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.hw.dms.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hw.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.hw.dms.mapper.DmsRealtimeStatusMapper;
|
||||
import com.hw.dms.domain.DmsRealtimeStatus;
|
||||
import com.hw.dms.service.IDmsRealtimeStatusService;
|
||||
|
||||
/**
|
||||
* 设备实时状态Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
@Service
|
||||
public class DmsRealtimeStatusServiceImpl implements IDmsRealtimeStatusService {
|
||||
@Autowired
|
||||
private DmsRealtimeStatusMapper dmsRealtimeStatusMapper;
|
||||
|
||||
/**
|
||||
* 查询设备实时状态
|
||||
*
|
||||
* @param statusId 设备实时状态主键
|
||||
* @return 设备实时状态
|
||||
*/
|
||||
@Override
|
||||
public DmsRealtimeStatus selectDmsRealtimeStatusByStatusId(Long statusId) {
|
||||
return dmsRealtimeStatusMapper.selectDmsRealtimeStatusByStatusId(statusId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备实时状态列表
|
||||
*
|
||||
* @param dmsRealtimeStatus 设备实时状态
|
||||
* @return 设备实时状态
|
||||
*/
|
||||
@Override
|
||||
public List<DmsRealtimeStatus> selectDmsRealtimeStatusList(DmsRealtimeStatus dmsRealtimeStatus) {
|
||||
return dmsRealtimeStatusMapper.selectDmsRealtimeStatusList(dmsRealtimeStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备实时状态
|
||||
*
|
||||
* @param dmsRealtimeStatus 设备实时状态
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDmsRealtimeStatus(DmsRealtimeStatus dmsRealtimeStatus) {
|
||||
return dmsRealtimeStatusMapper.insertDmsRealtimeStatus(dmsRealtimeStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备实时状态
|
||||
*
|
||||
* @param dmsRealtimeStatus 设备实时状态
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDmsRealtimeStatus(DmsRealtimeStatus dmsRealtimeStatus) {
|
||||
dmsRealtimeStatus.setUpdateTime(DateUtils.getNowDate());
|
||||
return dmsRealtimeStatusMapper.updateDmsRealtimeStatus(dmsRealtimeStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除设备实时状态
|
||||
*
|
||||
* @param statusIds 需要删除的设备实时状态主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDmsRealtimeStatusByStatusIds(Long[] statusIds) {
|
||||
return dmsRealtimeStatusMapper.deleteDmsRealtimeStatusByStatusIds(statusIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备实时状态信息
|
||||
*
|
||||
* @param statusId 设备实时状态主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDmsRealtimeStatusByStatusId(Long statusId) {
|
||||
return dmsRealtimeStatusMapper.deleteDmsRealtimeStatusByStatusId(statusId);
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
<?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.hw.dms.mapper.DmsRealtimeStatusMapper">
|
||||
|
||||
<resultMap type="DmsRealtimeStatus" id="DmsRealtimeStatusResult">
|
||||
<result property="statusId" column="status_id"/>
|
||||
<result property="statusCode" column="status_code"/>
|
||||
<result property="statusName" column="status_name"/>
|
||||
<result property="statusValue" column="status_value"/>
|
||||
<result property="deviceId" column="device_id"/>
|
||||
<result property="creatTime" column="creat_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="deviceName" column="device_name"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDmsRealtimeStatusVo">
|
||||
select drs.status_id,
|
||||
drs.status_code,
|
||||
drs.status_name,
|
||||
drs.status_value,
|
||||
drs.device_id,
|
||||
drs.creat_time,
|
||||
drs.update_time,
|
||||
dbdl.device_name
|
||||
from dms_realtime_status drs
|
||||
left join dms_base_device_ledger dbdl on drs.device_id = dbdl.device_id
|
||||
</sql>
|
||||
|
||||
<select id="selectDmsRealtimeStatusList" parameterType="DmsRealtimeStatus" resultMap="DmsRealtimeStatusResult">
|
||||
<include refid="selectDmsRealtimeStatusVo"/>
|
||||
<where>
|
||||
<if test="statusCode != null and statusCode != ''">and drs.status_code = #{statusCode}</if>
|
||||
<if test="statusName != null and statusName != ''">and drs.status_name like concat('%', #{statusName}, '%')
|
||||
</if>
|
||||
<if test="statusValue != null and statusValue != ''">and drs.status_value = #{statusValue}</if>
|
||||
<if test="deviceId != null ">and drs.device_id = #{deviceId}</if>
|
||||
<if test="creatTime != null ">and drs.creat_time = #{creatTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDmsRealtimeStatusByStatusId" parameterType="Long" resultMap="DmsRealtimeStatusResult">
|
||||
<include refid="selectDmsRealtimeStatusVo"/>
|
||||
where drs.status_id = #{statusId}
|
||||
</select>
|
||||
|
||||
<insert id="insertDmsRealtimeStatus" parameterType="DmsRealtimeStatus" useGeneratedKeys="true"
|
||||
keyProperty="statusId">
|
||||
insert into dms_realtime_status
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="statusCode != null and statusCode != ''">status_code,</if>
|
||||
<if test="statusName != null and statusName != ''">status_name,</if>
|
||||
<if test="statusValue != null">status_value,</if>
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="creatTime != null">creat_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="statusCode != null and statusCode != ''">#{statusCode},</if>
|
||||
<if test="statusName != null and statusName != ''">#{statusName},</if>
|
||||
<if test="statusValue != null">#{statusValue},</if>
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
<if test="creatTime != null">#{creatTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDmsRealtimeStatus" parameterType="DmsRealtimeStatus">
|
||||
update dms_realtime_status
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="statusCode != null and statusCode != ''">status_code = #{statusCode},</if>
|
||||
<if test="statusName != null and statusName != ''">status_name = #{statusName},</if>
|
||||
<if test="statusValue != null">status_value = #{statusValue},</if>
|
||||
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||
<if test="creatTime != null">creat_time = #{creatTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where status_id = #{statusId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDmsRealtimeStatusByStatusId" parameterType="Long">
|
||||
delete
|
||||
from dms_realtime_status
|
||||
where status_id = #{statusId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDmsRealtimeStatusByStatusIds" parameterType="String">
|
||||
delete from dms_realtime_status where status_id in
|
||||
<foreach item="statusId" collection="array" open="(" separator="," close=")">
|
||||
#{statusId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue