Commit 2b5deeb5 authored by taabe's avatar taabe

修改树节点对象,添加节点类型字段

parent 5c0be843
......@@ -2,6 +2,9 @@ package com.yeejoin.amos.boot.biz.common.utils;
import java.util.List;
/**
* @author DELL
*/
public class MenuFrom {
public String id;
public String key;
......@@ -10,73 +13,104 @@ public class MenuFrom {
public String label;
public String name;
public String parentId;
public Boolean isLeaf=true;
public Boolean isLeaf = true;
public List<MenuFrom> children;
/**
* 节点类型
*/
public String nodeType;
public MenuFrom(String id, String value, String key, String title, String label, String name, String parentId,
String nodeType) {
super();
this.id = id;
this.value = value;
this.key = key;
this.title = title;
this.label = label;
this.name = name;
this.parentId = parentId;
this.nodeType = nodeType;
}
public MenuFrom(String key, String name, String parentId, String nodeType) {
super();
this.id = key;
this.value = key;
this.key = key;
this.title = name;
this.label = name;
this.name = name;
this.parentId = parentId;
this.nodeType = nodeType;
}
public MenuFrom() {
super();
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public Boolean getIsLeaf() {
return isLeaf;
}
public void setIsLeaf(Boolean isLeaf) {
this.isLeaf = isLeaf;
}
public List<MenuFrom> getChildren() {
return children;
}
public void setChildren(List<MenuFrom> children) {
this.children = children;
}
public MenuFrom(String id,String value,String key, String title, String label, String name, String parentId) {
super();
this.id = id;
this.value = value;
this.key = key;
this.title = title;
this.label = label;
this.name = name;
this.parentId = parentId;
}
public MenuFrom(String key, String name, String parentId) {
super();
this.id = key;
this.value = key;
this.key = key;
this.title = name;
this.label = name;
this.name = name;
this.parentId = parentId;
}
public MenuFrom() {
super();
public String getNodeType() {
return nodeType;
}
public void setNodeType(String nodeType) {
this.nodeType = nodeType;
}
}
......@@ -21,4 +21,10 @@ public class FireTeamListDto {
@ApiModelProperty(value = "父级id")
private Long parent;
@ApiModelProperty(value = "树节点类型(1:单位,0:队伍)")
private String nodeType;
@ApiModelProperty(value = "树节点id")
private Long id;
}
......@@ -26,10 +26,12 @@
cb_fire_team a
WHERE
a.is_delete = 0
<if test='par.parent!=null'>and a.parent = #{par.parent}</if>
<if test='par.typeCode!=null'>and a.type_code = #{par.typeCode}</if>
<if test='par.companyCode!=null'>and a.company_code = #{par.companyCode}</if>
<if test='par.name!=null'>and a.name like concat('%', #{par.name}, '%')</if>
<if test='par.parent != null'>and a.parent = #{par.parent}</if>
<if test='par.typeCode != null'>and a.type_code = #{par.typeCode}</if>
<if test='par.companyCode != null'>and a.company_code = #{par.companyCode}</if>
<if test='par.name != null'>and a.name like concat('%', #{par.name}, '%')</if>
<if test='par.nodeType != null and par.nodeType == "1"'>and a.company = #{par.id}</if>
<if test='par.nodeType != null and par.nodeType == "0"'>and a.parent = #{par.id}</if>
</select>
<select id="listFireTeamDto" resultType="com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto">
......
......@@ -211,8 +211,9 @@ public class DataDictionaryController extends BaseController {
return ResponseHelper.buildResponse(obj);
}else{
Collection<DataDictionary> list=iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus =TreeParser.getTreexin(null, list, DataDictionary.class.getName(),"getCode",0, "getName", "getParent");
MenuFrom Me= new MenuFrom( "-1", "-1", "-1", "危化品库", "危化品库", "危化品库", "-1");
List<MenuFrom> menus =TreeParser.getTreexin(null, list, DataDictionary.class.getName(),"getCode",0,
"getName", "getParent", "getNodeType");
MenuFrom Me= new MenuFrom( "-1", "-1", "-1", "危化品库", "危化品库", "危化品库", "-1", null);
Me.setIsLeaf(false);
Me.setChildren(menus);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE+type, JSON.toJSON(Me),time);
......@@ -240,7 +241,8 @@ public class DataDictionaryController extends BaseController {
}else{
Collection<DataDictionary> list=iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus = null;
menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(),"getCode",0, "getName", "getParent");
menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(),"getCode",0, "getName",
"getParent", "getNodeType");
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE_XIN+type, JSON.toJSON(menus),time);
objectObjectHashMap.put(type,menus);
}
......
......@@ -30,7 +30,7 @@ public class EquipmentServiceImpl {
List<Map<String, Object>> fireSystemMapList = (List<Map<String, Object>>) response.getResult();
List<MenuFrom> fireSystemDtoList = Lists.newArrayList();
fireSystemMapList.forEach(system -> {
MenuFrom menuFrom = new MenuFrom((String) system.get("id"), (String) system.get("name"), "0");
MenuFrom menuFrom = new MenuFrom((String) system.get("id"), (String) system.get("name"), "0", "0");
fireSystemDtoList.add(menuFrom);
});
return fireSystemDtoList;
......@@ -45,7 +45,8 @@ public class EquipmentServiceImpl {
List<Map<String, Object>> buildingMapList = (List<Map<String, Object>>) response.getResult();
List<MenuFrom> buildingTreeList = Lists.newArrayList();
buildingMapList.forEach(building -> {
MenuFrom menuFrom = new MenuFrom((String) building.get("id"), "全部建筑", (String) building.get("parentId"));
MenuFrom menuFrom = new MenuFrom((String) building.get("id"), "全部建筑", (String) building.get("parentId"),
"0");
List<Map<String, Object>> children = (List<Map<String, Object>>) building.get("children");
menuFrom.setChildren(parseTree(menuFrom, children));
menuFrom.setIsLeaf(false);
......@@ -58,7 +59,8 @@ public class EquipmentServiceImpl {
List<MenuFrom> menuFromList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(children)) {
children.forEach(child -> {
MenuFrom menuFrom = new MenuFrom((String) child.get("id"), (String) child.get("name"), (String) child.get("parentId"));
MenuFrom menuFrom = new MenuFrom((String) child.get("id"), (String) child.get("name"),
(String) child.get("parentId"), "0");
if (!ValidationUtil.isEmpty(child.get("children"))) {
parseTree(menuFrom, (List<Map<String, Object>>) child.get("children"));
} else {
......
......@@ -14,7 +14,6 @@ import com.yeejoin.amos.boot.module.common.api.dto.FireTeamListDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.feign.EquipFeignClient;
......@@ -29,7 +28,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 消防队伍 服务实现类
......@@ -112,7 +110,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
* @return
*/
public List<MenuFrom> getCompanyTeamTree() throws Exception {
MenuFrom root = new MenuFrom("-1", "消防队伍", null);
MenuFrom root = new MenuFrom("-1", "消防队伍", null, null);
// 机场单位
List<OrgUsr> companyDeptList = orgUsrService.selectCompanyDepartmentMsg();
List<MenuFrom> companyDeptMenuList = Lists.newArrayList();
......@@ -120,7 +118,8 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
if (ValidationUtil.isEmpty(o.getParentId())) {
o.setParentId("-1");
}
companyDeptMenuList.add(new MenuFrom(o.getSequenceNbr().toString(), o.getBizOrgName(), o.getParentId()));
companyDeptMenuList.add(new MenuFrom(o.getSequenceNbr().toString(), o.getBizOrgName(), o.getParentId(),
"1"));
});
// 消防队伍
List<MenuFrom> teamMenuList = Lists.newArrayList();
......@@ -130,12 +129,12 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
// 将单位下没有上级队伍的队伍直接挂在单位下(方便组成树结构)
team.setParent(team.getCompany());
}
teamMenuList.add(new MenuFrom(team.getSequenceNbr().toString(), team.getName(), team.getParent().toString()));
teamMenuList.add(new MenuFrom(team.getSequenceNbr().toString(), team.getName(),
team.getParent().toString(), "1"));
});
companyDeptMenuList.addAll(teamMenuList);
List<MenuFrom> menuList = TreeParser.getTreexin("-1", companyDeptMenuList, MenuFrom.class.getName(), "getKey",
1, "getName",
"getParentId");
1, "getName", "getParentId", "getNodeType");
root.setChildren(menuList);
return Lists.newArrayList(root);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment