1. 新增对应的物料信息 feign 接口
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package com.zt.plat.module.base.api.materialinfomation;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationPageReqDTO;
|
||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationRespDTO;
|
||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationSaveReqDTO;
|
||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationSimplePageReqDTO;
|
||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationSimpleRespDTO;
|
||||
import com.zt.plat.module.base.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 物料信息")
|
||||
public interface MaterialInfomationApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/base/material-infomation";
|
||||
|
||||
@PostMapping(PREFIX + "/create")
|
||||
@Operation(summary = "创建物料信息")
|
||||
CommonResult<MaterialInfomationRespDTO> createMaterialInfomation(@Valid @RequestBody MaterialInfomationSaveReqDTO createReqDTO);
|
||||
|
||||
@PutMapping(PREFIX + "/update")
|
||||
@Operation(summary = "更新物料信息")
|
||||
CommonResult<Boolean> updateMaterialInfomation(@Valid @RequestBody MaterialInfomationSaveReqDTO updateReqDTO);
|
||||
|
||||
@DeleteMapping(PREFIX + "/delete")
|
||||
@Operation(summary = "删除物料信息")
|
||||
CommonResult<Boolean> deleteMaterialInfomation(@RequestParam("id") Long id);
|
||||
|
||||
@DeleteMapping(PREFIX + "/delete-list")
|
||||
@Operation(summary = "批量删除物料信息")
|
||||
CommonResult<Boolean> deleteMaterialInfomationList(@RequestBody List<Long> ids);
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获得物料信息")
|
||||
CommonResult<MaterialInfomationRespDTO> getMaterialInfomation(@RequestParam("id") Long id);
|
||||
|
||||
@GetMapping(PREFIX + "/list-by-ids")
|
||||
@Operation(summary = "按 ID 批量获得物料信息")
|
||||
CommonResult<List<MaterialInfomationRespDTO>> getMaterialInfomationListByIds(@RequestParam("ids") List<Long> ids);
|
||||
|
||||
@GetMapping(PREFIX + "/page")
|
||||
@Operation(summary = "获得物料信息分页")
|
||||
CommonResult<PageResult<MaterialInfomationRespDTO>> getMaterialInfomationPage(@Valid MaterialInfomationPageReqDTO pageReqDTO);
|
||||
|
||||
@GetMapping(PREFIX + "/simple-page")
|
||||
@Operation(summary = "获得物料信息精简分页")
|
||||
CommonResult<PageResult<MaterialInfomationSimpleRespDTO>> getMaterialInfomationSimplePage(@Valid MaterialInfomationSimplePageReqDTO pageReqDTO);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.zt.plat.module.base.api.materialinfomation.dto;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 物料信息分页 Request DTO
|
||||
*/
|
||||
@Data
|
||||
public class MaterialInfomationPageReqDTO extends PageParam {
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "物料名称", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "分类ID", example = "1024")
|
||||
private Long classesId;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.zt.plat.module.base.api.materialinfomation.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 物料信息 Response DTO
|
||||
*/
|
||||
@Data
|
||||
public class MaterialInfomationRespDTO {
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3326")
|
||||
private Long id;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "物料编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String code;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "物料名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
private String name;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "分类ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long classesId;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String remark;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "物料基础字段 + 属性编码->原值的动态键值,基础字段优先,序列化时直接展开为顶层字段")
|
||||
private Map<String, Object> flatAttributes;
|
||||
|
||||
@JsonAnyGetter
|
||||
public Map<String, Object> getFlatAttributes() {
|
||||
return flatAttributes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.zt.plat.module.base.api.materialinfomation.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 物料信息新增/修改 Request DTO
|
||||
*/
|
||||
@Data
|
||||
public class MaterialInfomationSaveReqDTO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3326")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "物料编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "物料编码不能为空")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "物料名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotEmpty(message = "物料名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "分类ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "所属分类不能为空")
|
||||
private Long classesId;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zt.plat.module.base.api.materialinfomation.dto;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 物料信息精简分页 Request DTO
|
||||
*/
|
||||
@Schema(description = "物料信息精简分页 Request DTO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MaterialInfomationSimplePageReqDTO extends PageParam {
|
||||
|
||||
@Schema(description = "关键字(编码/名称模糊匹配)")
|
||||
private String keyword;
|
||||
|
||||
@Schema(description = "分类 ID")
|
||||
private Long classesId;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.zt.plat.module.base.api.materialinfomation.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 物料信息精简 Response DTO
|
||||
*/
|
||||
@Data
|
||||
public class MaterialInfomationSimpleRespDTO {
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "物料信息ID", example = "1024")
|
||||
private Long id;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "物料编码")
|
||||
private String code;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "物料名称")
|
||||
private String name;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "分类ID")
|
||||
private Long classesId;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "物料基础字段 + 属性编码->原值的动态键值,基础字段优先,序列化时直接展开为顶层字段")
|
||||
private Map<String, Object> flatAttributes;
|
||||
|
||||
@JsonAnyGetter
|
||||
public Map<String, Object> getFlatAttributes() {
|
||||
return flatAttributes;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user