From a79fe4bcbed2157ac40220aa52cbf0f4d0f9adc3 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Sat, 14 Sep 2024 10:34:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=9B=91=E6=B5=8B=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TbDevAttributeController.java | 77 ++++++ .../com/bonus/base/domain/TbDevAttribute.java | 84 +++++++ .../bonus/base/mapper/TbBdRecordMapper.java | 6 +- .../base/mapper/TbDevAttributeMapper.java | 40 +++ .../base/service/TbDevAttributeService.java | 28 +++ .../impl/TbDevAttributeServiceImpl.java | 72 ++++++ .../mapper/base/TbDevAttributeMapper.xml | 231 ++++++++++++++++++ 7 files changed, 535 insertions(+), 3 deletions(-) create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/TbDevAttributeController.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/TbDevAttribute.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/TbDevAttributeMapper.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/service/TbDevAttributeService.java create mode 100644 bonus-modules/bonus-base/src/main/java/com/bonus/base/service/impl/TbDevAttributeServiceImpl.java create mode 100644 bonus-modules/bonus-base/src/main/resources/mapper/base/TbDevAttributeMapper.xml diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/TbDevAttributeController.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/TbDevAttributeController.java new file mode 100644 index 0000000..6b776ef --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/TbDevAttributeController.java @@ -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 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)); + } + + + +} diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/TbDevAttribute.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/TbDevAttribute.java new file mode 100644 index 0000000..e4d94d5 --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/domain/TbDevAttribute.java @@ -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; +} \ No newline at end of file diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/TbBdRecordMapper.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/TbBdRecordMapper.java index 8e31571..15376cb 100644 --- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/TbBdRecordMapper.java +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/TbBdRecordMapper.java @@ -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 { diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/TbDevAttributeMapper.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/TbDevAttributeMapper.java new file mode 100644 index 0000000..c4ba658 --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/mapper/TbDevAttributeMapper.java @@ -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 queryAll(TbDevAttribute record); + + int deleteByPrimaryKey(Long id); + + int deleteByPrimaryKeyIn(List 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 list); +} \ No newline at end of file diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/TbDevAttributeService.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/TbDevAttributeService.java new file mode 100644 index 0000000..bbb9d37 --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/TbDevAttributeService.java @@ -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 list); + + int insert(TbDevAttribute record); + + int insertSelective(TbDevAttribute record); + + TbDevAttribute selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(TbDevAttribute record); + + int updateByPrimaryKey(TbDevAttribute record); + + int updateBatch(List list); + + List queryAll(TbDevAttribute record); + +} diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/impl/TbDevAttributeServiceImpl.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/impl/TbDevAttributeServiceImpl.java new file mode 100644 index 0000000..d77844f --- /dev/null +++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/service/impl/TbDevAttributeServiceImpl.java @@ -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 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 list) { + return tbDevAttributeMapper.updateBatch(list); + } + + @Override + public List queryAll(TbDevAttribute record){ + return tbDevAttributeMapper.queryAll(record); + } + + + + +} diff --git a/bonus-modules/bonus-base/src/main/resources/mapper/base/TbDevAttributeMapper.xml b/bonus-modules/bonus-base/src/main/resources/mapper/base/TbDevAttributeMapper.xml new file mode 100644 index 0000000..3292554 --- /dev/null +++ b/bonus-modules/bonus-base/src/main/resources/mapper/base/TbDevAttributeMapper.xml @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + id, dev_id, jc_name, jc_value, jc_unit, logo_url, del_flag, rel_code, is_warn, jc_time + + + + + update tb_dev_attribute set del_flag = 1 + where id = #{id,jdbcType=BIGINT} + + + + + 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 into tb_dev_attribute + + + id, + + + dev_id, + + + jc_name, + + + jc_value, + + + jc_unit, + + + logo_url, + + + del_flag, + + + rel_code, + + + is_warn, + + + jc_time, + + + + + #{id,jdbcType=BIGINT}, + + + #{devId,jdbcType=BIGINT}, + + + #{jcName,jdbcType=VARCHAR}, + + + #{jcValue,jdbcType=VARCHAR}, + + + #{jcUnit,jdbcType=VARCHAR}, + + + #{logoUrl,jdbcType=VARCHAR}, + + + #{delFlag,jdbcType=INTEGER}, + + + #{relCode,jdbcType=VARCHAR}, + + + #{isWarn,jdbcType=INTEGER}, + + + #{jcTime,jdbcType=VARCHAR}, + + + + + + update tb_dev_attribute + + + 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 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 tb_dev_attribute + + + + when id = #{item.id,jdbcType=BIGINT} then #{item.devId,jdbcType=BIGINT} + + + + + when id = #{item.id,jdbcType=BIGINT} then #{item.jcName,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=BIGINT} then #{item.jcValue,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=BIGINT} then #{item.jcUnit,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=BIGINT} then #{item.logoUrl,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=BIGINT} then #{item.delFlag,jdbcType=INTEGER} + + + + + when id = #{item.id,jdbcType=BIGINT} then #{item.relCode,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=BIGINT} then #{item.isWarn,jdbcType=INTEGER} + + + + + when id = #{item.id,jdbcType=BIGINT} then #{item.jcTime,jdbcType=VARCHAR} + + + + where id in + + #{item.id,jdbcType=BIGINT} + + + + + update tb_dev_attribute set del_flag = 0 where id in + + #{id,jdbcType=BIGINT} + + + + + \ No newline at end of file