完成了配方配置
parent
a81cbeb113
commit
7673701808
@ -0,0 +1,52 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.controller.admin.recipedevicerecord.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 设备点位采集值记录分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class RecipeDeviceRecordPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "编码")
|
||||||
|
private String attributeCode;
|
||||||
|
|
||||||
|
@Schema(description = "名称", example = "张三")
|
||||||
|
private String attributeName;
|
||||||
|
|
||||||
|
@Schema(description = "类型", example = "2")
|
||||||
|
private String attributeType;
|
||||||
|
|
||||||
|
@Schema(description = "数据类型", example = "2")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
@Schema(description = "地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
private String dataUnit;
|
||||||
|
|
||||||
|
@Schema(description = "倍率")
|
||||||
|
private Double ratio;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "设备id", example = "32535")
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "采集值")
|
||||||
|
private Double value;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.controller.admin.recipedevicerecord.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 设备点位采集值记录 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class RecipeDeviceRecordRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13509")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "编码")
|
||||||
|
@ExcelProperty("编码")
|
||||||
|
private String attributeCode;
|
||||||
|
|
||||||
|
@Schema(description = "名称", example = "张三")
|
||||||
|
@ExcelProperty("名称")
|
||||||
|
private String attributeName;
|
||||||
|
|
||||||
|
@Schema(description = "类型", example = "2")
|
||||||
|
@ExcelProperty("类型")
|
||||||
|
private String attributeType;
|
||||||
|
|
||||||
|
@Schema(description = "数据类型", example = "2")
|
||||||
|
@ExcelProperty("数据类型")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
@Schema(description = "地址")
|
||||||
|
@ExcelProperty("地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
@ExcelProperty("单位")
|
||||||
|
private String dataUnit;
|
||||||
|
|
||||||
|
@Schema(description = "倍率")
|
||||||
|
@ExcelProperty("倍率")
|
||||||
|
private Double ratio;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "设备id", example = "32535")
|
||||||
|
@ExcelProperty("设备id")
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "采集值")
|
||||||
|
@ExcelProperty("采集值")
|
||||||
|
private Double value;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.controller.admin.recipedevicerecord.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 设备点位采集值记录新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class RecipeDeviceRecordSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13509")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "编码")
|
||||||
|
private String attributeCode;
|
||||||
|
|
||||||
|
@Schema(description = "名称", example = "张三")
|
||||||
|
private String attributeName;
|
||||||
|
|
||||||
|
@Schema(description = "类型", example = "2")
|
||||||
|
private String attributeType;
|
||||||
|
|
||||||
|
@Schema(description = "数据类型", example = "2")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
@Schema(description = "地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
private String dataUnit;
|
||||||
|
|
||||||
|
@Schema(description = "倍率")
|
||||||
|
private Double ratio;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "设备id", example = "32535")
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
@Schema(description = "采集值")
|
||||||
|
private Double value;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.controller.admin.recipepointrecord;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.recipepointrecord.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.iot.dal.dataobject.recipepointrecord.RecipePointRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.iot.service.recipepointrecord.RecipePointRecordService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - IoT配方点位记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/iot/recipe-point-record")
|
||||||
|
@Validated
|
||||||
|
public class RecipePointRecordController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RecipePointRecordService recipePointRecordService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建IoT配方点位记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('iot:recipe-point-record:create')")
|
||||||
|
public CommonResult<Long> createRecipePointRecord(@Valid @RequestBody RecipePointRecordSaveReqVO createReqVO) {
|
||||||
|
return success(recipePointRecordService.createRecipePointRecord(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新IoT配方点位记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('iot:recipe-point-record:update')")
|
||||||
|
public CommonResult<Boolean> updateRecipePointRecord(@Valid @RequestBody RecipePointRecordSaveReqVO updateReqVO) {
|
||||||
|
recipePointRecordService.updateRecipePointRecord(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除IoT配方点位记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('iot:recipe-point-record:delete')")
|
||||||
|
public CommonResult<Boolean> deleteRecipePointRecord(@RequestParam("id") Long id) {
|
||||||
|
recipePointRecordService.deleteRecipePointRecord(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得IoT配方点位记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('iot:recipe-point-record:query')")
|
||||||
|
public CommonResult<RecipePointRecordRespVO> getRecipePointRecord(@RequestParam("id") Long id) {
|
||||||
|
RecipePointRecordDO recipePointRecord = recipePointRecordService.getRecipePointRecord(id);
|
||||||
|
return success(BeanUtils.toBean(recipePointRecord, RecipePointRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得IoT配方点位记录分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('iot:recipe-point-record:query')")
|
||||||
|
public CommonResult<PageResult<RecipePointRecordRespVO>> getRecipePointRecordPage(@Valid RecipePointRecordPageReqVO pageReqVO) {
|
||||||
|
PageResult<RecipePointRecordDO> pageResult = recipePointRecordService.getRecipePointRecordPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, RecipePointRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出IoT配方点位记录 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('iot:recipe-point-record:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportRecipePointRecordExcel(@Valid RecipePointRecordPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<RecipePointRecordDO> list = recipePointRecordService.getRecipePointRecordPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "IoT配方点位记录.xls", "数据", RecipePointRecordRespVO.class,
|
||||||
|
BeanUtils.toBean(list, RecipePointRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.controller.admin.recipepointrecord.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - IoT配方点位记录分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class RecipePointRecordPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "配方ID", example = "3078")
|
||||||
|
private Long recipeId;
|
||||||
|
|
||||||
|
@Schema(description = "名字", example = "张三")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "最大值")
|
||||||
|
private BigDecimal max;
|
||||||
|
|
||||||
|
@Schema(description = "最小值")
|
||||||
|
private BigDecimal min;
|
||||||
|
|
||||||
|
@Schema(description = "数据类型", example = "2")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
private String dataUnit;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "你说的对")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "参考值")
|
||||||
|
private BigDecimal refer;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.controller.admin.recipepointrecord.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - IoT配方点位记录 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class RecipePointRecordRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19126")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "配方ID", example = "3078")
|
||||||
|
@ExcelProperty("配方ID")
|
||||||
|
private Long recipeId;
|
||||||
|
|
||||||
|
@Schema(description = "名字", example = "张三")
|
||||||
|
@ExcelProperty("名字")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "最大值")
|
||||||
|
@ExcelProperty("最大值")
|
||||||
|
private BigDecimal max;
|
||||||
|
|
||||||
|
@Schema(description = "最小值")
|
||||||
|
@ExcelProperty("最小值")
|
||||||
|
private BigDecimal min;
|
||||||
|
|
||||||
|
@Schema(description = "数据类型", example = "2")
|
||||||
|
@ExcelProperty("数据类型")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
@ExcelProperty("单位")
|
||||||
|
private String dataUnit;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "你说的对")
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "参考值")
|
||||||
|
@ExcelProperty("参考值")
|
||||||
|
private BigDecimal refer;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.controller.admin.recipepointrecord.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - IoT配方点位记录新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class RecipePointRecordSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19126")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "配方ID", example = "3078")
|
||||||
|
private Long recipeId;
|
||||||
|
|
||||||
|
@Schema(description = "名字", example = "张三")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "最大值")
|
||||||
|
private BigDecimal max;
|
||||||
|
|
||||||
|
@Schema(description = "最小值")
|
||||||
|
private BigDecimal min;
|
||||||
|
|
||||||
|
@Schema(description = "数据类型", example = "2")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
private String dataUnit;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "你说的对")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "参考值")
|
||||||
|
private BigDecimal refer;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.dal.dataobject.recipedevicerecord;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备点位采集值记录 DO
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@TableName("iot_recipe_device_record")
|
||||||
|
@KeySequence("iot_recipe_device_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RecipeDeviceRecordDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
private String attributeCode;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String attributeName;
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private String attributeType;
|
||||||
|
/**
|
||||||
|
* 数据类型
|
||||||
|
*/
|
||||||
|
private String dataType;
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String dataUnit;
|
||||||
|
/**
|
||||||
|
* 倍率
|
||||||
|
*/
|
||||||
|
private Double ratio;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
private Long deviceId;
|
||||||
|
/**
|
||||||
|
* 采集值
|
||||||
|
*/
|
||||||
|
private Double value;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,21 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.iot.dal.dataobject.recipeplandetail;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 包含关联信息的配方计划详情DO
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class RecipePlanDetailWithRelationsDO {
|
|
||||||
private Long id;
|
|
||||||
private String code;
|
|
||||||
private String name;
|
|
||||||
private Long recipeId;
|
|
||||||
private String recipeName; // 来自iot_recipe表
|
|
||||||
private Long planId;
|
|
||||||
private String planCode; // 来自mes_plan表
|
|
||||||
private String source;
|
|
||||||
private Boolean isEnable;
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
}
|
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.dal.dataobject.recipepointrecord;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IoT配方点位记录 DO
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@TableName("iot_recipe_point_record")
|
||||||
|
@KeySequence("iot_recipe_point_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RecipePointRecordDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 配方ID
|
||||||
|
*/
|
||||||
|
private Long recipeId;
|
||||||
|
/**
|
||||||
|
* 名字
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 最大值
|
||||||
|
*/
|
||||||
|
private BigDecimal max;
|
||||||
|
/**
|
||||||
|
* 最小值
|
||||||
|
*/
|
||||||
|
private BigDecimal min;
|
||||||
|
/**
|
||||||
|
* 数据类型
|
||||||
|
*/
|
||||||
|
private String dataType;
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String dataUnit;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 参考值
|
||||||
|
*/
|
||||||
|
private BigDecimal refer;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.dal.mysql.recipedevicerecord;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.iot.dal.dataobject.recipedevicerecord.RecipeDeviceRecordDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.recipedevicerecord.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备点位采集值记录 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RecipeDeviceRecordMapper extends BaseMapperX<RecipeDeviceRecordDO> {
|
||||||
|
|
||||||
|
default PageResult<RecipeDeviceRecordDO> selectPage(RecipeDeviceRecordPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<RecipeDeviceRecordDO>()
|
||||||
|
.eqIfPresent(RecipeDeviceRecordDO::getAttributeCode, reqVO.getAttributeCode())
|
||||||
|
.likeIfPresent(RecipeDeviceRecordDO::getAttributeName, reqVO.getAttributeName())
|
||||||
|
.eqIfPresent(RecipeDeviceRecordDO::getAttributeType, reqVO.getAttributeType())
|
||||||
|
.eqIfPresent(RecipeDeviceRecordDO::getDataType, reqVO.getDataType())
|
||||||
|
.eqIfPresent(RecipeDeviceRecordDO::getAddress, reqVO.getAddress())
|
||||||
|
.eqIfPresent(RecipeDeviceRecordDO::getDataUnit, reqVO.getDataUnit())
|
||||||
|
.eqIfPresent(RecipeDeviceRecordDO::getRatio, reqVO.getRatio())
|
||||||
|
.eqIfPresent(RecipeDeviceRecordDO::getRemark, reqVO.getRemark())
|
||||||
|
.eqIfPresent(RecipeDeviceRecordDO::getDeviceId, reqVO.getDeviceId())
|
||||||
|
.betweenIfPresent(RecipeDeviceRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.eqIfPresent(RecipeDeviceRecordDO::getValue, reqVO.getValue())
|
||||||
|
.orderByDesc(RecipeDeviceRecordDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.dal.mysql.recipepointrecord;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.iot.dal.dataobject.recipepointrecord.RecipePointRecordDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.recipepointrecord.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IoT配方点位记录 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RecipePointRecordMapper extends BaseMapperX<RecipePointRecordDO> {
|
||||||
|
|
||||||
|
default PageResult<RecipePointRecordDO> selectPage(RecipePointRecordPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<RecipePointRecordDO>()
|
||||||
|
.eqIfPresent(RecipePointRecordDO::getRecipeId, reqVO.getRecipeId())
|
||||||
|
.likeIfPresent(RecipePointRecordDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(RecipePointRecordDO::getMax, reqVO.getMax())
|
||||||
|
.eqIfPresent(RecipePointRecordDO::getMin, reqVO.getMin())
|
||||||
|
.eqIfPresent(RecipePointRecordDO::getDataType, reqVO.getDataType())
|
||||||
|
.eqIfPresent(RecipePointRecordDO::getDataUnit, reqVO.getDataUnit())
|
||||||
|
.eqIfPresent(RecipePointRecordDO::getRemark, reqVO.getRemark())
|
||||||
|
.betweenIfPresent(RecipePointRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.eqIfPresent(RecipePointRecordDO::getRefer, reqVO.getRefer())
|
||||||
|
.orderByDesc(RecipePointRecordDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.service.recipedevicerecord;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.recipedevicerecord.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.iot.dal.dataobject.recipedevicerecord.RecipeDeviceRecordDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备点位采集值记录 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface RecipeDeviceRecordService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建设备点位采集值记录
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createRecipeDeviceRecord(@Valid RecipeDeviceRecordSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备点位采集值记录
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateRecipeDeviceRecord(@Valid RecipeDeviceRecordSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备点位采集值记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteRecipeDeviceRecord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得设备点位采集值记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 设备点位采集值记录
|
||||||
|
*/
|
||||||
|
RecipeDeviceRecordDO getRecipeDeviceRecord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得设备点位采集值记录分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 设备点位采集值记录分页
|
||||||
|
*/
|
||||||
|
PageResult<RecipeDeviceRecordDO> getRecipeDeviceRecordPage(RecipeDeviceRecordPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.service.recipedevicerecord;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.recipedevicerecord.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.iot.dal.dataobject.recipedevicerecord.RecipeDeviceRecordDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.iot.dal.mysql.recipedevicerecord.RecipeDeviceRecordMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备点位采集值记录 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class RecipeDeviceRecordServiceImpl implements RecipeDeviceRecordService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RecipeDeviceRecordMapper recipeDeviceRecordMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createRecipeDeviceRecord(RecipeDeviceRecordSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
RecipeDeviceRecordDO recipeDeviceRecord = BeanUtils.toBean(createReqVO, RecipeDeviceRecordDO.class);
|
||||||
|
recipeDeviceRecordMapper.insert(recipeDeviceRecord);
|
||||||
|
// 返回
|
||||||
|
return recipeDeviceRecord.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateRecipeDeviceRecord(RecipeDeviceRecordSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateRecipeDeviceRecordExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
RecipeDeviceRecordDO updateObj = BeanUtils.toBean(updateReqVO, RecipeDeviceRecordDO.class);
|
||||||
|
recipeDeviceRecordMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteRecipeDeviceRecord(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateRecipeDeviceRecordExists(id);
|
||||||
|
// 删除
|
||||||
|
recipeDeviceRecordMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateRecipeDeviceRecordExists(Long id) {
|
||||||
|
if (recipeDeviceRecordMapper.selectById(id) == null) {
|
||||||
|
throw exception(RECIPE_DEVICE_RECORD_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecipeDeviceRecordDO getRecipeDeviceRecord(Long id) {
|
||||||
|
return recipeDeviceRecordMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<RecipeDeviceRecordDO> getRecipeDeviceRecordPage(RecipeDeviceRecordPageReqVO pageReqVO) {
|
||||||
|
return recipeDeviceRecordMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.service.recipepointrecord;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.recipepointrecord.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.iot.dal.dataobject.recipepointrecord.RecipePointRecordDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IoT配方点位记录 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface RecipePointRecordService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建IoT配方点位记录
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createRecipePointRecord(@Valid RecipePointRecordSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新IoT配方点位记录
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateRecipePointRecord(@Valid RecipePointRecordSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除IoT配方点位记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteRecipePointRecord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得IoT配方点位记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return IoT配方点位记录
|
||||||
|
*/
|
||||||
|
RecipePointRecordDO getRecipePointRecord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得IoT配方点位记录分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return IoT配方点位记录分页
|
||||||
|
*/
|
||||||
|
PageResult<RecipePointRecordDO> getRecipePointRecordPage(RecipePointRecordPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
package cn.iocoder.yudao.module.iot.service.recipepointrecord;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.iot.controller.admin.recipepointrecord.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.iot.dal.dataobject.recipepointrecord.RecipePointRecordDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.iot.dal.mysql.recipepointrecord.RecipePointRecordMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IoT配方点位记录 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class RecipePointRecordServiceImpl implements RecipePointRecordService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RecipePointRecordMapper recipePointRecordMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createRecipePointRecord(RecipePointRecordSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
RecipePointRecordDO recipePointRecord = BeanUtils.toBean(createReqVO, RecipePointRecordDO.class);
|
||||||
|
recipePointRecordMapper.insert(recipePointRecord);
|
||||||
|
// 返回
|
||||||
|
return recipePointRecord.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateRecipePointRecord(RecipePointRecordSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateRecipePointRecordExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
RecipePointRecordDO updateObj = BeanUtils.toBean(updateReqVO, RecipePointRecordDO.class);
|
||||||
|
recipePointRecordMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteRecipePointRecord(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateRecipePointRecordExists(id);
|
||||||
|
// 删除
|
||||||
|
recipePointRecordMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateRecipePointRecordExists(Long id) {
|
||||||
|
if (recipePointRecordMapper.selectById(id) == null) {
|
||||||
|
throw exception(RECIPE_POINT_RECORD_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecipePointRecordDO getRecipePointRecord(Long id) {
|
||||||
|
return recipePointRecordMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<RecipePointRecordDO> getRecipePointRecordPage(RecipePointRecordPageReqVO pageReqVO) {
|
||||||
|
return recipePointRecordMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<?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="cn.iocoder.yudao.module.iot.dal.mysql.devicecontactmodel.DeviceContactModelMapper">
|
||||||
|
|
||||||
|
<select id="selectAttributeNameAndUnitById" resultType="java.util.Map">
|
||||||
|
SELECT attribute_name, data_unit
|
||||||
|
FROM iot_device_contact_model
|
||||||
|
WHERE id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue