设备监测信息
This commit is contained in:
parent
1d6e0d4324
commit
a79fe4bcbe
|
|
@ -0,0 +1,77 @@
|
|||
package com.bonus.base.controller;
|
||||
import com.bonus.base.domain.TbDevAttribute;
|
||||
import com.bonus.base.domain.TbDevice;
|
||||
import com.bonus.base.service.TbDevAttributeService;
|
||||
import com.bonus.base.service.impl.TbDevAttributeServiceImpl;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* 设备监测信息表(tb_dev_attribute)表控制层
|
||||
* @author syruan
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tbDevAttribute")
|
||||
public class TbDevAttributeController extends BaseController {
|
||||
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private TbDevAttributeService tbDevAttributeService;
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*/
|
||||
@GetMapping("{/id}")
|
||||
public TbDevAttribute getById(@PathVariable Long id) {
|
||||
return tbDevAttributeService.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult queryByPage(TbDevAttribute record) {
|
||||
startPage();
|
||||
List<TbDevAttribute> list = tbDevAttributeService.queryAll(record);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param record 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TbDevAttribute record) {
|
||||
return toAjax(tbDevAttributeService.insertSelective(record));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param record 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody TbDevAttribute record) {
|
||||
return toAjax(tbDevAttributeService.updateByPrimaryKeySelective(record));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult deleteById(@PathVariable("id") Long id) {
|
||||
return toAjax(tbDevAttributeService.deleteByPrimaryKey(id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package com.bonus.base.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 设备监测信息表
|
||||
* @author syruan
|
||||
*/
|
||||
@ApiModel(description="设备监测信息表")
|
||||
@Data
|
||||
public class TbDevAttribute implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ApiModelProperty(value="id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
@ApiModelProperty(value="设备id")
|
||||
private Long devId;
|
||||
|
||||
/**
|
||||
* 检测名称
|
||||
*/
|
||||
@ApiModelProperty(value="检测名称")
|
||||
@Size(max = 64,message = "检测名称最大长度要小于 64")
|
||||
private String jcName;
|
||||
|
||||
/**
|
||||
* 检测值
|
||||
*/
|
||||
@ApiModelProperty(value="检测值")
|
||||
@Size(max = 64,message = "检测值最大长度要小于 64")
|
||||
private String jcValue;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ApiModelProperty(value="单位")
|
||||
@Size(max = 64,message = "单位最大长度要小于 64")
|
||||
private String jcUnit;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
@ApiModelProperty(value="图标")
|
||||
@Size(max = 128,message = "图标最大长度要小于 128")
|
||||
private String logoUrl;
|
||||
|
||||
/**
|
||||
* 删除状态
|
||||
*/
|
||||
@ApiModelProperty(value="删除状态")
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 级联编码(唯一)
|
||||
*/
|
||||
@ApiModelProperty(value="级联编码(唯一)")
|
||||
@Size(max = 64,message = "级联编码(唯一)最大长度要小于 64")
|
||||
private String relCode;
|
||||
|
||||
/**
|
||||
* 是否告警 0 正常 1 告警
|
||||
*/
|
||||
@ApiModelProperty(value="是否告警 0 正常 1 告警")
|
||||
private Integer isWarn;
|
||||
|
||||
/**
|
||||
* 检测时间
|
||||
*/
|
||||
@ApiModelProperty(value="检测时间")
|
||||
@Size(max = 32,message = "检测时间最大长度要小于 32")
|
||||
private String jcTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -6,9 +6,9 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@PackagePath: com.bonus.base.mapper
|
||||
*@author : 阮世耀
|
||||
*@version : 1.0
|
||||
* @PackagePath: com.bonus.base.mapper
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbBdRecordMapper {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.bonus.base.mapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.bonus.base.domain.TbDevAttribute;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbDevAttributeMapper {
|
||||
|
||||
List<TbDevAttribute> queryAll(TbDevAttribute record);
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int deleteByPrimaryKeyIn(List<Long> list);
|
||||
|
||||
int insert(TbDevAttribute record);
|
||||
|
||||
int insertSelective(TbDevAttribute record);
|
||||
|
||||
/**
|
||||
* select by primary key
|
||||
*/
|
||||
TbDevAttribute selectByPrimaryKey(Long id);
|
||||
|
||||
/**
|
||||
* update record selective
|
||||
*/
|
||||
int updateByPrimaryKeySelective(TbDevAttribute record);
|
||||
|
||||
/**
|
||||
* update record
|
||||
*/
|
||||
int updateByPrimaryKey(TbDevAttribute record);
|
||||
|
||||
int updateBatch(List<TbDevAttribute> list);
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.base.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.bonus.base.domain.TbDevAttribute;
|
||||
/**
|
||||
* @author : syruan
|
||||
*/
|
||||
public interface TbDevAttributeService{
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int deleteByPrimaryKeyIn(List<Long> list);
|
||||
|
||||
int insert(TbDevAttribute record);
|
||||
|
||||
int insertSelective(TbDevAttribute record);
|
||||
|
||||
TbDevAttribute selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbDevAttribute record);
|
||||
|
||||
int updateByPrimaryKey(TbDevAttribute record);
|
||||
|
||||
int updateBatch(List<TbDevAttribute> list);
|
||||
|
||||
List<TbDevAttribute> queryAll(TbDevAttribute record);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.bonus.base.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
import com.bonus.base.mapper.TbDevAttributeMapper;
|
||||
import com.bonus.base.domain.TbDevAttribute;
|
||||
import com.bonus.base.service.TbDevAttributeService;
|
||||
/**
|
||||
*@PackagePath: com.bonus.base.service.impl
|
||||
*@author : 阮世耀
|
||||
*@CreateTime: 2024-09-14 10:19
|
||||
*@Description: 描述
|
||||
*@version : 1.0
|
||||
*/
|
||||
@Service
|
||||
public class TbDevAttributeServiceImpl implements TbDevAttributeService{
|
||||
|
||||
@Autowired
|
||||
private TbDevAttributeMapper tbDevAttributeMapper;
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(Long id) {
|
||||
return tbDevAttributeMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKeyIn(List<Long> list) {
|
||||
return tbDevAttributeMapper.deleteByPrimaryKeyIn(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(TbDevAttribute record) {
|
||||
return tbDevAttributeMapper.insert(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertSelective(TbDevAttribute record) {
|
||||
return tbDevAttributeMapper.insertSelective(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbDevAttribute selectByPrimaryKey(Long id) {
|
||||
return tbDevAttributeMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKeySelective(TbDevAttribute record) {
|
||||
return tbDevAttributeMapper.updateByPrimaryKeySelective(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKey(TbDevAttribute record) {
|
||||
return tbDevAttributeMapper.updateByPrimaryKey(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateBatch(List<TbDevAttribute> list) {
|
||||
return tbDevAttributeMapper.updateBatch(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbDevAttribute> queryAll(TbDevAttribute record){
|
||||
return tbDevAttributeMapper.queryAll(record);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
<?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.bonus.base.mapper.TbDevAttributeMapper">
|
||||
<resultMap id="BaseResultMap" type="com.bonus.base.domain.TbDevAttribute">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table tb_dev_attribute-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="dev_id" jdbcType="BIGINT" property="devId" />
|
||||
<result column="jc_name" jdbcType="VARCHAR" property="jcName" />
|
||||
<result column="jc_value" jdbcType="VARCHAR" property="jcValue" />
|
||||
<result column="jc_unit" jdbcType="VARCHAR" property="jcUnit" />
|
||||
<result column="logo_url" jdbcType="VARCHAR" property="logoUrl" />
|
||||
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
|
||||
<result column="rel_code" jdbcType="VARCHAR" property="relCode" />
|
||||
<result column="is_warn" jdbcType="INTEGER" property="isWarn" />
|
||||
<result column="jc_time" jdbcType="VARCHAR" property="jcTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, dev_id, jc_name, jc_value, jc_unit, logo_url, del_flag, rel_code, is_warn, jc_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
<!--@mbg.generated-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_dev_attribute
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
update tb_dev_attribute set del_flag = 1
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
|
||||
<insert id="insert" parameterType="com.bonus.base.domain.TbDevAttribute">
|
||||
<!--@mbg.generated-->
|
||||
insert into tb_dev_attribute (id, dev_id, jc_name,
|
||||
jc_value, jc_unit, logo_url,
|
||||
del_flag, rel_code, is_warn,
|
||||
jc_time)
|
||||
values (#{id,jdbcType=BIGINT}, #{devId,jdbcType=BIGINT}, #{jcName,jdbcType=VARCHAR},
|
||||
#{jcValue,jdbcType=VARCHAR}, #{jcUnit,jdbcType=VARCHAR}, #{logoUrl,jdbcType=VARCHAR},
|
||||
1, #{relCode,jdbcType=VARCHAR}, #{isWarn,jdbcType=INTEGER},
|
||||
#{jcTime,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.bonus.base.domain.TbDevAttribute">
|
||||
<!--@mbg.generated-->
|
||||
insert into tb_dev_attribute
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="devId != null">
|
||||
dev_id,
|
||||
</if>
|
||||
<if test="jcName != null and jcName != ''">
|
||||
jc_name,
|
||||
</if>
|
||||
<if test="jcValue != null and jcValue != ''">
|
||||
jc_value,
|
||||
</if>
|
||||
<if test="jcUnit != null and jcUnit != ''">
|
||||
jc_unit,
|
||||
</if>
|
||||
<if test="logoUrl != null and logoUrl != ''">
|
||||
logo_url,
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="relCode != null and relCode != ''">
|
||||
rel_code,
|
||||
</if>
|
||||
<if test="isWarn != null">
|
||||
is_warn,
|
||||
</if>
|
||||
<if test="jcTime != null and jcTime != ''">
|
||||
jc_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="devId != null">
|
||||
#{devId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="jcName != null and jcName != ''">
|
||||
#{jcName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="jcValue != null and jcValue != ''">
|
||||
#{jcValue,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="jcUnit != null and jcUnit != ''">
|
||||
#{jcUnit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="logoUrl != null and logoUrl != ''">
|
||||
#{logoUrl,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
#{delFlag,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="relCode != null and relCode != ''">
|
||||
#{relCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isWarn != null">
|
||||
#{isWarn,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="jcTime != null and jcTime != ''">
|
||||
#{jcTime,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.base.domain.TbDevAttribute">
|
||||
<!--@mbg.generated-->
|
||||
update tb_dev_attribute
|
||||
<set>
|
||||
<if test="devId != null">
|
||||
dev_id = #{devId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="jcName != null and jcName != ''">
|
||||
jc_name = #{jcName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="jcValue != null and jcValue != ''">
|
||||
jc_value = #{jcValue,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="jcUnit != null and jcUnit != ''">
|
||||
jc_unit = #{jcUnit,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="logoUrl != null and logoUrl != ''">
|
||||
logo_url = #{logoUrl,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="relCode != null and relCode != ''">
|
||||
rel_code = #{relCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isWarn != null">
|
||||
is_warn = #{isWarn,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="jcTime != null and jcTime != ''">
|
||||
jc_time = #{jcTime,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.bonus.base.domain.TbDevAttribute">
|
||||
<!--@mbg.generated-->
|
||||
update tb_dev_attribute
|
||||
set dev_id = #{devId,jdbcType=BIGINT},
|
||||
jc_name = #{jcName,jdbcType=VARCHAR},
|
||||
jc_value = #{jcValue,jdbcType=VARCHAR},
|
||||
jc_unit = #{jcUnit,jdbcType=VARCHAR},
|
||||
logo_url = #{logoUrl,jdbcType=VARCHAR},
|
||||
del_flag = #{delFlag,jdbcType=INTEGER},
|
||||
rel_code = #{relCode,jdbcType=VARCHAR},
|
||||
is_warn = #{isWarn,jdbcType=INTEGER},
|
||||
jc_time = #{jcTime,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateBatch" parameterType="java.util.List">
|
||||
<!--@mbg.generated-->
|
||||
update tb_dev_attribute
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<trim prefix="dev_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.devId,jdbcType=BIGINT}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="jc_name = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.jcName,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="jc_value = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.jcValue,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="jc_unit = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.jcUnit,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="logo_url = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.logoUrl,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="del_flag = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.delFlag,jdbcType=INTEGER}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="rel_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.relCode,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="is_warn = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.isWarn,jdbcType=INTEGER}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="jc_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.jcTime,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
||||
#{item.id,jdbcType=BIGINT}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<delete id="deleteByPrimaryKeyIn">
|
||||
update tb_dev_attribute set del_flag = 0 where id in
|
||||
<foreach close=")" collection="list" item="id" open="(" separator=", ">
|
||||
#{id,jdbcType=BIGINT}
|
||||
</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>
|
||||
Loading…
Reference in New Issue