fix(material): 新增是否树的判断标识
This commit is contained in:
@@ -40,7 +40,8 @@ public class MaterialController {
|
|||||||
@ApiOperation("获取材料树")
|
@ApiOperation("获取材料树")
|
||||||
@GetMapping("/tree")
|
@GetMapping("/tree")
|
||||||
public HttpResponse getTree () {
|
public HttpResponse getTree () {
|
||||||
QueryWrapper<Material> query = new QueryWrapper<>();
|
LambdaQueryWrapper<Material> query = new LambdaQueryWrapper<>();
|
||||||
|
query.eq(Material::getIsTree, 1);
|
||||||
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 列转树改为泛型对象入参
|
||||||
@@ -65,15 +66,18 @@ public class MaterialController {
|
|||||||
@ApiParam(value = "父节点id") @RequestParam("parent_id") String parentId
|
@ApiParam(value = "父节点id") @RequestParam("parent_id") String parentId
|
||||||
) {
|
) {
|
||||||
LambdaQueryWrapper<Material> query = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Material> query = new LambdaQueryWrapper<>();
|
||||||
|
query.eq(Material::getIsTree, 0);
|
||||||
if (parentId != null) {
|
if (parentId != null) {
|
||||||
query.eq(Material::getParentId, parentId);
|
query.eq(Material::getParentId, parentId);
|
||||||
}
|
}
|
||||||
|
if (keyWord != null) {
|
||||||
query.and(q -> q
|
query.and(q -> q
|
||||||
.like(Material::getCategory1, keyWord).or()
|
.like(Material::getCategory1, keyWord).or()
|
||||||
.like(Material::getCategory2, keyWord).or()
|
.like(Material::getCategory2, keyWord).or()
|
||||||
.like(Material::getCategory3, keyWord).or()
|
.like(Material::getCategory3, keyWord).or()
|
||||||
.like(Material::getCategory4, keyWord)
|
.like(Material::getCategory4, keyWord)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
var result = materialService.list(query);
|
var result = materialService.list(query);
|
||||||
|
|
||||||
return FuHttpResponse.Builder().dataResponse(result).build();
|
return FuHttpResponse.Builder().dataResponse(result).build();
|
||||||
|
@@ -119,6 +119,10 @@ public class Material extends Model<Material> {
|
|||||||
@TableField("`TYPE`")
|
@TableField("`TYPE`")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否树")
|
||||||
|
@TableField("`IS_TREE`")
|
||||||
|
private Integer isTree;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Serializable pkVal() {
|
public Serializable pkVal() {
|
||||||
return this.id;
|
return this.id;
|
||||||
@@ -144,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.isTree = params.getIsTree();
|
||||||
this.updateTime = LocalDateTime.now();
|
this.updateTime = LocalDateTime.now();
|
||||||
this.createTime = LocalDateTime.now();
|
this.createTime = LocalDateTime.now();
|
||||||
this.createUserName = user.getName();
|
this.createUserName = user.getName();
|
||||||
|
@@ -40,6 +40,9 @@ public class MaterialCreateRequest {
|
|||||||
@ApiModelProperty("税率")
|
@ApiModelProperty("税率")
|
||||||
private Integer tax;
|
private Integer tax;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否树")
|
||||||
|
private Integer isTree;
|
||||||
|
|
||||||
public void check() throws Exception{
|
public void check() throws Exception{
|
||||||
String flag = this.parentId.replace(".00", "");
|
String flag = this.parentId.replace(".00", "");
|
||||||
if (!this.id.contains(flag)) {
|
if (!this.id.contains(flag)) {
|
||||||
|
Reference in New Issue
Block a user