Browse Source

add:控制指令、数据查询指令维护界面后端接口开发

zhongwei
wangyinsheng 2 months ago
parent
commit
384af78c63
  1. 56
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java
  2. 54
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java
  3. 42
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataInstructEntity.java
  4. 40
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/DataRecordEntity.java
  5. 8
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataInstructMapper.java
  6. 7
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/DataRecordMapper.java
  7. 40
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataInstructService.java
  8. 14
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java

56
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<IPage<DataInstructEntity>> 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)));
}
}

54
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<IPage<DataRecordEntity>> 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)));
}
}

42
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;
}

40
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;
}

8
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<DataInstructEntity> {
}

7
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<DataRecordEntity> {
}

40
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<DataInstructMapper, DataInstructEntity> {
public boolean save(DataInstructEntity entity) {
//对遥控名称判重
LambdaQueryWrapper<DataInstructEntity> queryWrapper = new QueryWrapper<DataInstructEntity>()
.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<DataInstructEntity> queryWrapper = new QueryWrapper<DataInstructEntity>()
.lambda().eq(DataInstructEntity::getItemName, entity.getItemName())
.ne(DataInstructEntity::getId, entity.getId());
Long count = baseMapper.selectCount(queryWrapper);
if (count > 0) {
return false;
}
//对遥控名称判重
return true;
}
}

14
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<DataRecordMapper, DataRecordEntity> {
}
Loading…
Cancel
Save