feat:新增排产功能模块相关字段,修改新增计划接口
parent
bc9159c1ac
commit
977a16e6c9
@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.product;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ProductRelationRespVO {
|
||||
|
||||
@Schema(description = "ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名称", example = "设备A")
|
||||
private String name;
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package cn.iocoder.yudao.module.erp.controller.admin.productdevicerel;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
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 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.erp.controller.admin.productdevicerel.vo.*;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.productdevicerel.ProductDeviceRelDO;
|
||||
import cn.iocoder.yudao.module.erp.service.productdevicerel.ProductDeviceRelService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Tag(name = "管理后台 - 产品-设备关联")
|
||||
@RestController
|
||||
@RequestMapping("/erp/product-device-rel")
|
||||
@Validated
|
||||
public class ProductDeviceRelController {
|
||||
|
||||
@Resource
|
||||
private ProductDeviceRelService productDeviceRelService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建产品-设备关联")
|
||||
@PreAuthorize("@ss.hasPermission('erp:product-device-rel:create')")
|
||||
public CommonResult<Long> createProductDeviceRel(@Valid @RequestBody ProductDeviceRelSaveReqVO createReqVO) {
|
||||
return success(productDeviceRelService.createProductDeviceRel(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新产品-设备关联")
|
||||
@PreAuthorize("@ss.hasPermission('erp:product-device-rel:update')")
|
||||
public CommonResult<Boolean> updateProductDeviceRel(@Valid @RequestBody ProductDeviceRelSaveReqVO updateReqVO) {
|
||||
productDeviceRelService.updateProductDeviceRel(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除产品-设备关联")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('erp:product-device-rel:delete')")
|
||||
public CommonResult<Boolean> deleteProductDeviceRel(@RequestParam("id") Long id) {
|
||||
productDeviceRelService.deleteProductDeviceRel(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得产品-设备关联")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('erp:product-device-rel:query')")
|
||||
public CommonResult<ProductDeviceRelRespVO> getProductDeviceRel(@RequestParam("id") Long id) {
|
||||
ProductDeviceRelDO productDeviceRel = productDeviceRelService.getProductDeviceRel(id);
|
||||
return success(BeanUtils.toBean(productDeviceRel, ProductDeviceRelRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得产品-设备关联分页")
|
||||
@PreAuthorize("@ss.hasPermission('erp:product-device-rel:query')")
|
||||
public CommonResult<PageResult<ProductDeviceRelRespVO>> getProductDeviceRelPage(@Valid ProductDeviceRelPageReqVO pageReqVO) {
|
||||
PageResult<ProductDeviceRelDO> pageResult = productDeviceRelService.getProductDeviceRelPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ProductDeviceRelRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出产品-设备关联 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('erp:product-device-rel:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportProductDeviceRelExcel(@Valid ProductDeviceRelPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ProductDeviceRelDO> list = productDeviceRelService.getProductDeviceRelPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "产品-设备关联.xls", "数据", ProductDeviceRelRespVO.class,
|
||||
BeanUtils.toBean(list, ProductDeviceRelRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.erp.controller.admin.productdevicerel.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 ProductDeviceRelPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "产品ID", example = "18574")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "设备ID", example = "21075")
|
||||
private Long deviceId;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.erp.controller.admin.productdevicerel.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 ProductDeviceRelRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "28748")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18574")
|
||||
@ExcelProperty("产品ID")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "设备ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21075")
|
||||
@ExcelProperty("设备ID")
|
||||
private Long deviceId;
|
||||
|
||||
@Schema(description = "排序")
|
||||
@ExcelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.erp.controller.admin.productdevicerel.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.*;
|
||||
|
||||
@Schema(description = "管理后台 - 产品-设备关联新增/修改 Request VO")
|
||||
@Data
|
||||
public class ProductDeviceRelSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "28748")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18574")
|
||||
@NotNull(message = "产品ID不能为空")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "设备ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21075")
|
||||
@NotNull(message = "设备ID不能为空")
|
||||
private Long deviceId;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.erp.controller.admin.productmoldrel;
|
||||
|
||||
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.erp.controller.admin.productmoldrel.vo.*;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.productmoldrel.ProductMoldRelDO;
|
||||
import cn.iocoder.yudao.module.erp.service.productmoldrel.ProductMoldRelService;
|
||||
|
||||
@Tag(name = "管理后台 - 产品-模具关联")
|
||||
@RestController
|
||||
@RequestMapping("/erp/product-mold-rel")
|
||||
@Validated
|
||||
public class ProductMoldRelController {
|
||||
|
||||
@Resource
|
||||
private ProductMoldRelService productMoldRelService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建产品-模具关联")
|
||||
@PreAuthorize("@ss.hasPermission('erp:product-mold-rel:create')")
|
||||
public CommonResult<Long> createProductMoldRel(@Valid @RequestBody ProductMoldRelSaveReqVO createReqVO) {
|
||||
return success(productMoldRelService.createProductMoldRel(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新产品-模具关联")
|
||||
@PreAuthorize("@ss.hasPermission('erp:product-mold-rel:update')")
|
||||
public CommonResult<Boolean> updateProductMoldRel(@Valid @RequestBody ProductMoldRelSaveReqVO updateReqVO) {
|
||||
productMoldRelService.updateProductMoldRel(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除产品-模具关联")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('erp:product-mold-rel:delete')")
|
||||
public CommonResult<Boolean> deleteProductMoldRel(@RequestParam("id") Long id) {
|
||||
productMoldRelService.deleteProductMoldRel(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得产品-模具关联")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('erp:product-mold-rel:query')")
|
||||
public CommonResult<ProductMoldRelRespVO> getProductMoldRel(@RequestParam("id") Long id) {
|
||||
ProductMoldRelDO productMoldRel = productMoldRelService.getProductMoldRel(id);
|
||||
return success(BeanUtils.toBean(productMoldRel, ProductMoldRelRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得产品-模具关联分页")
|
||||
@PreAuthorize("@ss.hasPermission('erp:product-mold-rel:query')")
|
||||
public CommonResult<PageResult<ProductMoldRelRespVO>> getProductMoldRelPage(@Valid ProductMoldRelPageReqVO pageReqVO) {
|
||||
PageResult<ProductMoldRelDO> pageResult = productMoldRelService.getProductMoldRelPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ProductMoldRelRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出产品-模具关联 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('erp:product-mold-rel:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportProductMoldRelExcel(@Valid ProductMoldRelPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ProductMoldRelDO> list = productMoldRelService.getProductMoldRelPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "产品-模具关联.xls", "数据", ProductMoldRelRespVO.class,
|
||||
BeanUtils.toBean(list, ProductMoldRelRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.erp.controller.admin.productmoldrel.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 ProductMoldRelPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "产品ID", example = "30420")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "模具ID", example = "243")
|
||||
private Long moldId;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.erp.controller.admin.productmoldrel.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 ProductMoldRelRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "11772")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30420")
|
||||
@ExcelProperty("产品ID")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "模具ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "243")
|
||||
@ExcelProperty("模具ID")
|
||||
private Long moldId;
|
||||
|
||||
@Schema(description = "排序")
|
||||
@ExcelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.erp.controller.admin.productmoldrel.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 ProductMoldRelSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "11772")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30420")
|
||||
@NotNull(message = "产品ID不能为空")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "模具ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "243")
|
||||
@NotNull(message = "模具ID不能为空")
|
||||
private Long moldId;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.erp.dal.dataobject.productdevicerel;
|
||||
|
||||
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("erp_product_device_rel")
|
||||
@KeySequence("erp_product_device_rel_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProductDeviceRelDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 产品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
private Long deviceId;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.erp.dal.dataobject.productmoldrel;
|
||||
|
||||
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("erp_product_mold_rel")
|
||||
@KeySequence("erp_product_mold_rel_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProductMoldRelDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 产品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 模具ID
|
||||
*/
|
||||
private Long moldId;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.erp.dal.mysql.productdevicerel;
|
||||
|
||||
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.erp.dal.dataobject.productdevicerel.ProductDeviceRelDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.erp.controller.admin.productdevicerel.vo.*;
|
||||
|
||||
/**
|
||||
* 产品-设备关联 Mapper
|
||||
*
|
||||
* @author 必硕智能
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProductDeviceRelMapper extends BaseMapperX<ProductDeviceRelDO> {
|
||||
|
||||
default PageResult<ProductDeviceRelDO> selectPage(ProductDeviceRelPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ProductDeviceRelDO>()
|
||||
.eqIfPresent(ProductDeviceRelDO::getProductId, reqVO.getProductId())
|
||||
.eqIfPresent(ProductDeviceRelDO::getDeviceId, reqVO.getDeviceId())
|
||||
.eqIfPresent(ProductDeviceRelDO::getSort, reqVO.getSort())
|
||||
.eqIfPresent(ProductDeviceRelDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(ProductDeviceRelDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ProductDeviceRelDO::getId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.erp.dal.mysql.productmoldrel;
|
||||
|
||||
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.erp.dal.dataobject.productmoldrel.ProductMoldRelDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.erp.controller.admin.productmoldrel.vo.*;
|
||||
|
||||
/**
|
||||
* 产品-模具关联 Mapper
|
||||
*
|
||||
* @author 必硕智能
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProductMoldRelMapper extends BaseMapperX<ProductMoldRelDO> {
|
||||
|
||||
default PageResult<ProductMoldRelDO> selectPage(ProductMoldRelPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ProductMoldRelDO>()
|
||||
.eqIfPresent(ProductMoldRelDO::getProductId, reqVO.getProductId())
|
||||
.eqIfPresent(ProductMoldRelDO::getMoldId, reqVO.getMoldId())
|
||||
.eqIfPresent(ProductMoldRelDO::getSort, reqVO.getSort())
|
||||
.eqIfPresent(ProductMoldRelDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(ProductMoldRelDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ProductMoldRelDO::getId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.erp.service.productdevicerel;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.erp.controller.admin.productdevicerel.vo.*;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.productdevicerel.ProductDeviceRelDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 产品-设备关联 Service 接口
|
||||
*
|
||||
* @author 必硕智能
|
||||
*/
|
||||
public interface ProductDeviceRelService {
|
||||
|
||||
/**
|
||||
* 创建产品-设备关联
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createProductDeviceRel(@Valid ProductDeviceRelSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新产品-设备关联
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateProductDeviceRel(@Valid ProductDeviceRelSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除产品-设备关联
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteProductDeviceRel(Long id);
|
||||
|
||||
/**
|
||||
* 获得产品-设备关联
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 产品-设备关联
|
||||
*/
|
||||
ProductDeviceRelDO getProductDeviceRel(Long id);
|
||||
|
||||
/**
|
||||
* 获得产品-设备关联分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 产品-设备关联分页
|
||||
*/
|
||||
PageResult<ProductDeviceRelDO> getProductDeviceRelPage(ProductDeviceRelPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package cn.iocoder.yudao.module.erp.service.productdevicerel;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.erp.controller.admin.productdevicerel.vo.*;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.productdevicerel.ProductDeviceRelDO;
|
||||
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.erp.dal.mysql.productdevicerel.ProductDeviceRelMapper;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 产品-设备关联 Service 实现类
|
||||
*
|
||||
* @author 必硕智能
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ProductDeviceRelServiceImpl implements ProductDeviceRelService {
|
||||
|
||||
@Resource
|
||||
private ProductDeviceRelMapper productDeviceRelMapper;
|
||||
|
||||
@Override
|
||||
public Long createProductDeviceRel(ProductDeviceRelSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ProductDeviceRelDO productDeviceRel = BeanUtils.toBean(createReqVO, ProductDeviceRelDO.class);
|
||||
productDeviceRelMapper.insert(productDeviceRel);
|
||||
// 返回
|
||||
return productDeviceRel.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProductDeviceRel(ProductDeviceRelSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateProductDeviceRelExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ProductDeviceRelDO updateObj = BeanUtils.toBean(updateReqVO, ProductDeviceRelDO.class);
|
||||
productDeviceRelMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProductDeviceRel(Long id) {
|
||||
// 校验存在
|
||||
validateProductDeviceRelExists(id);
|
||||
// 删除
|
||||
productDeviceRelMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateProductDeviceRelExists(Long id) {
|
||||
if (productDeviceRelMapper.selectById(id) == null) {
|
||||
throw exception(PRODUCT_DEVICE_REL_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductDeviceRelDO getProductDeviceRel(Long id) {
|
||||
return productDeviceRelMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ProductDeviceRelDO> getProductDeviceRelPage(ProductDeviceRelPageReqVO pageReqVO) {
|
||||
return productDeviceRelMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.erp.service.productmoldrel;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.erp.controller.admin.productmoldrel.vo.*;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.productmoldrel.ProductMoldRelDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 产品-模具关联 Service 接口
|
||||
*
|
||||
* @author 必硕智能
|
||||
*/
|
||||
public interface ProductMoldRelService {
|
||||
|
||||
/**
|
||||
* 创建产品-模具关联
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createProductMoldRel(@Valid ProductMoldRelSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新产品-模具关联
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateProductMoldRel(@Valid ProductMoldRelSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除产品-模具关联
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteProductMoldRel(Long id);
|
||||
|
||||
/**
|
||||
* 获得产品-模具关联
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 产品-模具关联
|
||||
*/
|
||||
ProductMoldRelDO getProductMoldRel(Long id);
|
||||
|
||||
/**
|
||||
* 获得产品-模具关联分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 产品-模具关联分页
|
||||
*/
|
||||
PageResult<ProductMoldRelDO> getProductMoldRelPage(ProductMoldRelPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.erp.service.productmoldrel;
|
||||
|
||||
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.erp.controller.admin.productmoldrel.vo.*;
|
||||
import cn.iocoder.yudao.module.erp.dal.dataobject.productmoldrel.ProductMoldRelDO;
|
||||
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.erp.dal.mysql.productmoldrel.ProductMoldRelMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 产品-模具关联 Service 实现类
|
||||
*
|
||||
* @author 必硕智能
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ProductMoldRelServiceImpl implements ProductMoldRelService {
|
||||
|
||||
@Resource
|
||||
private ProductMoldRelMapper productMoldRelMapper;
|
||||
|
||||
@Override
|
||||
public Long createProductMoldRel(ProductMoldRelSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ProductMoldRelDO productMoldRel = BeanUtils.toBean(createReqVO, ProductMoldRelDO.class);
|
||||
productMoldRelMapper.insert(productMoldRel);
|
||||
// 返回
|
||||
return productMoldRel.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProductMoldRel(ProductMoldRelSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateProductMoldRelExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ProductMoldRelDO updateObj = BeanUtils.toBean(updateReqVO, ProductMoldRelDO.class);
|
||||
productMoldRelMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProductMoldRel(Long id) {
|
||||
// 校验存在
|
||||
validateProductMoldRelExists(id);
|
||||
// 删除
|
||||
productMoldRelMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateProductMoldRelExists(Long id) {
|
||||
if (productMoldRelMapper.selectById(id) == null) {
|
||||
throw exception(PRODUCT_MOLD_REL_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductMoldRelDO getProductMoldRel(Long id) {
|
||||
return productMoldRelMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ProductMoldRelDO> getProductMoldRelPage(ProductMoldRelPageReqVO pageReqVO) {
|
||||
return productMoldRelMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue