From 384af78c6334a783e46d1f52f9e447c05fb30ca9 Mon Sep 17 00:00:00 2001 From: wangyinsheng <2310589501@qq.com> Date: Fri, 20 Sep 2024 18:53:55 +0800 Subject: [PATCH] =?UTF-8?q?add:=E6=8E=A7=E5=88=B6=E6=8C=87=E4=BB=A4?= =?UTF-8?q?=E3=80=81=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=8C=87=E4=BB=A4?= =?UTF-8?q?=E7=BB=B4=E6=8A=A4=E7=95=8C=E9=9D=A2=E5=90=8E=E7=AB=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DataInstructController.java | 56 ++++++++++++++++++++++ .../controller/DataRecordController.java | 54 +++++++++++++++++++++ .../maintenance/entity/DataInstructEntity.java | 42 ++++++++++++++++ .../maintenance/entity/DataRecordEntity.java | 40 +++++++++++++++- .../maintenance/mapper/DataInstructMapper.java | 8 ++++ .../maintenance/mapper/DataRecordMapper.java | 7 +++ .../maintenance/service/DataInstructService.java | 40 ++++++++++++++++ .../maintenance/service/DataRecordService.java | 14 ++++++ 8 files changed, 260 insertions(+), 1 deletion(-) create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataInstructEntity.java create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataInstructMapper.java create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataRecordMapper.java create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java new file mode 100644 index 0000000..00abfd0 --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java @@ -0,0 +1,56 @@ +package com.hnac.gglm.bigmodel.maintenance.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity; +import com.hnac.gglm.bigmodel.maintenance.service.DataInstructService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +@RestController +@RequestMapping("/dataInstruct") +@Api(value = "控制指令管理",tags = "控制指令管理") +@AllArgsConstructor +public class DataInstructController { + + private DataInstructService dataInstructService; + + + @PostMapping("/save") + @ApiOperation("保存控制指令") + @ApiOperationSupport(order = 1) + public R save(@RequestBody @Valid DataInstructEntity req) { + return R.data(dataInstructService.save(req)); + } + + @PostMapping("/update") + @ApiOperation("编辑控制指令") + @ApiOperationSupport(order = 2) + public R update(@RequestBody DataInstructEntity req) { + return R.data(dataInstructService.updateById(req)); + } + + @GetMapping("/listPage") + @ApiOperation("控制指令列表查询") + @ApiOperationSupport(order = 3) + public R> listPage(Query query, DataInstructEntity req) { + return R.data(dataInstructService.page(Condition.getPage(query),Condition.getQueryWrapper(req).lambda())); + } + + @DeleteMapping("/removeByIds") + @ApiOperation("删除控制指令") + @ApiOperationSupport(order = 4) + public R removeByIds(@RequestParam @ApiParam("id,按逗号分隔") String ids) { + return R.status(dataInstructService.removeByIds(Func.toLongList(",",ids))); + } + +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java new file mode 100644 index 0000000..7588b01 --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java @@ -0,0 +1,54 @@ +package com.hnac.gglm.bigmodel.maintenance.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity; +import com.hnac.gglm.bigmodel.maintenance.service.DataRecordService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +@RestController +@RequestMapping("/dataRecord") +@Api(value = "数据记录管理",tags = "数据记录管理") +@AllArgsConstructor +public class DataRecordController { + + private DataRecordService dataRecordService; + + @PostMapping("/save") + @ApiOperation("保存数据记录信息") + @ApiOperationSupport(order = 1) + public R save(@RequestBody @Valid DataRecordEntity req) { + return R.data(dataRecordService.save(req)); + } + + @PostMapping("/update") + @ApiOperation("编辑数据记录信息") + @ApiOperationSupport(order = 2) + public R update(@RequestBody DataRecordEntity req) { + return R.data(dataRecordService.updateById(req)); + } + + @GetMapping("/listPage") + @ApiOperation("数据记录列表查询") + @ApiOperationSupport(order = 3) + public R> listPage(Query query, DataRecordEntity req) { + return R.data(dataRecordService.page(Condition.getPage(query),Condition.getQueryWrapper(req).lambda())); + } + + @DeleteMapping("/removeByIds") + @ApiOperation("删除数据记录") + @ApiOperationSupport(order = 4) + public R removeByIds(@RequestParam @ApiParam("id,按逗号分隔") String ids) { + return R.status(dataRecordService.removeByIds(Func.toLongList(",",ids))); + } +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataInstructEntity.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataInstructEntity.java new file mode 100644 index 0000000..d6f4a4a --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataInstructEntity.java @@ -0,0 +1,42 @@ +package com.hnac.gglm.bigmodel.maintenance.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.mp.support.SqlCondition; +import org.springblade.core.tenant.mp.TenantEntity; + +@Data +@EqualsAndHashCode +@TableName("gglm_data_instruct") +@ApiModel(value = "自定义控制指令表",description = "自定义控制指令表") +public class DataInstructEntity extends TenantEntity { + + @ApiModelProperty("item") + private String itemId; + + @ApiModelProperty("站点名称") + @QueryField(condition = SqlCondition.LIKE) + private String stationName; + + @ApiModelProperty("站点ID") + private String stationId; + + @ApiModelProperty("遥控的设备名称") + @QueryField(condition = SqlCondition.LIKE) + private String deviceName; + + @ApiModelProperty("遥控的设备ID") + private String deviceId; + + @ApiModelProperty("遥控名称(不包含站点)") + @QueryField(condition = SqlCondition.LIKE) + private String ykName; + + @ApiModelProperty("用于展示和匹配的全称,一般可设为 站点名称-遥控名称") + private String itemName; + +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataRecordEntity.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataRecordEntity.java index c94fdd6..81cb222 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataRecordEntity.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataRecordEntity.java @@ -1,6 +1,12 @@ package com.hnac.gglm.bigmodel.maintenance.entity; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.mp.support.SqlCondition; import org.springblade.core.tenant.mp.TenantEntity; /** @@ -8,10 +14,42 @@ import org.springblade.core.tenant.mp.TenantEntity; * @Date: 2024/07/04 15:45 */ @Data +@EqualsAndHashCode +@TableName("gglm_data_record") +@ApiModel(value = "自定义数据查询表",description = "自定义数据查询表") public class DataRecordEntity extends TenantEntity { - private String tableId; + @ApiModelProperty("item") + @QueryField(condition = SqlCondition.EQUAL) + private String itemId; + + @ApiModelProperty("站点名称") + @QueryField(condition = SqlCondition.LIKE) + private String stationName; + + @ApiModelProperty("站点ID") + private String stationId; + + @ApiModelProperty("遥控的设备名称") + @QueryField(condition = SqlCondition.LIKE) + private String deviceName; + + @ApiModelProperty("遥控的设备ID") + private String deviceId; + + @ApiModelProperty("用于展示和匹配的全称,一般可设为 站点名称-遥控名称") + private String itemName; + + @ApiModelProperty("记录名称") + @QueryField(condition = SqlCondition.LIKE) + private String recordName; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("取数规则") + private String rule; } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataInstructMapper.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataInstructMapper.java new file mode 100644 index 0000000..cca88da --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataInstructMapper.java @@ -0,0 +1,8 @@ +package com.hnac.gglm.bigmodel.maintenance.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity; + +public interface DataInstructMapper extends BaseMapper { + +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataRecordMapper.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataRecordMapper.java new file mode 100644 index 0000000..f36ba0f --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataRecordMapper.java @@ -0,0 +1,7 @@ +package com.hnac.gglm.bigmodel.maintenance.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity; + +public interface DataRecordMapper extends BaseMapper { +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java new file mode 100644 index 0000000..444c320 --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java @@ -0,0 +1,40 @@ +package com.hnac.gglm.bigmodel.maintenance.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity; +import com.hnac.gglm.bigmodel.maintenance.mapper.DataInstructMapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +@AllArgsConstructor +public class DataInstructService extends BaseServiceImpl { + + public boolean save(DataInstructEntity entity) { + //对遥控名称判重 + LambdaQueryWrapper queryWrapper = new QueryWrapper() + .lambda().eq(DataInstructEntity::getYkName, entity.getYkName()); + Long count = baseMapper.selectCount(queryWrapper); + if (count > 0) { + return false; + } + //保存信息 + return save(entity); + } + + public boolean updateById(DataInstructEntity entity) { + LambdaQueryWrapper queryWrapper = new QueryWrapper() + .lambda().eq(DataInstructEntity::getItemName, entity.getItemName()) + .ne(DataInstructEntity::getId, entity.getId()); + Long count = baseMapper.selectCount(queryWrapper); + if (count > 0) { + return false; + } + //对遥控名称判重 + return true; + } +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java new file mode 100644 index 0000000..ffb3743 --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java @@ -0,0 +1,14 @@ +package com.hnac.gglm.bigmodel.maintenance.service; + +import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity; +import com.hnac.gglm.bigmodel.maintenance.mapper.DataRecordMapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +@AllArgsConstructor +public class DataRecordService extends BaseServiceImpl { +}