feat(material): 新增材料类型区分

This commit is contained in:
han0
2023-12-27 11:27:28 +08:00
parent a891790aa1
commit ffb6c8a2eb
5 changed files with 20 additions and 1 deletions

View File

@@ -0,0 +1,8 @@
package mjkf.xinke.main.constant;
public class MaterialType {
public static final Integer MAIN = 1; // 主材
public static final Integer LOCAL = 2; // 地材
}

View File

@@ -39,9 +39,12 @@ public class MaterialController {
@ApiOperation("获取材料树")
@GetMapping("/tree")
public HttpResponse getTree () {
public HttpResponse getTree (
@ApiParam("类型") @RequestParam(value="type") Integer type
) {
LambdaQueryWrapper<Material> query = new LambdaQueryWrapper<>();
query.eq(Material::getIsTree, 1);
query.eq(Material::getType, type);
List<Map<String, Object>> maps = materialService.listMaps(query);
maps = maps.stream().map(map -> convertKeysToLowercase(map)).collect(Collectors.toList());
// todo 列转树改为泛型对象入参

View File

@@ -148,6 +148,7 @@ public class Material extends Model<Material> {
this.unit = params.getUnit();
this.spec = params.getSpec();
this.tax = params.getTax();
this.type = params.getType();
this.isTree = params.getIsTree();
this.updateTime = LocalDateTime.now();
this.createTime = LocalDateTime.now();
@@ -164,6 +165,7 @@ public class Material extends Model<Material> {
this.unit = params.getUnit();
this.spec = params.getSpec();
this.tax = params.getTax();
this.type = params.getType();
this.updateTime = LocalDateTime.now();
this.updateUserName = user.getName();
this.updateUserId = user.getId();

View File

@@ -42,6 +42,9 @@ public class MaterialCreateRequest {
@ApiModelProperty("税率")
private Integer tax;
@ApiModelProperty("类型")
private Integer type;
@ApiModelProperty("是否树")
@JsonProperty(value = "is_tree")
private Integer isTree;

View File

@@ -30,6 +30,9 @@ public class MaterialEditRequest {
@ApiModelProperty("税率")
private Integer tax;
@ApiModelProperty("类型")
private Integer type;
public void check() throws Exception{