1. 物料新增统一展平属性的接口
2. 修正物料错误的名称
This commit is contained in:
@@ -57,6 +57,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode MATERIAL_CLASSES_NOT_EXISTS = new ErrorCode(1_027_101_003, "物料分类不存在");
|
||||
ErrorCode DEPARTMENT_MATERIAL_NOT_EXISTS = new ErrorCode(1_027_101_004, "组织物料不存在");
|
||||
ErrorCode MATERIAL_HAS_CLASSES_NOT_EXISTS = new ErrorCode(1_027_101_004, "物料持有属性不存在");
|
||||
ErrorCode MATERIAL_HAS_PROPERTIES_CODE_DUPLICATE = new ErrorCode(1_027_101_106, "同一物料下该属性编码已存在");
|
||||
|
||||
ErrorCode MATERIAL_CLASSES_HIERARCHY_INVALID = new ErrorCode(1_027_101_101, "物料分类层级不符合 1-2-3 的层级规则");
|
||||
ErrorCode MATERIAL_CLASSES_PARENT_NOT_EXISTS = new ErrorCode(1_027_101_102, "上级物料分类不存在");
|
||||
|
||||
@@ -80,6 +80,14 @@ public class MaterialInfomationController {
|
||||
return success(materialInfomation);
|
||||
}
|
||||
|
||||
@GetMapping("/list-by-ids")
|
||||
@Operation(summary = "按 ID 批量获得物料信息")
|
||||
@Parameter(name = "ids", description = "编号集合", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('base:material-infomation:query')")
|
||||
public CommonResult<List<MaterialInfomationRespVO>> getMaterialInfomationListByIds(@RequestParam("ids") List<Long> ids) {
|
||||
return success(materialInfomationService.getMaterialInfomationListByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得物料信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('base:material-infomation:query')")
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.zt.plat.module.base.controller.admin.base.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 展平后的物料属性(按属性编码为键)
|
||||
*/
|
||||
@Data
|
||||
public class MaterialInfomationFlatAttributeRespVO {
|
||||
|
||||
@Schema(description = "属性ID")
|
||||
private Long propertiesId;
|
||||
|
||||
@Schema(description = "属性编码")
|
||||
private String propertiesCode;
|
||||
|
||||
@Schema(description = "属性名称")
|
||||
private String propertiesName;
|
||||
|
||||
@Schema(description = "属性数据类型")
|
||||
private String dataType;
|
||||
|
||||
@Schema(description = "属性值(编码/原值)")
|
||||
private String value;
|
||||
|
||||
@Schema(description = "属性值展示(字典标签,若无字典则原值)")
|
||||
private String valueLabel;
|
||||
|
||||
@Schema(description = "字典类型ID")
|
||||
private Long dictTypeId;
|
||||
|
||||
@Schema(description = "计量单位ID")
|
||||
private Long unitId;
|
||||
|
||||
@Schema(description = "计量单位名称")
|
||||
private String unitName;
|
||||
|
||||
@Schema(description = "计量单位符号")
|
||||
private String unitSymbol;
|
||||
|
||||
@Schema(description = "是否关键属性")
|
||||
private Integer isKey;
|
||||
|
||||
@Schema(description = "是否计量定价")
|
||||
private Integer isMetering;
|
||||
|
||||
@Schema(description = "排序号")
|
||||
private Long sort;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.zt.plat.module.base.controller.admin.base.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 物料属性(持有属性)行展示 VO
|
||||
*/
|
||||
@Data
|
||||
public class MaterialInfomationPropertyRespVO {
|
||||
|
||||
@Schema(description = "属性ID")
|
||||
private Long propertiesId;
|
||||
|
||||
@Schema(description = "属性编码")
|
||||
private String propertiesCode;
|
||||
|
||||
@Schema(description = "属性名称")
|
||||
private String propertiesName;
|
||||
|
||||
@Schema(description = "属性数据类型")
|
||||
private String dataType;
|
||||
|
||||
@Schema(description = "属性值(编码/原值)")
|
||||
private String dictionaryDataValue;
|
||||
|
||||
@Schema(description = "属性值展示(字典标签,若无字典则原值)")
|
||||
private String valueLabel;
|
||||
|
||||
@Schema(description = "字典类型ID")
|
||||
private Long dictionaryTypeId;
|
||||
|
||||
@Schema(description = "计量单位ID")
|
||||
private Long unitId;
|
||||
|
||||
@Schema(description = "计量单位名称")
|
||||
private String unitName;
|
||||
|
||||
@Schema(description = "计量单位符号")
|
||||
private String unitSymbol;
|
||||
|
||||
@Schema(description = "是否关键属性")
|
||||
private Integer isKey;
|
||||
|
||||
@Schema(description = "是否计量定价")
|
||||
private Integer isMetering;
|
||||
|
||||
@Schema(description = "排序号")
|
||||
private Long sort;
|
||||
}
|
||||
@@ -2,38 +2,56 @@ package com.zt.plat.module.base.controller.admin.base.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
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;
|
||||
|
||||
@Schema(description = "管理后台 - 物料信息 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class MaterialInfomationRespVO {
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3326")
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "物料编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("物料编码")
|
||||
private String code;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "物料名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@ExcelProperty("物料名称")
|
||||
private String name;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "分类ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@ExcelProperty("分类ID")
|
||||
private Long classesId;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@JsonIgnore
|
||||
@Schema(description = "物料基础字段 + 属性编码->原值的动态键值,基础字段优先,序列化时直接展开为顶层字段")
|
||||
private Map<String, Object> flatAttributes;
|
||||
|
||||
@JsonAnyGetter
|
||||
public Map<String, Object> getFlatAttributes() {
|
||||
return flatAttributes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +1,44 @@
|
||||
package com.zt.plat.module.base.controller.admin.base.vo;
|
||||
|
||||
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 VO
|
||||
*/
|
||||
@Data
|
||||
public class MaterialInfomationSimpleRespVO {
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zt.plat.module.base.controller.admin.base.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 字典值与标签映射的展示 VO
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MaterialInfomationValueLabelVO {
|
||||
|
||||
@Schema(description = "字典标签或原值")
|
||||
private String label;
|
||||
|
||||
@Schema(description = "字典类型ID")
|
||||
private Long dictTypeId;
|
||||
}
|
||||
@@ -20,6 +20,7 @@ public class MdmMaterialViewDO {
|
||||
private String shortDescription;
|
||||
private String longDescription;
|
||||
private String chalcoCode;
|
||||
private String zhongtongCode;
|
||||
private String majorClassCode;
|
||||
private String majorClassName;
|
||||
private String specification;
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.zt.plat.module.base.dal.dataobject.base.MaterialInfomationDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 物料信息 Service 接口
|
||||
@@ -72,4 +73,12 @@ public interface MaterialInfomationService {
|
||||
* @return 精简分页列表
|
||||
*/
|
||||
PageResult<MaterialInfomationSimpleRespVO> getMaterialInfomationSimplePage(MaterialInfomationSimplePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 按 ID 批量查询物料信息(含持有属性)
|
||||
*
|
||||
* @param ids 物料 ID 集合
|
||||
* @return 物料信息列表
|
||||
*/
|
||||
List<MaterialInfomationRespVO> getMaterialInfomationListByIds(Collection<Long> ids);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user