diff --git a/aucma-report/src/main/java/com/aucma/report/controller/DeviceAlarmRecordController.java b/aucma-report/src/main/java/com/aucma/report/controller/DeviceAlarmRecordController.java new file mode 100644 index 0000000..a89a4ea --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/controller/DeviceAlarmRecordController.java @@ -0,0 +1,101 @@ +package com.aucma.report.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.aucma.common.utils.DateUtils; +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.aucma.common.annotation.Log; +import com.aucma.common.core.controller.BaseController; +import com.aucma.common.core.domain.AjaxResult; +import com.aucma.common.enums.BusinessType; +import com.aucma.report.domain.DeviceAlarmRecord; +import com.aucma.report.service.IDeviceAlarmRecordService; +import com.aucma.common.utils.poi.ExcelUtil; +import com.aucma.common.core.page.TableDataInfo; + +/** + * 设备报警记录Controller + * + * @author Yinq + * @date 2024-03-26 + */ +@RestController +@RequestMapping("/report/deviceAlarmRecord") +public class DeviceAlarmRecordController extends BaseController { + @Autowired + private IDeviceAlarmRecordService deviceAlarmRecordService; + + /** + * 查询设备报警记录列表 + */ + @PreAuthorize("@ss.hasPermi('report:deviceAlarmRecord:list')") + @GetMapping("/list") + public TableDataInfo list(DeviceAlarmRecord deviceAlarmRecord) { + startPage(); + List list = deviceAlarmRecordService.selectDeviceAlarmRecordList(deviceAlarmRecord); + return getDataTable(list); + } + + /** + * 导出设备报警记录列表 + */ + @PreAuthorize("@ss.hasPermi('report:deviceAlarmRecord:export')") + @Log(title = "设备报警记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DeviceAlarmRecord deviceAlarmRecord) { + List list = deviceAlarmRecordService.selectDeviceAlarmRecordList(deviceAlarmRecord); + ExcelUtil util = new ExcelUtil(DeviceAlarmRecord.class); + util.exportExcel(response, list, "设备报警记录数据"); + } + + /** + * 获取设备报警记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('report:deviceAlarmRecord:query')") + @GetMapping(value = "/{objId}") + public AjaxResult getInfo(@PathVariable("objId") Long objId) { + return success(deviceAlarmRecordService.selectDeviceAlarmRecordByObjId(objId)); + } + + /** + * 新增设备报警记录 + */ + @PreAuthorize("@ss.hasPermi('report:deviceAlarmRecord:add')") + @Log(title = "设备报警记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DeviceAlarmRecord deviceAlarmRecord) { + deviceAlarmRecord.setCreatedBy(getUsername()); + deviceAlarmRecord.setCreatedTime(DateUtils.getNowDate()); + return toAjax(deviceAlarmRecordService.insertDeviceAlarmRecord(deviceAlarmRecord)); + } + + /** + * 修改设备报警记录 + */ + @PreAuthorize("@ss.hasPermi('report:deviceAlarmRecord:edit')") + @Log(title = "设备报警记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DeviceAlarmRecord deviceAlarmRecord) { + return toAjax(deviceAlarmRecordService.updateDeviceAlarmRecord(deviceAlarmRecord)); + } + + /** + * 删除设备报警记录 + */ + @PreAuthorize("@ss.hasPermi('report:deviceAlarmRecord:remove')") + @Log(title = "设备报警记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{objIds}") + public AjaxResult remove(@PathVariable Long[] objIds) { + return toAjax(deviceAlarmRecordService.deleteDeviceAlarmRecordByObjIds(objIds)); + } +} diff --git a/aucma-report/src/main/java/com/aucma/report/domain/DeviceAlarmRecord.java b/aucma-report/src/main/java/com/aucma/report/domain/DeviceAlarmRecord.java new file mode 100644 index 0000000..05d148b --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/domain/DeviceAlarmRecord.java @@ -0,0 +1,177 @@ +package com.aucma.report.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.aucma.common.annotation.Excel; +import com.aucma.common.core.domain.BaseEntity; + +/** + * 设备报警记录对象 device_alarm_record + * + * @author Yinq + * @date 2024-03-26 + */ +public class DeviceAlarmRecord extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + private Long objId; + + /** + * 设备编号 + */ + @Excel(name = "设备编号") + private String deviceCode; + + /** + * 设备名称 + */ + @Excel(name = "设备名称") + private String deviceName; + + /** + * 设备类型 + */ + @Excel(name = "设备类型") + private String deviceType; + + /** + * 报警信息 + */ + @Excel(name = "报警信息") + private String alarmInfo; + + /** + * 报警时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date alarmTime; + + /** + * 标识 + */ + @Excel(name = "标识") + private Long isFlag; + + /** + * 创建人 + */ + @Excel(name = "创建人") + private String createdBy; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date createdTime; + + /** + * 批次标识 + */ + @Excel(name = "批次标识") + private String batchId; + + public void setObjId(Long objId) { + this.objId = objId; + } + + public Long getObjId() { + return objId; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + + public String getDeviceCode() { + return deviceCode; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public String getDeviceType() { + return deviceType; + } + + public void setAlarmInfo(String alarmInfo) { + this.alarmInfo = alarmInfo; + } + + public String getAlarmInfo() { + return alarmInfo; + } + + public void setAlarmTime(Date alarmTime) { + this.alarmTime = alarmTime; + } + + public Date getAlarmTime() { + return alarmTime; + } + + public void setIsFlag(Long isFlag) { + this.isFlag = isFlag; + } + + public Long getIsFlag() { + return isFlag; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedTime(Date createdTime) { + this.createdTime = createdTime; + } + + public Date getCreatedTime() { + return createdTime; + } + + public void setBatchId(String batchId) { + this.batchId = batchId; + } + + public String getBatchId() { + return batchId; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("objId", getObjId()) + .append("deviceCode", getDeviceCode()) + .append("deviceName", getDeviceName()) + .append("deviceType", getDeviceType()) + .append("alarmInfo", getAlarmInfo()) + .append("alarmTime", getAlarmTime()) + .append("remark", getRemark()) + .append("isFlag", getIsFlag()) + .append("createdBy", getCreatedBy()) + .append("createdTime", getCreatedTime()) + .append("batchId", getBatchId()) + .toString(); + } +} diff --git a/aucma-report/src/main/java/com/aucma/report/mapper/DeviceAlarmRecordMapper.java b/aucma-report/src/main/java/com/aucma/report/mapper/DeviceAlarmRecordMapper.java new file mode 100644 index 0000000..3c229be --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/mapper/DeviceAlarmRecordMapper.java @@ -0,0 +1,61 @@ +package com.aucma.report.mapper; + +import java.util.List; +import com.aucma.report.domain.DeviceAlarmRecord; + +/** + * 设备报警记录Mapper接口 + * + * @author Yinq + * @date 2024-03-26 + */ +public interface DeviceAlarmRecordMapper +{ + /** + * 查询设备报警记录 + * + * @param objId 设备报警记录主键 + * @return 设备报警记录 + */ + public DeviceAlarmRecord selectDeviceAlarmRecordByObjId(Long objId); + + /** + * 查询设备报警记录列表 + * + * @param deviceAlarmRecord 设备报警记录 + * @return 设备报警记录集合 + */ + public List selectDeviceAlarmRecordList(DeviceAlarmRecord deviceAlarmRecord); + + /** + * 新增设备报警记录 + * + * @param deviceAlarmRecord 设备报警记录 + * @return 结果 + */ + public int insertDeviceAlarmRecord(DeviceAlarmRecord deviceAlarmRecord); + + /** + * 修改设备报警记录 + * + * @param deviceAlarmRecord 设备报警记录 + * @return 结果 + */ + public int updateDeviceAlarmRecord(DeviceAlarmRecord deviceAlarmRecord); + + /** + * 删除设备报警记录 + * + * @param objId 设备报警记录主键 + * @return 结果 + */ + public int deleteDeviceAlarmRecordByObjId(Long objId); + + /** + * 批量删除设备报警记录 + * + * @param objIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDeviceAlarmRecordByObjIds(Long[] objIds); +} diff --git a/aucma-report/src/main/java/com/aucma/report/service/IDeviceAlarmRecordService.java b/aucma-report/src/main/java/com/aucma/report/service/IDeviceAlarmRecordService.java new file mode 100644 index 0000000..2c55658 --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/service/IDeviceAlarmRecordService.java @@ -0,0 +1,61 @@ +package com.aucma.report.service; + +import java.util.List; +import com.aucma.report.domain.DeviceAlarmRecord; + +/** + * 设备报警记录Service接口 + * + * @author Yinq + * @date 2024-03-26 + */ +public interface IDeviceAlarmRecordService +{ + /** + * 查询设备报警记录 + * + * @param objId 设备报警记录主键 + * @return 设备报警记录 + */ + public DeviceAlarmRecord selectDeviceAlarmRecordByObjId(Long objId); + + /** + * 查询设备报警记录列表 + * + * @param deviceAlarmRecord 设备报警记录 + * @return 设备报警记录集合 + */ + public List selectDeviceAlarmRecordList(DeviceAlarmRecord deviceAlarmRecord); + + /** + * 新增设备报警记录 + * + * @param deviceAlarmRecord 设备报警记录 + * @return 结果 + */ + public int insertDeviceAlarmRecord(DeviceAlarmRecord deviceAlarmRecord); + + /** + * 修改设备报警记录 + * + * @param deviceAlarmRecord 设备报警记录 + * @return 结果 + */ + public int updateDeviceAlarmRecord(DeviceAlarmRecord deviceAlarmRecord); + + /** + * 批量删除设备报警记录 + * + * @param objIds 需要删除的设备报警记录主键集合 + * @return 结果 + */ + public int deleteDeviceAlarmRecordByObjIds(Long[] objIds); + + /** + * 删除设备报警记录信息 + * + * @param objId 设备报警记录主键 + * @return 结果 + */ + public int deleteDeviceAlarmRecordByObjId(Long objId); +} diff --git a/aucma-report/src/main/java/com/aucma/report/service/impl/DeviceAlarmRecordServiceImpl.java b/aucma-report/src/main/java/com/aucma/report/service/impl/DeviceAlarmRecordServiceImpl.java new file mode 100644 index 0000000..df09da9 --- /dev/null +++ b/aucma-report/src/main/java/com/aucma/report/service/impl/DeviceAlarmRecordServiceImpl.java @@ -0,0 +1,93 @@ +package com.aucma.report.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.aucma.report.mapper.DeviceAlarmRecordMapper; +import com.aucma.report.domain.DeviceAlarmRecord; +import com.aucma.report.service.IDeviceAlarmRecordService; + +/** + * 设备报警记录Service业务层处理 + * + * @author Yinq + * @date 2024-03-26 + */ +@Service +public class DeviceAlarmRecordServiceImpl implements IDeviceAlarmRecordService +{ + @Autowired + private DeviceAlarmRecordMapper deviceAlarmRecordMapper; + + /** + * 查询设备报警记录 + * + * @param objId 设备报警记录主键 + * @return 设备报警记录 + */ + @Override + public DeviceAlarmRecord selectDeviceAlarmRecordByObjId(Long objId) + { + return deviceAlarmRecordMapper.selectDeviceAlarmRecordByObjId(objId); + } + + /** + * 查询设备报警记录列表 + * + * @param deviceAlarmRecord 设备报警记录 + * @return 设备报警记录 + */ + @Override + public List selectDeviceAlarmRecordList(DeviceAlarmRecord deviceAlarmRecord) + { + return deviceAlarmRecordMapper.selectDeviceAlarmRecordList(deviceAlarmRecord); + } + + /** + * 新增设备报警记录 + * + * @param deviceAlarmRecord 设备报警记录 + * @return 结果 + */ + @Override + public int insertDeviceAlarmRecord(DeviceAlarmRecord deviceAlarmRecord) + { + return deviceAlarmRecordMapper.insertDeviceAlarmRecord(deviceAlarmRecord); + } + + /** + * 修改设备报警记录 + * + * @param deviceAlarmRecord 设备报警记录 + * @return 结果 + */ + @Override + public int updateDeviceAlarmRecord(DeviceAlarmRecord deviceAlarmRecord) + { + return deviceAlarmRecordMapper.updateDeviceAlarmRecord(deviceAlarmRecord); + } + + /** + * 批量删除设备报警记录 + * + * @param objIds 需要删除的设备报警记录主键 + * @return 结果 + */ + @Override + public int deleteDeviceAlarmRecordByObjIds(Long[] objIds) + { + return deviceAlarmRecordMapper.deleteDeviceAlarmRecordByObjIds(objIds); + } + + /** + * 删除设备报警记录信息 + * + * @param objId 设备报警记录主键 + * @return 结果 + */ + @Override + public int deleteDeviceAlarmRecordByObjId(Long objId) + { + return deviceAlarmRecordMapper.deleteDeviceAlarmRecordByObjId(objId); + } +} diff --git a/aucma-report/src/main/resources/mapper/report/DeviceAlarmRecordMapper.xml b/aucma-report/src/main/resources/mapper/report/DeviceAlarmRecordMapper.xml new file mode 100644 index 0000000..b937efb --- /dev/null +++ b/aucma-report/src/main/resources/mapper/report/DeviceAlarmRecordMapper.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + select obj_id, + device_code, + device_name, + device_type, + alarm_info, + alarm_time, + remark, + is_flag, + created_by, + created_time, + batch_id, + param_code, + param_value + from record_alarm_device + + + + + + + + + SELECT seq_device_alarm_record.NEXTVAL as objId FROM DUAL + + insert into RECORD_ALARM_DEVICE + + obj_id, + device_code, + device_name, + device_type, + alarm_info, + alarm_time, + remark, + is_flag, + created_by, + created_time, + batch_id, + param_code, + param_value, + + + #{objId}, + #{deviceCode}, + #{deviceName}, + #{deviceType}, + #{alarmInfo}, + #{alarmTime}, + #{remark}, + #{isFlag}, + #{createdBy}, + #{createdTime}, + #{batchId}, + #{paramCode}, + #{paramValue}, + + + + + update RECORD_ALARM_DEVICE + + device_code = #{deviceCode}, + device_name = #{deviceName}, + device_type = #{deviceType}, + alarm_info = #{alarmInfo}, + alarm_time = #{alarmTime}, + remark = #{remark}, + is_flag = #{isFlag}, + created_by = #{createdBy}, + created_time = #{createdTime}, + batch_id = #{batchId}, + param_code = #{paramCode}, + param_value = #{paramValue}, + + where obj_id = #{objId} + + + + delete + from RECORD_ALARM_DEVICE + where obj_id = #{objId} + + + + delete from RECORD_ALARM_DEVICE where obj_id in + + #{objId} + + + \ No newline at end of file