完成了配方配置
parent
0cca100356
commit
9df400104c
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.recipedeviceattribute.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 配方设备属性分页返回DTO
|
||||
*
|
||||
* @author 自定义作者名
|
||||
*/
|
||||
@Data
|
||||
public class RecipeDeviceAttributePageRespDTO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
|
||||
private Long attributeId;
|
||||
|
||||
/**
|
||||
* 属性名称
|
||||
*/
|
||||
private String attributeName;
|
||||
|
||||
/**
|
||||
* 属性类型
|
||||
*/
|
||||
private String attributeType;
|
||||
|
||||
/**
|
||||
* 数据类型
|
||||
*/
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
* 数据单位
|
||||
*/
|
||||
private String dataUnit;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.recipeplandetail;
|
||||
|
||||
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.recipeplandetail.vo.*;
|
||||
import cn.iocoder.yudao.module.iot.dal.dataobject.recipeplandetail.RecipePlanDetailDO;
|
||||
import cn.iocoder.yudao.module.iot.service.recipeplandetail.RecipePlanDetailService;
|
||||
|
||||
@Tag(name = "管理后台 - 配方计划详情表(配方库)")
|
||||
@RestController
|
||||
@RequestMapping("/iot/recipe-plan-detail")
|
||||
@Validated
|
||||
public class RecipePlanDetailController {
|
||||
|
||||
@Resource
|
||||
private RecipePlanDetailService recipePlanDetailService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建配方计划详情表(配方库)")
|
||||
@PreAuthorize("@ss.hasPermission('iot:recipe-plan-detail:create')")
|
||||
public CommonResult<Long> createRecipePlanDetail(@Valid @RequestBody RecipePlanDetailSaveReqVO createReqVO) {
|
||||
return success(recipePlanDetailService.createRecipePlanDetail(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新配方计划详情表(配方库)")
|
||||
@PreAuthorize("@ss.hasPermission('iot:recipe-plan-detail:update')")
|
||||
public CommonResult<Boolean> updateRecipePlanDetail(@Valid @RequestBody RecipePlanDetailSaveReqVO updateReqVO) {
|
||||
recipePlanDetailService.updateRecipePlanDetail(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除配方计划详情表(配方库)")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('iot:recipe-plan-detail:delete')")
|
||||
public CommonResult<Boolean> deleteRecipePlanDetail(@RequestParam("id") Long id) {
|
||||
recipePlanDetailService.deleteRecipePlanDetail(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得配方计划详情表(配方库)")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('iot:recipe-plan-detail:query')")
|
||||
public CommonResult<RecipePlanDetailRespVO> getRecipePlanDetail(@RequestParam("id") Long id) {
|
||||
RecipePlanDetailDO recipePlanDetail = recipePlanDetailService.getRecipePlanDetail(id);
|
||||
return success(BeanUtils.toBean(recipePlanDetail, RecipePlanDetailRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得配方计划详情表(配方库)分页")
|
||||
@PreAuthorize("@ss.hasPermission('iot:recipe-plan-detail:query')")
|
||||
public CommonResult<PageResult<RecipePlanDetailRespVO>> getRecipePlanDetailPage(@Valid RecipePlanDetailPageReqVO pageReqVO) {
|
||||
PageResult<RecipePlanDetailDO> pageResult = recipePlanDetailService.getRecipePlanDetailPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, RecipePlanDetailRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出配方计划详情表(配方库) Excel")
|
||||
@PreAuthorize("@ss.hasPermission('iot:recipe-plan-detail:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportRecipePlanDetailExcel(@Valid RecipePlanDetailPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<RecipePlanDetailDO> list = recipePlanDetailService.getRecipePlanDetailPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "配方计划详情表(配方库).xls", "数据", RecipePlanDetailRespVO.class,
|
||||
BeanUtils.toBean(list, RecipePlanDetailRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.recipeplandetail.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 配方计划详情表(配方库) Response VO")
|
||||
@Data
|
||||
public class RecipePlanDetailRespVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19016")
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "编码(新建时输入)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("编码(新建时输入)")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "名称(新建时输入)", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@ExcelProperty("名称(新建时输入)")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "关联配方ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2489")
|
||||
@ExcelProperty("关联配方ID")
|
||||
private Long recipeId;
|
||||
|
||||
@Schema(description = "配方名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("配方名称")
|
||||
private String recipeName; // 新增关联字段
|
||||
|
||||
@Schema(description = "关联计划ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "28398")
|
||||
@ExcelProperty("关联计划ID")
|
||||
private Long planId;
|
||||
|
||||
@Schema(description = "计划编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("计划编码")
|
||||
private String planCode; // 新增关联字段
|
||||
|
||||
@Schema(description = "来源(新增/生产中)")
|
||||
@ExcelProperty("来源(新增/生产中)")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("是否启用")
|
||||
private Boolean isEnable;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
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;
|
||||
}
|
||||
Loading…
Reference in New Issue