临边防护-设备告警
This commit is contained in:
parent
d41a8358d8
commit
05e6a7b6c2
@ -0,0 +1,177 @@
|
||||
package com.zhgd.xmgl.modules.frontier.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.frontier.entity.FrontierProtectionDevAlarm;
|
||||
import com.zhgd.xmgl.modules.frontier.service.IFrontierProtectionDevAlarmService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 临边防护-设备告警
|
||||
* @author: pds
|
||||
* @date: 2023-08-01
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/frontierProtectionDevAlarm")
|
||||
@Slf4j
|
||||
@Api(tags = "FrontierProtectionDevAlarmController相关Api")
|
||||
public class FrontierProtectionDevAlarmController {
|
||||
@Autowired
|
||||
private IFrontierProtectionDevAlarmService frontierProtectionDevAlarmService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param frontierProtectionDevAlarm
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = " 分页列表查询临边防护-设备告警信息", notes = "分页列表查询临边防护-设备告警信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<FrontierProtectionDevAlarm>> queryPageList(FrontierProtectionDevAlarm frontierProtectionDevAlarm,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<FrontierProtectionDevAlarm>> result = new Result<IPage<FrontierProtectionDevAlarm>>();
|
||||
IPage<FrontierProtectionDevAlarm> pageList = frontierProtectionDevAlarmService.queryPageList(frontierProtectionDevAlarm, pageNo, pageSize, req);
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @param frontierProtectionDevAlarm
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = " 列表查询临边防护-设备告警信息", notes = "列表查询临边防护-设备告警信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<FrontierProtectionDevAlarm>> queryList(FrontierProtectionDevAlarm frontierProtectionDevAlarm,
|
||||
HttpServletRequest req) {
|
||||
|
||||
QueryWrapper<FrontierProtectionDevAlarm> queryWrapper = QueryGenerator.initQueryWrapper(frontierProtectionDevAlarm, req.getParameterMap());
|
||||
return Result.success(frontierProtectionDevAlarmService.list(queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param frontierProtectionDevAlarm
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = " 添加临边防护-设备告警信息", notes = "添加临边防护-设备告警信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<FrontierProtectionDevAlarm> add(@RequestBody FrontierProtectionDevAlarm frontierProtectionDevAlarm) {
|
||||
Result<FrontierProtectionDevAlarm> result = new Result<FrontierProtectionDevAlarm>();
|
||||
try {
|
||||
frontierProtectionDevAlarmService.save(frontierProtectionDevAlarm);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info(e.getMessage());
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑", notes = "编辑", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<FrontierProtectionDevAlarm> edit(@RequestBody FrontierProtectionDevAlarm frontierProtectionDevAlarm) {
|
||||
Result<FrontierProtectionDevAlarm> result = new Result<FrontierProtectionDevAlarm>();
|
||||
FrontierProtectionDevAlarm frontierProtectionDevAlarmEntity = frontierProtectionDevAlarmService.getById(frontierProtectionDevAlarm.getId());
|
||||
if (frontierProtectionDevAlarmEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
frontierProtectionDevAlarmService.updateById(frontierProtectionDevAlarm);
|
||||
result.success("修改成功!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除临边防护-设备告警信息", notes = "删除临边防护-设备告警信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<FrontierProtectionDevAlarm> delete(@RequestBody String id) {
|
||||
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
|
||||
id = String.valueOf(jsonObject.get("id"));
|
||||
Result<FrontierProtectionDevAlarm> result = new Result<FrontierProtectionDevAlarm>();
|
||||
FrontierProtectionDevAlarm frontierProtectionDevAlarm = frontierProtectionDevAlarmService.getById(id);
|
||||
if (frontierProtectionDevAlarm == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = frontierProtectionDevAlarmService.removeById(id);
|
||||
if (ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量删除临边防护-设备告警信息", notes = "批量删除临边防护-设备告警信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "临边防护-设备告警ID字符串", paramType = "query", required = true, dataType = "String")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<FrontierProtectionDevAlarm> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
Result<FrontierProtectionDevAlarm> result = new Result<FrontierProtectionDevAlarm>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
this.frontierProtectionDevAlarmService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询临边防护-设备告警信息", notes = "通过id查询临边防护-设备告警信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "临边防护-设备告警ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<FrontierProtectionDevAlarm> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<FrontierProtectionDevAlarm> result = new Result<FrontierProtectionDevAlarm>();
|
||||
FrontierProtectionDevAlarm frontierProtectionDevAlarm = frontierProtectionDevAlarmService.getById(id);
|
||||
if (frontierProtectionDevAlarm == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
result.setResult(frontierProtectionDevAlarm);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
package com.zhgd.xmgl.modules.frontier.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 临边防护-设备告警
|
||||
* @author: pds
|
||||
* @date: 2023-08-01
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("frontier_protection_dev_alarm")
|
||||
@ApiModel(value = "FrontierProtectionDevAlarm实体类", description = "FrontierProtectionDevAlarm")
|
||||
public class FrontierProtectionDevAlarm implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private java.lang.Long id;
|
||||
/**
|
||||
* 临边防护设备sn
|
||||
*/
|
||||
@Excel(name = "临边防护设备sn", width = 15)
|
||||
@ApiModelProperty(value = "临边防护设备sn")
|
||||
private java.lang.String devSn;
|
||||
/**
|
||||
* 检测对象
|
||||
*/
|
||||
@Excel(name = "检测对象", width = 15)
|
||||
@ApiModelProperty(value = "检测对象")
|
||||
private java.lang.String detectObject;
|
||||
/**
|
||||
* 告警详情
|
||||
*/
|
||||
@Excel(name = "告警详情", width = 15)
|
||||
@ApiModelProperty(value = "告警详情")
|
||||
private java.lang.String alarmDetail;
|
||||
/**
|
||||
* 告警时间
|
||||
*/
|
||||
@Excel(name = "告警时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "告警时间")
|
||||
private java.util.Date alarmTime;
|
||||
/**
|
||||
* 处置结果1已处置2误报忽略
|
||||
*/
|
||||
@Excel(name = "处置结果1已处置2误报忽略", width = 15)
|
||||
@ApiModelProperty(value = "处置结果1已处置2误报忽略")
|
||||
private java.lang.Integer handleResult;
|
||||
/**
|
||||
* 是否处置过1处置过0未处置
|
||||
*/
|
||||
@ApiModelProperty(value = "是否处置过1处置过0未处置")
|
||||
private java.lang.Integer handleDone;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Excel(name = "描述", width = 15)
|
||||
@ApiModelProperty(value = "描述")
|
||||
private java.lang.String desc;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@Excel(name = "图片", width = 15)
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String image;
|
||||
/**
|
||||
* 项目sn
|
||||
*/
|
||||
@Excel(name = "项目sn", width = 15)
|
||||
@ApiModelProperty(value = "项目sn")
|
||||
private java.lang.String projectSn;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private java.util.Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "设备位置")
|
||||
@TableField(exist = false)
|
||||
private String location;
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
@TableField(exist = false)
|
||||
private String devName;
|
||||
}
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
package com.zhgd.xmgl.modules.frontier.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.zhgd.xmgl.modules.frontier.entity.FrontierProtectionDevAlarm;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Description: 临边防护-设备告警
|
||||
* @author: pds
|
||||
* @date: 2023-08-01
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface FrontierProtectionDevAlarmMapper extends BaseMapper<FrontierProtectionDevAlarm> {
|
||||
|
||||
IPage<FrontierProtectionDevAlarm> queryPageList(Page<FrontierProtectionDevAlarm> page, @Param(Constants.WRAPPER) QueryWrapper<FrontierProtectionDevAlarm> queryWrapper);
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?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.zhgd.xmgl.modules.frontier.mapper.FrontierProtectionDevAlarmMapper">
|
||||
<select id="queryPageList" resultType="com.zhgd.xmgl.modules.frontier.entity.FrontierProtectionDevAlarm">
|
||||
select fpda.*,fpd.dev_name,fpd.location from frontier_protection_dev_alarm fpda join frontier_protection_dev fpd
|
||||
on fpd.dev_sn=fpda.dev_sn
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,18 @@
|
||||
package com.zhgd.xmgl.modules.frontier.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.xmgl.modules.frontier.entity.FrontierProtectionDevAlarm;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description: 临边防护-设备告警
|
||||
* @author: pds
|
||||
* @date: 2023-08-01
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IFrontierProtectionDevAlarmService extends IService<FrontierProtectionDevAlarm> {
|
||||
|
||||
IPage<FrontierProtectionDevAlarm> queryPageList(FrontierProtectionDevAlarm frontierProtectionDevAlarm, Integer pageNo, Integer pageSize, HttpServletRequest req);
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.zhgd.xmgl.modules.frontier.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.frontier.entity.FrontierProtectionDevAlarm;
|
||||
import com.zhgd.xmgl.modules.frontier.mapper.FrontierProtectionDevAlarmMapper;
|
||||
import com.zhgd.xmgl.modules.frontier.service.IFrontierProtectionDevAlarmService;
|
||||
import com.zhgd.xmgl.util.ReflectionUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description: 临边防护-设备告警
|
||||
* @author: pds
|
||||
* @date: 2023-08-01
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class FrontierProtectionDevAlarmServiceImpl extends ServiceImpl<FrontierProtectionDevAlarmMapper, FrontierProtectionDevAlarm> implements IFrontierProtectionDevAlarmService {
|
||||
@Autowired
|
||||
private FrontierProtectionDevAlarmMapper frontierProtectionDevAlarmMapper;
|
||||
|
||||
@Override
|
||||
public IPage<FrontierProtectionDevAlarm> queryPageList(FrontierProtectionDevAlarm frontierProtectionDevAlarm, Integer pageNo, Integer pageSize, HttpServletRequest req) {
|
||||
QueryWrapper<FrontierProtectionDevAlarm> queryWrapper = QueryGenerator.initQueryWrapper(frontierProtectionDevAlarm, req.getParameterMap(),
|
||||
ReflectionUtil.getFieldNameList(FrontierProtectionDevAlarm::getLocation), null, "fpda.");
|
||||
queryWrapper.like(StringUtils.isNotBlank(frontierProtectionDevAlarm.getLocation()), "fpd." + ReflectionUtil.getFieldNameToUlc(FrontierProtectionDevAlarm::getLocation), frontierProtectionDevAlarm.getLocation());
|
||||
Page<FrontierProtectionDevAlarm> page = new Page<>(pageNo, pageSize);
|
||||
IPage<FrontierProtectionDevAlarm> pageList = frontierProtectionDevAlarmMapper.queryPageList(page, queryWrapper);
|
||||
return pageList;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user