Commit 2b5deeb5 authored by taabe's avatar taabe

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

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