1. 物料新增统一展平属性的接口

2. 修正物料错误的名称
This commit is contained in:
chenbowen
2025-12-25 17:33:15 +08:00
parent 80128e275d
commit 529728fc0f
14 changed files with 419 additions and 50 deletions

View File

@@ -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')")

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);
}

Some files were not shown because too many files have changed in this diff Show More