【fix sonar】 TreeModel.java文件

This commit is contained in:
tianwenbo
2023-03-06 17:45:22 +08:00
parent be8f21ca01
commit 97706c3395
@@ -12,23 +12,23 @@ import com.jero.modules.system.entity.SysPermission;
* 树形列表用到 * 树形列表用到
*/ */
public class TreeModel implements Serializable { public class TreeModel implements Serializable {
private static final long serialVersionUID = 4013193970046502756L; private static final long serialVersionUID = 4013193970046502756L;
private String key; private String key;
private String title; private String title;
private String slotTitle; private String slotTitle;
private boolean isLeaf; private boolean isLeaf;
private String icon; private String icon;
private Integer ruleFlag; private Integer ruleFlag;
private Map<String,String> scopedSlots; private Map<String,String> scopedSlots;
public Map<String, String> getScopedSlots() { public Map<String, String> getScopedSlots() {
return scopedSlots; return scopedSlots;
} }
@@ -68,7 +68,7 @@ public class TreeModel implements Serializable {
public void setIcon(String icon) { public void setIcon(String icon) {
this.icon = icon; this.icon = icon;
} }
private List<TreeModel> children; private List<TreeModel> children;
public List<TreeModel> getChildren() { public List<TreeModel> getChildren() {
@@ -80,9 +80,9 @@ public class TreeModel implements Serializable {
} }
public TreeModel() { public TreeModel() {
} }
public TreeModel(SysPermission permission) { public TreeModel(SysPermission permission) {
this.key = permission.getId(); this.key = permission.getId();
this.icon = permission.getIcon(); this.icon = permission.getIcon();
@@ -93,32 +93,32 @@ public class TreeModel implements Serializable {
this.isLeaf = permission.isLeaf(); this.isLeaf = permission.isLeaf();
this.label = permission.getName(); this.label = permission.getName();
if(!permission.isLeaf()) { if(!permission.isLeaf()) {
this.children = new ArrayList<TreeModel>(); this.children = new ArrayList<>();
} }
} }
public TreeModel(String key,String parentId,String slotTitle,Integer ruleFlag,boolean isLeaf) { public TreeModel(String key,String parentId,String slotTitle,Integer ruleFlag,boolean isLeaf) {
this.key = key; this.key = key;
this.parentId = parentId; this.parentId = parentId;
this.ruleFlag=ruleFlag; this.ruleFlag=ruleFlag;
this.slotTitle = slotTitle; this.slotTitle = slotTitle;
Map<String,String> map = new HashMap<String,String>(); Map<String,String> map = new HashMap<>();
map.put("title", "hasDatarule"); map.put("title", "hasDatarule");
this.scopedSlots = map; this.scopedSlots = map;
this.isLeaf = isLeaf; this.isLeaf = isLeaf;
this.value = key; this.value = key;
if(!isLeaf) { if(!isLeaf) {
this.children = new ArrayList<TreeModel>(); this.children = new ArrayList<>();
} }
} }
private String parentId; private String parentId;
private String label; private String label;
private String value; private String value;
public String getParentId() { public String getParentId() {
return parentId; return parentId;
} }