边带调试
This commit is contained in:
parent
ecc2b30eb4
commit
13caf8636c
|
|
@ -1,13 +1,19 @@
|
|||
package com.bonus.base.controller;
|
||||
|
||||
import com.bonus.base.domain.TbBdRecord;
|
||||
import com.bonus.base.domain.TbDevAttribute;
|
||||
import com.bonus.base.service.TbDevAttributeService;
|
||||
import com.bonus.base.vo.TbDevAttributeVo;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -35,7 +41,7 @@ public class TbDevAttributeController extends BaseController {
|
|||
@GetMapping("/list")
|
||||
public AjaxResult queryByPage(TbDevAttribute record) {
|
||||
startPage();
|
||||
List<TbDevAttribute> list = tbDevAttributeService.queryAll(record);
|
||||
List<TbDevAttributeVo> list = tbDevAttributeService.queryAll(record);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
|
|
@ -71,6 +77,26 @@ public class TbDevAttributeController extends BaseController {
|
|||
return toAjax(tbDevAttributeService.deleteByPrimaryKey(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 预警告警异常记录处理
|
||||
* @param handle
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/handle")
|
||||
public AjaxResult approve(TbDevAttribute handle) {
|
||||
return tbDevAttributeService.handle(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预警告警异常记录导出数据
|
||||
* @param response
|
||||
* @param record
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TbDevAttribute record) {
|
||||
List<TbDevAttributeVo> list = tbDevAttributeService.queryAll(record);
|
||||
ExcelUtil<TbDevAttributeVo> util = new ExcelUtil<>(TbDevAttributeVo.class);
|
||||
util.exportExcel(response, list, "预警告警异常记录");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.base.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
|
|
@ -78,7 +79,14 @@ public class TbDevAttribute implements Serializable {
|
|||
*/
|
||||
@ApiModelProperty(value="检测时间")
|
||||
@Size(max = 32,message = "检测时间最大长度要小于 32")
|
||||
@Excel(name = "预警时间")
|
||||
private String jcTime;
|
||||
|
||||
@ApiModelProperty(value="开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value="结束时间")
|
||||
private String endTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
package com.bonus.base.mapper;
|
||||
import com.bonus.base.vo.TbDevAttributeVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -11,7 +12,7 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface TbDevAttributeMapper {
|
||||
|
||||
List<TbDevAttribute> queryAll(TbDevAttribute record);
|
||||
List<TbDevAttributeVo> queryAll(TbDevAttribute record);
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.bonus.base.service;
|
|||
|
||||
import java.util.List;
|
||||
import com.bonus.base.domain.TbDevAttribute;
|
||||
import com.bonus.base.vo.TbDevAttributeVo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* @author : syruan
|
||||
*/
|
||||
|
|
@ -23,6 +26,12 @@ public interface TbDevAttributeService{
|
|||
|
||||
int updateBatch(List<TbDevAttribute> list);
|
||||
|
||||
List<TbDevAttribute> queryAll(TbDevAttribute record);
|
||||
List<TbDevAttributeVo> queryAll(TbDevAttribute record);
|
||||
|
||||
/**
|
||||
* 预警告警异常记录处理
|
||||
* @param handle
|
||||
* @return
|
||||
*/
|
||||
AjaxResult handle(TbDevAttribute handle);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package com.bonus.base.service.impl;
|
||||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.base.vo.TbDevAttributeVo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -62,11 +65,30 @@ public class TbDevAttributeServiceImpl implements TbDevAttributeService{
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<TbDevAttribute> queryAll(TbDevAttribute record){
|
||||
return tbDevAttributeMapper.queryAll(record);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<TbDevAttributeVo> queryAll(TbDevAttribute record){
|
||||
List<TbDevAttributeVo> list = tbDevAttributeMapper.queryAll(record);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (TbDevAttributeVo attribute : list) {
|
||||
if (attribute.getIsWarn() == 1) {
|
||||
attribute.setWarnName(attribute.getJcName() + "超过阈值");
|
||||
attribute.setStatus("未处置");
|
||||
} else {
|
||||
attribute.setWarnName("正常");
|
||||
attribute.setStatus("已处置");
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 预警告警异常记录处理
|
||||
* @param handle
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult handle(TbDevAttribute handle) {
|
||||
int result = tbDevAttributeMapper.updateByPrimaryKeySelective(handle);
|
||||
return result > 0 ? AjaxResult.success("处理成功") : AjaxResult.error("处理失败");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.base.vo;
|
||||
|
||||
import com.bonus.base.domain.TbDevAttribute;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/9/19 19:52
|
||||
*/
|
||||
@Data
|
||||
public class TbDevAttributeVo extends TbDevAttribute {
|
||||
|
||||
/**
|
||||
* 设备类型(码表)
|
||||
*/
|
||||
@ApiModelProperty(value="设备类型(码表)")
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* 设备类型(码表)
|
||||
*/
|
||||
@ApiModelProperty(value="设备类型名称")
|
||||
@Excel(name = "预警设备类型")
|
||||
private String devTypeName;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@ApiModelProperty(value="设备名称")
|
||||
@Excel(name = "预警设备名称")
|
||||
private String devName;
|
||||
|
||||
/**
|
||||
* 设备编码(唯一)
|
||||
*/
|
||||
@ApiModelProperty(value="设备编码(唯一)")
|
||||
@Excel(name = "预警设备编号")
|
||||
private String devCode;
|
||||
|
||||
/**
|
||||
* 是否告警 0 正常 1 告警
|
||||
*/
|
||||
@ApiModelProperty(value="是否告警 0 正常 1 告警")
|
||||
@Excel(name = "预警内容")
|
||||
private String warnName;
|
||||
|
||||
@ApiModelProperty(value="状态")
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
tbr.remarks as remarks, tbr.create_time as createTime, tbr.create_user as createUser, tbr.update_time as updateTime, tbr.update_user as updateUser, tbr.audit_user as auditUser, tbr.audit_time as auditTime,
|
||||
su.nick_name as auditUserName
|
||||
from tb_bd_record tbr
|
||||
left join sys_user su on tbr.audit_user = su.id
|
||||
left join sys_user su on tbr.audit_user = su.user_id
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,36 @@
|
|||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
<select id="queryAll" resultType="com.bonus.base.vo.TbDevAttributeVo">
|
||||
select tda.id as id,
|
||||
tda.dev_id as devId,
|
||||
td.dev_type as devType,
|
||||
sda.dict_label as devTypeName,
|
||||
td.dev_code as devCode,
|
||||
td.dev_name as devName,
|
||||
tda.jc_name as jcName,
|
||||
tda.jc_value as jcValue,
|
||||
tda.jc_unit as jcUnit,
|
||||
tda.logo_url as logoUrl,
|
||||
tda.del_flag as delFlag,
|
||||
tda.rel_code as relCode,
|
||||
tda.is_warn as isWarn,
|
||||
tda.jc_time as jcTime
|
||||
from tb_dev_attribute tda
|
||||
left join tb_device td on tda.dev_id = td.id and td.del_flag = 0
|
||||
left join sys_dict_data sdd on sdd.dict_code = td.dev_type
|
||||
where tda.del_flag = 0
|
||||
<if test="devName != null and devName != ''">
|
||||
and td.dev_name like concat('%',#{devName},'%')
|
||||
</if>
|
||||
<if test="devType != null and devType != ''">
|
||||
and td.dev_type = #{devType}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and tda.jc_time BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
update tb_dev_attribute set del_flag = 1
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
|
|
@ -111,6 +141,7 @@
|
|||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.base.domain.TbDevAttribute">
|
||||
<!--@mbg.generated-->
|
||||
update tb_dev_attribute
|
||||
|
|
@ -145,6 +176,7 @@
|
|||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<update id="updateByPrimaryKey" parameterType="com.bonus.base.domain.TbDevAttribute">
|
||||
<!--@mbg.generated-->
|
||||
update tb_dev_attribute
|
||||
|
|
@ -222,10 +254,5 @@
|
|||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="queryAll" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from tb_dev_attribute
|
||||
where del_flag = 0 or del_flag is null
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -282,7 +282,7 @@
|
|||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_device
|
||||
where 1=1
|
||||
where del_flag = 0
|
||||
<if test="devName != null and devName != ''">
|
||||
<if test="devCode != null and devCode != ''">
|
||||
and (dev_name = #{devName} or dev_code = #{devCode})
|
||||
|
|
|
|||
Loading…
Reference in New Issue