feat(material): 新增材料类型区分
This commit is contained in:
8
src/main/java/mjkf/xinke/main/constant/MaterialType.java
Normal file
8
src/main/java/mjkf/xinke/main/constant/MaterialType.java
Normal 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; // 地材
|
||||||
|
}
|
||||||
|
|
@@ -39,9 +39,12 @@ public class MaterialController {
|
|||||||
|
|
||||||
@ApiOperation("获取材料树")
|
@ApiOperation("获取材料树")
|
||||||
@GetMapping("/tree")
|
@GetMapping("/tree")
|
||||||
public HttpResponse getTree () {
|
public HttpResponse getTree (
|
||||||
|
@ApiParam("类型") @RequestParam(value="type") Integer type
|
||||||
|
) {
|
||||||
LambdaQueryWrapper<Material> query = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Material> query = new LambdaQueryWrapper<>();
|
||||||
query.eq(Material::getIsTree, 1);
|
query.eq(Material::getIsTree, 1);
|
||||||
|
query.eq(Material::getType, type);
|
||||||
List<Map<String, Object>> maps = materialService.listMaps(query);
|
List<Map<String, Object>> maps = materialService.listMaps(query);
|
||||||
maps = maps.stream().map(map -> convertKeysToLowercase(map)).collect(Collectors.toList());
|
maps = maps.stream().map(map -> convertKeysToLowercase(map)).collect(Collectors.toList());
|
||||||
// todo 列转树改为泛型对象入参
|
// todo 列转树改为泛型对象入参
|
||||||
|
@@ -148,6 +148,7 @@ public class Material extends Model<Material> {
|
|||||||
this.unit = params.getUnit();
|
this.unit = params.getUnit();
|
||||||
this.spec = params.getSpec();
|
this.spec = params.getSpec();
|
||||||
this.tax = params.getTax();
|
this.tax = params.getTax();
|
||||||
|
this.type = params.getType();
|
||||||
this.isTree = params.getIsTree();
|
this.isTree = params.getIsTree();
|
||||||
this.updateTime = LocalDateTime.now();
|
this.updateTime = LocalDateTime.now();
|
||||||
this.createTime = LocalDateTime.now();
|
this.createTime = LocalDateTime.now();
|
||||||
@@ -164,6 +165,7 @@ public class Material extends Model<Material> {
|
|||||||
this.unit = params.getUnit();
|
this.unit = params.getUnit();
|
||||||
this.spec = params.getSpec();
|
this.spec = params.getSpec();
|
||||||
this.tax = params.getTax();
|
this.tax = params.getTax();
|
||||||
|
this.type = params.getType();
|
||||||
this.updateTime = LocalDateTime.now();
|
this.updateTime = LocalDateTime.now();
|
||||||
this.updateUserName = user.getName();
|
this.updateUserName = user.getName();
|
||||||
this.updateUserId = user.getId();
|
this.updateUserId = user.getId();
|
||||||
|
@@ -42,6 +42,9 @@ public class MaterialCreateRequest {
|
|||||||
@ApiModelProperty("税率")
|
@ApiModelProperty("税率")
|
||||||
private Integer tax;
|
private Integer tax;
|
||||||
|
|
||||||
|
@ApiModelProperty("类型")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
@ApiModelProperty("是否树")
|
@ApiModelProperty("是否树")
|
||||||
@JsonProperty(value = "is_tree")
|
@JsonProperty(value = "is_tree")
|
||||||
private Integer isTree;
|
private Integer isTree;
|
||||||
|
@@ -30,6 +30,9 @@ public class MaterialEditRequest {
|
|||||||
@ApiModelProperty("税率")
|
@ApiModelProperty("税率")
|
||||||
private Integer tax;
|
private Integer tax;
|
||||||
|
|
||||||
|
@ApiModelProperty("类型")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
|
||||||
public void check() throws Exception{
|
public void check() throws Exception{
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user