预警调试
This commit is contained in:
parent
53e9193ba4
commit
1b0936cd08
|
|
@ -42,16 +42,6 @@ public class TbUserPostController extends BaseController {
|
|||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult queryById(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(tbUserPostService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
|
|
|
|||
|
|
@ -13,30 +13,6 @@ import java.util.List;
|
|||
*/
|
||||
public interface TbUserPostMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbUserPost queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param tbUserPost 查询条件
|
||||
* @param pageable 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<TbUserPost> queryAllByLimit(TbUserPost tbUserPost, @Param("pageable") Pageable pageable);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param tbUserPost 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(TbUserPost tbUserPost);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
|
|
@ -46,30 +22,6 @@ public interface TbUserPostMapper {
|
|||
*/
|
||||
int insert(TbUserPost tbUserPost);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbUserPost> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<TbUserPost> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<TbUserPost> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<TbUserPost> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbUserPost 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(TbUserPost tbUserPost);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
|
|
|
|||
|
|
@ -13,14 +13,6 @@ import java.util.List;
|
|||
*/
|
||||
public interface TbUserPostService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbUserPost queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
|
|
@ -37,12 +29,5 @@ public interface TbUserPostService {
|
|||
*/
|
||||
AjaxResult insert(TbUserPost tbUserPost);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbUserPost 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
TbUserPost update(TbUserPost tbUserPost);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,16 +21,6 @@ public class TbUserPostServiceImpl implements TbUserPostService {
|
|||
@Resource
|
||||
private TbUserPostMapper tbUserPostDao;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbUserPost queryById(Long id) {
|
||||
return tbUserPostDao.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
|
|
@ -59,16 +49,5 @@ public class TbUserPostServiceImpl implements TbUserPostService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param tbUserPost 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public TbUserPost update(TbUserPost tbUserPost) {
|
||||
this.tbUserPostDao.update(tbUserPost);
|
||||
return this.queryById(tbUserPost.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,28 @@
|
|||
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;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2024/9/19 19:52
|
||||
*/
|
||||
@Data
|
||||
public class TbDevAttributeVo extends TbDevAttribute {
|
||||
public class TbDevAttributeVo {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty(value="主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
@ApiModelProperty(value="设备id")
|
||||
private Long devId;
|
||||
|
||||
/**
|
||||
* 设备类型(码表)
|
||||
|
|
@ -41,6 +51,47 @@ public class TbDevAttributeVo extends TbDevAttribute {
|
|||
@Excel(name = "预警设备编号")
|
||||
private String devCode;
|
||||
|
||||
/**
|
||||
* 检测名称
|
||||
*/
|
||||
@ApiModelProperty(value="检测名称")
|
||||
private String jcName;
|
||||
|
||||
/**
|
||||
* 检测值
|
||||
*/
|
||||
@ApiModelProperty(value="检测值")
|
||||
private String jcValue;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@ApiModelProperty(value="单位")
|
||||
private String jcUnit;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
@ApiModelProperty(value="图标")
|
||||
private String logoUrl;
|
||||
|
||||
/**
|
||||
* 删除状态
|
||||
*/
|
||||
@ApiModelProperty(value="删除状态")
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 级联编码(唯一)
|
||||
*/
|
||||
@ApiModelProperty(value="级联编码(唯一)")
|
||||
private String relCode;
|
||||
|
||||
/**
|
||||
* 是否告警 0 正常 1 告警
|
||||
*/
|
||||
@ApiModelProperty(value="是否告警 0 正常 1 告警")
|
||||
private Integer isWarn;
|
||||
/**
|
||||
* 是否告警 0 正常 1 告警
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,106 +2,28 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.base.mapper.TbUserPostMapper">
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
<select id="queryByPage" resultType="com.bonus.base.domain.TbUserPost">
|
||||
select
|
||||
id as id, post_name as postName, rel_name as relName, rel_phone as relPhone, create_time as createTime, pro_id as proId
|
||||
from tb_user_post
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="postName != null and postName != ''">
|
||||
and post_name = #{postName}
|
||||
</if>
|
||||
<if test="relName != null and relName != ''">
|
||||
and rel_name = #{relName}
|
||||
</if>
|
||||
<if test="relPhone != null and relPhone != ''">
|
||||
and rel_phone = #{relPhone}
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
and pro_id = #{proId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryByPage" resultType="com.bonus.base.domain.TbUserPost">
|
||||
select
|
||||
id, post_name, rel_name, rel_phone, create_time, pro_id
|
||||
from tb_user_post
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="postName != null and postName != ''">
|
||||
and post_name = #{postName}
|
||||
and post_name like concat('%',#{postName},'%')
|
||||
</if>
|
||||
<if test="relName != null and relName != ''">
|
||||
and rel_name = #{relName}
|
||||
and rel_name like concat('%',#{relName},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryById" resultType="com.bonus.base.domain.TbUserPost">
|
||||
select
|
||||
id, post_name, rel_name, rel_phone, create_time, pro_id
|
||||
from tb_user_post
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_user_post(post_name, rel_name, rel_phone, create_time, pro_id)
|
||||
values (#{postName}, #{relName}, #{relPhone}, NOW(), #{proId})
|
||||
values (#{postName}, #{relName}, #{relPhone}, #{createTime}, #{proId})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_user_post(post_name, rel_name, rel_phone, create_time, pro_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.postName}, #{entity.relName}, #{entity.relPhone}, #{entity.createTime}, #{entity.proId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_user_post(post_name, rel_name, rel_phone, create_time, pro_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.postName}, #{entity.relName}, #{entity.relPhone}, #{entity.createTime}, #{entity.proId})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
post_name = values(post_name),
|
||||
rel_name = values(rel_name),
|
||||
rel_phone = values(rel_phone),
|
||||
create_time = values(create_time),
|
||||
pro_id = values(pro_id)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update tb_user_post
|
||||
<set>
|
||||
<if test="postName != null and postName != ''">
|
||||
post_name = #{postName},
|
||||
</if>
|
||||
<if test="relName != null and relName != ''">
|
||||
rel_name = #{relName},
|
||||
</if>
|
||||
<if test="relPhone != null and relPhone != ''">
|
||||
rel_phone = #{relPhone},
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
pro_id = #{proId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue