Commit d867eb0b authored by tangwei's avatar tangwei

修改bug

parent 2d283e19
...@@ -196,7 +196,7 @@ public class DataDictionaryController extends BaseController { ...@@ -196,7 +196,7 @@ public class DataDictionaryController extends BaseController {
} else { } else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper); Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", null); "getParent", null,null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time); redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return ResponseHelper.buildResponse(menus); return ResponseHelper.buildResponse(menus);
} }
...@@ -218,7 +218,7 @@ public class DataDictionaryController extends BaseController { ...@@ -218,7 +218,7 @@ public class DataDictionaryController extends BaseController {
} else { } else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper); Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", null); "getParent", null,null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time); redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return ResponseHelper.buildResponse(menus); return ResponseHelper.buildResponse(menus);
} }
...@@ -299,14 +299,14 @@ public class DataDictionaryController extends BaseController { ...@@ -299,14 +299,14 @@ public class DataDictionaryController extends BaseController {
// kongfm 2021-09-08 // kongfm 2021-09-08
// 数据字典还原 by kongfm 2021-09-09 // 数据字典还原 by kongfm 2021-09-09
menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", "getParent", menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", "getParent",
null); null,null);
} else { } else {
list = iDataDictionaryService.list(queryWrapper); list = iDataDictionaryService.list(queryWrapper);
// 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by // 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by
// kongfm 2021-09-08 // kongfm 2021-09-08
// 数据字典还原 by kongfm 2021-09-09 // 数据字典还原 by kongfm 2021-09-09
menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", "getParent", menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", "getParent",
null); null,null);
} }
// 创建根节点 // 创建根节点
Menu menu = new Menu(-1L, rootName, -1L, menus, 0); Menu menu = new Menu(-1L, rootName, -1L, menus, 0);
...@@ -367,7 +367,7 @@ public class DataDictionaryController extends BaseController { ...@@ -367,7 +367,7 @@ public class DataDictionaryController extends BaseController {
} else { } else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper); Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", null); "getParent", null,null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time); redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return ResponseHelper.buildResponse(menus); return ResponseHelper.buildResponse(menus);
} }
......
...@@ -32,4 +32,8 @@ public interface DataDictionaryMapper extends BaseMapper<DataDictionary> { ...@@ -32,4 +32,8 @@ public interface DataDictionaryMapper extends BaseMapper<DataDictionary> {
public List<DataDictionary> getFireTeamTypeTree(String bizOrgCode); public List<DataDictionary> getFireTeamTypeTree(String bizOrgCode);
public List<DataDictionary> getwaterResourceTypeTree(String bizOrgCode); public List<DataDictionary> getwaterResourceTypeTree(String bizOrgCode);
public List<DataDictionary> getFirefightersJobTitle(String type);
} }
...@@ -48,4 +48,10 @@ public class DataDictionary extends BaseEntity { ...@@ -48,4 +48,10 @@ public class DataDictionary extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private int count; private int count;
@ApiModelProperty(value = "树code")
@TableField(exist = false)
private String treeCode;
} }
...@@ -76,7 +76,7 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da ...@@ -76,7 +76,7 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da
// 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by kongfm 2021-09-08 // 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by kongfm 2021-09-08
// 数据字典还原 by kongfm 2021-09-09 // 数据字典还原 by kongfm 2021-09-09
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName" List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
, "getParent", null); , "getParent", null,null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time); redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return menus; return menus;
} }
...@@ -129,8 +129,9 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da ...@@ -129,8 +129,9 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da
public List<Menu> getFireTeamTypeTree(String bizOrgCode) throws Exception { public List<Menu> getFireTeamTypeTree(String bizOrgCode) throws Exception {
// Menu root = new Menu(null, "消防队伍类型", null, null,0); // Menu root = new Menu(null, "消防队伍类型", null, null,0);
List<DataDictionary> list= dataDictionaryMapper.getFireTeamTypeTree(bizOrgCode); List<DataDictionary> list= dataDictionaryMapper.getFireTeamTypeTree(bizOrgCode);
List<Menu> menus = TreeParser.getTreeContainsCount(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", List<Menu> menus = TreeParser.getTreeContainsCount(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", "getCount"); "getParent", "getCount","getTreeCode");
// root.setChildren(menus); // root.setChildren(menus);
for (Menu m:menus for (Menu m:menus
) { ) {
......
...@@ -16,7 +16,8 @@ public class Menu { ...@@ -16,7 +16,8 @@ public class Menu {
public Long parentId; public Long parentId;
public Boolean isRoot; public Boolean isRoot;
public List<Menu> children; public List<Menu> children;
public int num; public String treeCode;
public int num;
public int getNum() { public int getNum() {
return num; return num;
} }
...@@ -28,9 +29,16 @@ public class Menu { ...@@ -28,9 +29,16 @@ public class Menu {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.parentId = parentId2; this.parentId = parentId2;
this.num = num; this.num = num;
} }
public Menu(Long id, String name, Long parentId2,int num,String treeCode) {
super();
this.id = id;
this.name = name;
this.parentId = parentId2;
this.num = num;
this.treeCode = treeCode;
}
public Menu(Long id, String name, Long parentId, List<Menu> children,int num) { public Menu(Long id, String name, Long parentId, List<Menu> children,int num) {
super(); super();
this.id = id; this.id = id;
......
...@@ -37,7 +37,7 @@ public class TreeParser { ...@@ -37,7 +37,7 @@ public class TreeParser {
* </PRE> * </PRE>
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static List<Menu> getTree(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, List<FirefightersTreeDto> list) throws Exception { public static List<Menu> getTree(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, List<FirefightersTreeDto> list, String treeCode) throws Exception {
List<Menu> resultList = new ArrayList<>(); List<Menu> resultList = new ArrayList<>();
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
Class clazz = Class.forName(packageURL); Class clazz = Class.forName(packageURL);
...@@ -59,6 +59,10 @@ public class TreeParser { ...@@ -59,6 +59,10 @@ public class TreeParser {
Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName); Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName);
Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName); Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName);
Method treeCodeName =null;
if(treeCode!=null){
treeCodeName = clazz.getDeclaredMethod(treeCode);
}
//获取顶层元素集合 //获取顶层元素集合
Long parentId; Long parentId;
for (Object ob : entityList) { for (Object ob : entityList) {
...@@ -80,13 +84,21 @@ public class TreeParser { ...@@ -80,13 +84,21 @@ public class TreeParser {
; ;
} }
Menu menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num);
Menu menu = null;
if(treeCodeName!=null){
String treeCodeNamedat = String.valueOf(treeCodeName.invoke(entity));
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num,treeCodeNamedat);
}else{
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num);
}
resultList.add(menu); resultList.add(menu);
} }
} }
//获取每个顶层元素的子数据集合 //获取每个顶层元素的子数据集合
for (Menu entity : resultList) { for (Menu entity : resultList) {
entity.setChildren(getSub(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, list)); entity.setChildren(getSub(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, list,treeCode));
} }
return resultList; return resultList;
...@@ -96,7 +108,7 @@ public class TreeParser { ...@@ -96,7 +108,7 @@ public class TreeParser {
* 获取子数据集合 * 获取子数据集合
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static List<Menu> getSub(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, List<FirefightersTreeDto> list) throws Exception { private static List<Menu> getSub(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, List<FirefightersTreeDto> list, String treeCode) throws Exception {
List<Menu> childList = new ArrayList<>(); List<Menu> childList = new ArrayList<>();
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
Class clazz = Class.forName(packageURL); Class clazz = Class.forName(packageURL);
...@@ -117,6 +129,10 @@ public class TreeParser { ...@@ -117,6 +129,10 @@ public class TreeParser {
} }
Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName); Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName);
Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName); Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName);
Method treeCodeName =null;
if(treeCode!=null){
treeCodeName = clazz.getDeclaredMethod(treeCode);
}
Long parentId; Long parentId;
//子集的直接子对象 //子集的直接子对象
for (Object ob : entityList) { for (Object ob : entityList) {
...@@ -139,7 +155,13 @@ public class TreeParser { ...@@ -139,7 +155,13 @@ public class TreeParser {
; ;
} }
Menu menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num); Menu menu = null;
if(treeCodeName!=null){
String treeCodeNamedat = String.valueOf(treeCodeName.invoke(entity));
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num,treeCodeNamedat);
}else{
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num);
}
childList.add(menu); childList.add(menu);
} }
} else { } else {
...@@ -158,7 +180,13 @@ public class TreeParser { ...@@ -158,7 +180,13 @@ public class TreeParser {
; ;
} }
Menu menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num); Menu menu = null;
if(treeCodeName!=null){
String treeCodeNamedat = String.valueOf(treeCodeName.invoke(entity));
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num,treeCodeNamedat);
}else{
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num);
}
childList.add(menu); childList.add(menu);
} }
} }
...@@ -167,7 +195,7 @@ public class TreeParser { ...@@ -167,7 +195,7 @@ public class TreeParser {
//子集的间接子对象 //子集的间接子对象
for (Menu entity : childList) { for (Menu entity : childList) {
entity.setChildren(getSub(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, list)); entity.setChildren(getSub(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, list,treeCode));
} }
//递归退出条件 //递归退出条件
...@@ -345,7 +373,7 @@ public class TreeParser { ...@@ -345,7 +373,7 @@ public class TreeParser {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static List<Menu> getTreeContainsCount(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String COUNTMethodName) throws Exception { public static List<Menu> getTreeContainsCount(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String COUNTMethodName, String treeCode) throws Exception {
List<Menu> resultList = new ArrayList<>(); List<Menu> resultList = new ArrayList<>();
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
Class clazz = Class.forName(packageURL); Class clazz = Class.forName(packageURL);
...@@ -368,6 +396,11 @@ public class TreeParser { ...@@ -368,6 +396,11 @@ public class TreeParser {
Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName); Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName);
Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName); Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName);
Method COUNTMethodName1 = clazz.getDeclaredMethod(COUNTMethodName); Method COUNTMethodName1 = clazz.getDeclaredMethod(COUNTMethodName);
Method treeCodeName =null;
if(treeCode!=null){
treeCodeName = clazz.getDeclaredMethod(treeCode);
}
//获取顶层元素集合 //获取顶层元素集合
Long parentId; Long parentId;
for (Object ob : entityList) { for (Object ob : entityList) {
...@@ -379,14 +412,22 @@ public class TreeParser { ...@@ -379,14 +412,22 @@ public class TreeParser {
if (parentId == null || parentId.equals(topId) ) {//陈浩2021-12-01修改 topId == parentId 的判断 if (parentId == null || parentId.equals(topId) ) {//陈浩2021-12-01修改 topId == parentId 的判断
String codeString = String.valueOf(IDMethodNameme.invoke(entity)); String codeString = String.valueOf(IDMethodNameme.invoke(entity));
Integer num = Integer.parseInt(String.valueOf(COUNTMethodName1.invoke(entity))); Integer num = Integer.parseInt(String.valueOf(COUNTMethodName1.invoke(entity)));
Menu menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num); Menu menu = null;
if(treeCodeName!=null){
String treeCodeNamedat = String.valueOf(treeCodeName.invoke(entity));
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num,treeCodeNamedat);
}else{
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num);
}
resultList.add(menu); resultList.add(menu);
} }
} }
//获取每个顶层元素的子数据集合 //获取每个顶层元素的子数据集合
for (Menu entity : resultList) { for (Menu entity : resultList) {
entity.setChildren(getSubContainsCount(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, COUNTMethodName)); entity.setChildren(getSubContainsCount(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, COUNTMethodName,treeCode));
} }
return resultList; return resultList;
...@@ -396,7 +437,7 @@ public class TreeParser { ...@@ -396,7 +437,7 @@ public class TreeParser {
* 获取子数据集合 * 获取子数据集合
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static List<Menu> getSubContainsCount(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName,String COUNTMethodName) throws Exception { private static List<Menu> getSubContainsCount(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName,String COUNTMethodName, String treeCode) throws Exception {
List<Menu> childList = new ArrayList<>(); List<Menu> childList = new ArrayList<>();
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
Class clazz = Class.forName(packageURL); Class clazz = Class.forName(packageURL);
...@@ -418,6 +459,10 @@ public class TreeParser { ...@@ -418,6 +459,10 @@ public class TreeParser {
Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName); Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName);
Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName); Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName);
Method COUNTMethodName1 = clazz.getDeclaredMethod(COUNTMethodName); Method COUNTMethodName1 = clazz.getDeclaredMethod(COUNTMethodName);
Method treeCodeName =null;
if(treeCode!=null){
treeCodeName = clazz.getDeclaredMethod(treeCode);
}
Long parentId; Long parentId;
//子集的直接子对象 //子集的直接子对象
for (Object ob : entityList) { for (Object ob : entityList) {
...@@ -430,7 +475,17 @@ public class TreeParser { ...@@ -430,7 +475,17 @@ public class TreeParser {
String codeString = String.valueOf(IDMethodNameme.invoke(entity)); String codeString = String.valueOf(IDMethodNameme.invoke(entity));
Integer num = Integer.parseInt(String.valueOf(COUNTMethodName1.invoke(entity))); Integer num = Integer.parseInt(String.valueOf(COUNTMethodName1.invoke(entity)));
Menu menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num);
Menu menu = null;
if(treeCodeName!=null){
String treeCodeNamedat = String.valueOf(treeCodeName.invoke(entity));
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num,treeCodeNamedat);
}else{
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num);
}
childList.add(menu); childList.add(menu);
} }
} else { } else {
...@@ -439,7 +494,15 @@ public class TreeParser { ...@@ -439,7 +494,15 @@ public class TreeParser {
String codeString = String.valueOf(IDMethodNameme.invoke(entity)); String codeString = String.valueOf(IDMethodNameme.invoke(entity));
Integer num = Integer.parseInt(String.valueOf(COUNTMethodName1.invoke(entity))); Integer num = Integer.parseInt(String.valueOf(COUNTMethodName1.invoke(entity)));
Menu menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num);
Menu menu = null;
if(treeCodeName!=null){
String treeCodeNamedat = String.valueOf(treeCodeName.invoke(entity));
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num,treeCodeNamedat);
}else{
menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num);
}
childList.add(menu); childList.add(menu);
} }
} }
...@@ -448,7 +511,7 @@ public class TreeParser { ...@@ -448,7 +511,7 @@ public class TreeParser {
//子集的间接子对象 //子集的间接子对象
for (Menu entity : childList) { for (Menu entity : childList) {
entity.setChildren(getSubContainsCount(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, COUNTMethodName)); entity.setChildren(getSubContainsCount(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, COUNTMethodName,treeCode));
} }
//递归退出条件 //递归退出条件
......
...@@ -60,7 +60,7 @@ GROUP BY ...@@ -60,7 +60,7 @@ GROUP BY
<select id="getFireTeamTypeTree" resultType="com.yeejoin.amos.boot.biz.common.entity.DataDictionary"> <select id="getFireTeamTypeTree" resultType="com.yeejoin.amos.boot.biz.common.entity.DataDictionary">
SELECT SELECT
cdd.*, case when fire.count is null then 0 else fire.count end as count cdd.*,getParentListCode(cdd.sequence_nbr) treeCode, case when fire.count is null then 0 else fire.count end as count
FROM FROM
cb_data_dictionary cdd cb_data_dictionary cdd
LEFT JOIN ( LEFT JOIN (
...@@ -78,6 +78,19 @@ GROUP BY ...@@ -78,6 +78,19 @@ GROUP BY
WHERE WHERE
cdd.type = 'XFJGLX' cdd.type = 'XFJGLX'
</select> </select>
<select id ="getFirefightersJobTitle" resultType="com.yeejoin.amos.boot.biz.common.entity.DataDictionary">
SELECT
*,getParentListCode(sequence_nbr) treeCode
FROM
cb_data_dictionary cbb
WHERE
cbb.type = #{type}
</select>
<select id="getwaterResourceTypeTree" resultType="com.yeejoin.amos.boot.biz.common.entity.DataDictionary"> <select id="getwaterResourceTypeTree" resultType="com.yeejoin.amos.boot.biz.common.entity.DataDictionary">
SELECT SELECT
cdd.*, case when fire.count is null then 0 else fire.count end as count cdd.*, case when fire.count is null then 0 else fire.count end as count
......
...@@ -203,7 +203,7 @@ public class FireExpertsController extends BaseController { ...@@ -203,7 +203,7 @@ public class FireExpertsController extends BaseController {
i.setName(i.getName()+" ("+i.getCount()+")"); i.setName(i.getName()+" ("+i.getCount()+")");
}); });
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName" List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
, "getParent",null); , "getParent",null,null);
Menu menu = new Menu(-1L, "专家领域", -1L, menus,0); Menu menu = new Menu(-1L, "专家领域", -1L, menus,0);
List<Menu> menuList = new ArrayList<>(); List<Menu> menuList = new ArrayList<>();
menuList.add(menu); menuList.add(menu);
......
...@@ -180,13 +180,13 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -180,13 +180,13 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
public List<Menu> getTeamTree(Map<String, Object> columnMap) throws Exception { public List<Menu> getTeamTree(Map<String, Object> columnMap) throws Exception {
Collection<FireTeam> list = this.listByMap(columnMap); Collection<FireTeam> list = this.listByMap(columnMap);
return TreeParser.getTree(null, list, FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent", return TreeParser.getTree(null, list, FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent",
null); null,null);
} }
public List<Menu> getTeamTreeLikeCode(QueryWrapper<FireTeam> columnMap) throws Exception { public List<Menu> getTeamTreeLikeCode(QueryWrapper<FireTeam> columnMap) throws Exception {
Collection<FireTeam> list = this.list(columnMap); Collection<FireTeam> list = this.list(columnMap);
return TreeParser.getTree(null, list, FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent", return TreeParser.getTree(null, list, FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent",
null); null,null);
} }
/** /**
* 获取机场单位-队伍树 * 获取机场单位-队伍树
...@@ -476,7 +476,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -476,7 +476,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
queryWrapper.eq(FireTeam::getIsDelete, false); queryWrapper.eq(FireTeam::getIsDelete, false);
return TreeParser.getTree(null, this.baseMapper.selectList(queryWrapper), FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent", return TreeParser.getTree(null, this.baseMapper.selectList(queryWrapper), FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent",
null); null,null);
} }
/** /**
...@@ -504,7 +504,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -504,7 +504,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
return null; return null;
} }
return TreeParser.getTree(parentFireTeam.getSequenceNbr(), this.baseMapper.selectList(queryWrapper), FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent", return TreeParser.getTree(parentFireTeam.getSequenceNbr(), this.baseMapper.selectList(queryWrapper), FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent",
null); null,null);
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
......
...@@ -4,6 +4,7 @@ import java.util.Collection; ...@@ -4,6 +4,7 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -45,7 +46,8 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi ...@@ -45,7 +46,8 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
DataDictionaryServiceImpl iDataDictionaryService; DataDictionaryServiceImpl iDataDictionaryService;
@Autowired @Autowired
FirefightersContactsServiceImpl firefightersContactsService; FirefightersContactsServiceImpl firefightersContactsService;
@Autowired
DataDictionaryMapper dataDictionaryMapper;
@Override @Override
public List<FirefightersZhDto> getFirefighters(int pageNum, int pageSize, FirefightersDto par) { public List<FirefightersZhDto> getFirefighters(int pageNum, int pageSize, FirefightersDto par) {
return firefightersMapper.getFirefighters(pageNum, pageSize, par); return firefightersMapper.getFirefighters(pageNum, pageSize, par);
...@@ -119,12 +121,14 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi ...@@ -119,12 +121,14 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
@Override @Override
public List<Menu> getFirefightersJobTitleCount(String bizOrgCode) throws Exception { public List<Menu> getFirefightersJobTitleCount(String bizOrgCode) throws Exception {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>(); // QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", "GWMC"); // queryWrapper.eq("type", "GWMC");
queryWrapper.orderByAsc("sort_num"); // queryWrapper.orderByAsc("sort_num");
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper); // Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
Collection<DataDictionary> list =dataDictionaryMapper.getFirefightersJobTitle("GWMC");
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", firefightersMapper.getFirefightersJobTitleCount(bizOrgCode)); "getParent", firefightersMapper.getFirefightersJobTitleCount(bizOrgCode),"getTreeCode");
for (Menu m:menus for (Menu m:menus
) { ) {
if( null != m.children) { if( null != m.children) {
......
...@@ -295,7 +295,7 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU ...@@ -295,7 +295,7 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU
List<Menu> menuList = new ArrayList<Menu>(); List<Menu> menuList = new ArrayList<Menu>();
try { try {
List<Menu> menus = TreeParser.getTree(null, resultList, DataDictionary.class.getName(), "getCode", 0, "getName", List<Menu> menus = TreeParser.getTree(null, resultList, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", null); "getParent", null,null);
Menu menu = new Menu(-1L, rootName, -1L, menus, 0); Menu menu = new Menu(-1L, rootName, -1L, menus, 0);
// 挂在主节点 // 挂在主节点
menuList.add(menu); menuList.add(menu);
......
...@@ -2770,5 +2770,28 @@ ...@@ -2770,5 +2770,28 @@
END# END#
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="tw" id="20220217-1" runAlways="true">
<comment>`getParentListCode`</comment>
<sql endDelimiter="#">
DROP FUNCTION IF EXISTS `getParentListCode`#
CREATE DEFINER=`root`@`%` FUNCTION `getParentListCode`(rootId varchar(100)) RETURNS varchar(2000) CHARSET latin1
BEGIN
DECLARE i varchar(2000) default '';
DECLARE j varchar(1000) default rootId;
WHILE rootId is not null do
SET i =(SELECT parent FROM cb_data_dictionary WHERE sequence_nbr = rootId);
IF i is not null THEN
SET j = concat(i, ',', j);
SET rootId = i;
ELSE
SET rootId = i;
END IF;
END WHILE;
return j;
END#
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
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