Browse Source

1.字典表返回父名称

dev
zhenghaoyu 1 day ago
parent
commit
f7392c0058
  1. 8
      blade-service-api/blade-dict-api/src/main/java/org/springblade/system/entity/DictBiz.java
  2. 1
      blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DictBizServiceImpl.java

8
blade-service-api/blade-dict-api/src/main/java/org/springblade/system/entity/DictBiz.java

@ -16,10 +16,7 @@
*/
package org.springblade.system.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
@ -104,5 +101,8 @@ public class DictBiz implements Serializable {
@ApiModelProperty(value = "是否已删除")
private Integer isDeleted;
@TableField(exist = false)
@ApiModelProperty(value = "父名称")
private String parentName;
}

1
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DictBizServiceImpl.java

@ -114,6 +114,7 @@ public class DictBizServiceImpl extends ServiceImpl<DictBizMapper, DictBiz> impl
dict.remove("parentId");
DictBiz parentDict = DictBizCache.getById(parentId);
List<DictBiz> list = this.list(Condition.getQueryWrapper(dict, DictBiz.class).lambda().ne(DictBiz::getId, parentId).eq(DictBiz::getCode, parentDict.getCode()).orderByAsc(DictBiz::getSort));
list.forEach(dictBiz -> dictBiz.setParentName(parentDict.getDictValue()));
return DictBizWrapper.build().listNodeVO(list);
}
}

Loading…
Cancel
Save