Pārlūkot izejas kodu

目录菜单支持查询菜单方案

master
yaoq pirms 2 gadiem
vecāks
revīzija
e7579d8890
7 mainītis faili ar 314 papildinājumiem un 183 dzēšanām
  1. +53
    -8
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewMenuTreeService.java
  2. +11
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menu/MenuCache.java
  3. +9
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanCache.java
  4. +17
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanComparator.java
  5. +74
    -61
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanContent.java
  6. +107
    -95
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanHandler.java
  7. +43
    -15
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanItem.java

+ 53
- 8
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewMenuTreeService.java Parādīt failu

@@ -9,26 +9,32 @@ import cc.smtweb.framework.core.db.vo.ModelCatalog;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.CommUtil;
import cc.smtweb.framework.core.util.PubUtil;
import cc.smtweb.system.bpm.util.TreeDataUtil;
import cc.smtweb.system.bpm.web.design.db.ModelCatalogCache;
import cc.smtweb.system.bpm.web.design.db.ModelProjectCache;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormCache;
import cc.smtweb.system.bpm.web.sys.user.menu.MenuCache;
import cc.smtweb.system.bpm.web.sys.user.menuPlan.MenuPlan;
import cc.smtweb.system.bpm.web.sys.user.menuPlan.MenuPlanCache;
import cc.smtweb.system.bpm.web.sys.user.menuPlan.MenuPlanContent;
import cc.smtweb.system.bpm.web.sys.user.menuPlan.MenuPlanItem;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

@SwService
public class PreviewMenuTreeService {
@SwParam
private DbEngine dbEngine;

public R treeAll(@SwParam("module") String module, UserSession us) {
public R treeAll(@SwParam("module") String module, @SwParam("type") int type, UserSession us) {
String prj_id = ModelProjectCache.getInstance().getIdByModule(module);

List<MenuVO> menuVOList = buildMenu(prj_id, module, us);
if (type == 1 && PubUtil.isNotEmpty(menuVOList)) {
return R.success(menuVOList);
}
List<ModelForm> listForm;
if (StringUtils.isNotEmpty(prj_id)) {
listForm = new ArrayList<>(ModelFormCache.getInstance().getFormsByPrj(Long.parseLong(prj_id)));
@@ -54,9 +60,8 @@ public class PreviewMenuTreeService {
MenuVO menu = new MenuVO();
menu.setId(form.getId());
menu.setName(form.getTitle());
menu.setPath("/bpm/" + module+"."+form.getName());
menu.setPath("/bpm/" + module + "." + form.getName());
menu.setParentId(form.getMcId());

setMenuChildren(map.get(form.getMcId()), menu);
}

@@ -69,6 +74,46 @@ public class PreviewMenuTreeService {
return R.success(data);
}

public List<MenuVO> buildMenu(String prj_id, String module, UserSession us) {
Set<MenuPlan> set = MenuPlanCache.getInstance().getByP(prj_id);
if (PubUtil.isEmpty(set)) new ArrayList<>();
MenuPlan menuPlan = set.iterator().next();
MenuPlanContent mpc = new MenuPlanContent(menuPlan.getContent());
List<MenuVO> list = new ArrayList<>();
for (MenuPlanItem mp : mpc.getChildren(0)) {
List<MenuVO> menuVOList = buildMenu(-1, mp);
if (menuVOList == null) continue;
list.addAll(menuVOList);
}
MenuVO root = new MenuVO();
root.setName("项目");
root.setPath(module);
root.setId(-1L);
return TreeDataUtil.buildTree(root, list, MenuVO.createTreeHandler());
}

private List<MenuVO> buildMenu(long parent_id, MenuPlanItem mp) {
if (mp == null) return null;
List<MenuVO> list = new ArrayList<>();
MenuVO menu = new MenuVO();
menu.setId(mp.getId());
menu.setName(mp.getLabel());
menu.setIcon(mp.getIcon());
menu.setPath(MenuCache.getInstance().getPath(mp.getMenu()));
menu.setParentId(parent_id);
List<MenuVO> child = new ArrayList<>();
if (PubUtil.isNotEmpty(mp.getChildren())) {
for (MenuPlanItem cmp : mp.getChildren()) {
List<MenuVO> m = buildMenu(menu.getId(), cmp);
if (m == null) continue;
child.addAll(m);
}
}
menu.setChildren(child);
list.add(menu);
return list;
}

private MenuVO setMenuParent(Long parent_id, Map<Long, MenuVO> map, List<MenuVO> list) {
MenuVO parent = map.get(parent_id);
if (parent != null) return parent;


+ 11
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menu/MenuCache.java Parādīt failu

@@ -3,10 +3,9 @@ package cc.smtweb.system.bpm.web.sys.user.menu;
import cc.smtweb.framework.core.annotation.SwCache;
import cc.smtweb.framework.core.cache.AbstractEntityCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.framework.core.util.PubUtil;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Set;

/**
@@ -31,4 +30,13 @@ public class MenuCache extends AbstractEntityCache<Menu> {
public final Set<Menu> getByM(String key) {
return getListByKey(mk_m, key);
}


public final String getPath(long menu_id) {
Menu menu = get(menu_id);
if (menu == null) return "";
String content = menu.getContent();
if (PubUtil.isEmpty(content)) return "";
return JsonUtil.parseMap(menu.getContent()).get("path").toString();
}
}

+ 9
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanCache.java Parādīt failu

@@ -10,17 +10,25 @@ import java.util.List;
import java.util.Set;

/**
* Created by 1 at 2022-08-01 18:08:28
* Created by 1 at 2022-08-05 19:41:15
* 实体【[菜单方案](SYS_MENU_PLAN)】的缓存类
*/
@SwCache(ident = "SYS_MENU_PLAN", title = "菜单方案")
public class MenuPlanCache extends AbstractEntityCache<MenuPlan> {
//缓存key:按项目缓存
public final static String mk_p = "p";

public static MenuPlanCache getInstance() {
return CacheManager.getIntance().getCache(MenuPlanCache.class);
}

public MenuPlanCache() {
//缓存key:按项目缓存
regList(mk_p, "smp_prj_id");
}

//缓存key:按项目缓存
public final Set<MenuPlan> getByP(String key) {
return getListByKey(mk_p, key);
}
}

+ 17
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanComparator.java Parādīt failu

@@ -0,0 +1,17 @@
package cc.smtweb.system.bpm.web.sys.user.menuPlan;

import java.util.Comparator;

/**
* @Author yaoq
* @Date 2022年08月05日 20:24
* @Description
*/
public class MenuPlanComparator implements Comparator<MenuPlanItem> {

@Override
public int compare(MenuPlanItem o1, MenuPlanItem o2) {
return o1.getSeq() - o2.getSeq();
}

}

+ 74
- 61
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanContent.java Parādīt failu

@@ -6,6 +6,7 @@ import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.framework.core.util.PubUtil;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
@@ -15,57 +16,60 @@ import java.util.List;
*/
public class MenuPlanContent {
private List<MenuPlanItem> list = new ArrayList<>();
public MenuPlanContent(String content){
List<MenuPlanItem> tempList = JsonUtil.parseList(content,MenuPlanItem.class);
if(tempList!=null){
list = tempList;
}

public MenuPlanContent(String content) {
List<MenuPlanItem> tempList = JsonUtil.parseList(content, MenuPlanItem.class);
if (tempList != null) {
list = tempList;
}
Collections.sort(list, new MenuPlanComparator());
}

// 保存节点
public void saveItem(MenuPlanItem item,long parentId){
boolean isNew = item.getId() <=0;
if(isNew){
public void saveItem(MenuPlanItem item, long parentId) {
boolean isNew = item.getId() <= 0;
if (isNew) {
item.setId(DbEngine.getInstance().nextId());
if(parentId<=0){
if (parentId <= 0) {
list.add(item);
}else {
} else {
MenuPlanItem parentItem = findById(parentId);
if(parentItem==null){
if (parentItem == null) {
throw new BizException("上级节点无效");
}
List<MenuPlanItem> children = parentItem.getChildren();
if(children == null){
if (children == null) {
children = new ArrayList<>();
parentItem.setChildren(children);
}
children.add(item);
}
}else {
if(item.getId() == parentId) {
} else {
if (item.getId() == parentId) {
throw new BizException("上级不允许选自己!");
}
MenuPlanItem oldItem = findById(item.getId());
if(oldItem==null){
if (oldItem == null) {
throw new BizException("未找到修改对象");
}
// 判断是否修改了父节点
MenuPlanItem oldParent = findParentById(item.getId());
MenuPlanItem newParent = findById(parentId);
boolean changeParent = (oldParent ==null? -1 : oldParent.getId()) != parentId;
if(changeParent){
boolean changeParent = (oldParent == null ? -1 : oldParent.getId()) != parentId;
if (changeParent) {
// 改了父节点 父节点的children需要移除,新的父节点需要添加
removeById(item.getId(),oldParent==null ? list: oldParent.getChildren());
if(newParent==null){
removeById(item.getId(), oldParent == null ? list : oldParent.getChildren());
if (newParent == null) {
addItem(item, list);
}else {
} else {
List<MenuPlanItem> children = newParent.getChildren();
if(children==null){
if (children == null) {
children = new ArrayList<>();
newParent.setChildren(children);
}
addItem(item, children);
}
}else {
} else {
// 没有改变父节点 直接拷贝值
oldItem.setLabel(item.getLabel());
oldItem.setMenu(item.getMenu());
@@ -75,85 +79,94 @@ public class MenuPlanContent {

}
}

// 删除节点
public void delItem(long id){
public void delItem(long id) {
MenuPlanItem parent = findParentById(id);
if(parent==null){
removeById(id,list);
}else {
if (parent == null) {
removeById(id, list);
} else {
List<MenuPlanItem> children = parent.getChildren();
if(PubUtil.isNotEmpty(children)){
removeById(id,children);
if (PubUtil.isNotEmpty(children)) {
removeById(id, children);
}
}
}

// 转换成字符串
public String toContentStr(){
public String toContentStr() {
return JsonUtil.encodeString(list);
}

// 根据id找节点
public MenuPlanItem findById(long id){
if(id<=0){
public MenuPlanItem findById(long id) {
if (id <= 0) {
return null;
}
return findById(id,list);
return findById(id, list);
}

// 根据id找父节点
public MenuPlanItem findParentById(long id){
if(id<=0){
public MenuPlanItem findParentById(long id) {
if (id <= 0) {
return null;
}
return findParentById(id,list);
return findParentById(id, list);
}

// 获取子节点
public List<MenuPlanItem> getChildren(long parentId){
if(parentId<=0){
public List<MenuPlanItem> getChildren(long parentId) {
if (parentId <= 0) {
return list;
}
MenuPlanItem parent = findById(parentId);
return parent == null ? new ArrayList<>(): parent.getChildren() ;
return parent == null ? new ArrayList<>() : parent.getChildren();
}
private MenuPlanItem findById(long id,List<MenuPlanItem> itemList){
if(PubUtil.isEmpty(itemList)){

private MenuPlanItem findById(long id, List<MenuPlanItem> itemList) {
if (PubUtil.isEmpty(itemList)) {
return null;
}
for(MenuPlanItem item: itemList){
if(item.getId() == id){
return item;
for (MenuPlanItem item : itemList) {
if (item.getId() == id) {
return item;
}
if(PubUtil.isNotEmpty(item.getChildren())){
return findById(id,item.getChildren());
if (PubUtil.isNotEmpty(item.getChildren())) {
return findById(id, item.getChildren());
}
}
return null;
}
private MenuPlanItem findParentById(long id,List<MenuPlanItem> itemList){
if(PubUtil.isEmpty(itemList)){

private MenuPlanItem findParentById(long id, List<MenuPlanItem> itemList) {
if (PubUtil.isEmpty(itemList)) {
return null;
}
for(MenuPlanItem item: itemList){
for (MenuPlanItem item : itemList) {
List<MenuPlanItem> children = item.getChildren();
if(PubUtil.isNotEmpty(children)){
for(MenuPlanItem i : children){
if(i.getId() == id){
return item;
}
if(PubUtil.isNotEmpty(i.getChildren())){
return findParentById(id,i.getChildren());
}
}
if (PubUtil.isNotEmpty(children)) {
for (MenuPlanItem i : children) {
if (i.getId() == id) {
return item;
}
if (PubUtil.isNotEmpty(i.getChildren())) {
return findParentById(id, i.getChildren());
}
}
}
}
return null;
}
private void removeById(long id, List<MenuPlanItem> itemList){
if(itemList == null || itemList.size()<=0){

private void removeById(long id, List<MenuPlanItem> itemList) {
if (itemList == null || itemList.size() <= 0) {
return;
}
itemList.removeIf(item -> item.getId() == id);
}
private void addItem(MenuPlanItem item, List<MenuPlanItem> itemList){
if(itemList == null){

private void addItem(MenuPlanItem item, List<MenuPlanItem> itemList) {
if (itemList == null) {
return;
}
itemList.add(item);


+ 107
- 95
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanHandler.java Parādīt failu

@@ -28,79 +28,81 @@ public class MenuPlanHandler {
private static String DS_MENU_LIST = "menuList";
private static String DS_MENU_CARD = "menuCard";
private static String DS_MENU_TREE = "menuTree";

static class MenuCustHandler extends AbstractHandler {
// 保存方案明细
public R savePlanItem(){
// 方案ID
long plan_id = params.readLong("plan_id");
if(plan_id<=0){
throw new BizException("所属方案不能为空!");
}
MenuPlan menuPlan = MenuPlanCache.getInstance().get(plan_id);
if(menuPlan==null){
throw new BizException("所属方案不能为空!");
}
long parent_id = params.readLong("parent_id",-1L);
MenuPlanItem menuPlanItem = JsonUtil.parse(params, MenuPlanItem.class);
// 处理content大字段
MenuPlanContent menuPlanContent = new MenuPlanContent(menuPlan.getContent());
menuPlanContent.saveItem(menuPlanItem,parent_id);
menuPlan.setContent(menuPlanContent.toContentStr());

DbEngine.getInstance().doTrans(new AbsDbWorker() {
@Override
public void work() {
DbEngine.getInstance().updateEntity(menuPlan,"smp_content");
}

@Override
public void doAfterDbCommit() {
MenuPlanCache.getInstance().put(menuPlan);
}
});
return R.success(menuPlanItem);
}
// 删除方案明细
public R delPlanItem(){
// 方案ID
long plan_id = params.readLong("plan_id");
long id = params.readLong("id");
if(plan_id<=0 || id<=0){
throw new BizException("参数错误!");
}
MenuPlan menuPlan = MenuPlanCache.getInstance().get(plan_id);
if(menuPlan==null){
throw new BizException("参数错误!");
}
// 处理content大字段
MenuPlanContent menuPlanContent = new MenuPlanContent(menuPlan.getContent());
menuPlanContent.delItem(id);
menuPlan.setContent(menuPlanContent.toContentStr());

DbEngine.getInstance().doTrans(new AbsDbWorker() {
@Override
public void work() {
DbEngine.getInstance().updateEntity(menuPlan,"smp_content");
}

@Override
public void doAfterDbCommit() {
MenuPlanCache.getInstance().put(menuPlan);
}
});
return R.success();
}
public R savePlanItem() {
// 方案ID
long plan_id = params.readLong("plan_id");
if (plan_id <= 0) {
throw new BizException("所属方案不能为空!");
}
MenuPlan menuPlan = MenuPlanCache.getInstance().get(plan_id);
if (menuPlan == null) {
throw new BizException("所属方案不能为空!");
}
long parent_id = params.readLong("parent_id", -1L);
MenuPlanItem menuPlanItem = JsonUtil.parse(params, MenuPlanItem.class);
// 处理content大字段
MenuPlanContent menuPlanContent = new MenuPlanContent(menuPlan.getContent());
menuPlanContent.saveItem(menuPlanItem, parent_id);
menuPlan.setContent(menuPlanContent.toContentStr());

DbEngine.getInstance().doTrans(new AbsDbWorker() {
@Override
public void work() {
DbEngine.getInstance().updateEntity(menuPlan, "smp_content");
}

@Override
public void doAfterDbCommit() {
MenuPlanCache.getInstance().put(menuPlan);
}
});
return R.success(menuPlanItem);
}

// 删除方案明细
public R delPlanItem() {
// 方案ID
long plan_id = params.readLong("plan_id");
long id = params.readLong("id");
if (plan_id <= 0 || id <= 0) {
throw new BizException("参数错误!");
}
MenuPlan menuPlan = MenuPlanCache.getInstance().get(plan_id);
if (menuPlan == null) {
throw new BizException("参数错误!");
}
// 处理content大字段
MenuPlanContent menuPlanContent = new MenuPlanContent(menuPlan.getContent());
menuPlanContent.delItem(id);
menuPlan.setContent(menuPlanContent.toContentStr());

DbEngine.getInstance().doTrans(new AbsDbWorker() {
@Override
public void work() {
DbEngine.getInstance().updateEntity(menuPlan, "smp_content");
}

@Override
public void doAfterDbCommit() {
MenuPlanCache.getInstance().put(menuPlan);
}
});
return R.success();
}
}

static class MenuLoadHandler extends DynPageLoadHandler{
static class MenuLoadHandler extends DynPageLoadHandler {
@Override
public DynPageProvider getProvider() {
return new MenuProvider();
}

public DynPageListHandler getListWorker(SwMap filter, PageDataset pageDataSet) {
if(DS_MENU_LIST.equals(pageDataSet.name)){
return new MenuListHandler(pageId,filter,pageDataSet);
if (DS_MENU_LIST.equals(pageDataSet.name)) {
return new MenuListHandler(pageId, filter, pageDataSet);
}
DynPageListHandler listHandler = new DynPageListHandler(pageId, filter, pageDataSet);
listHandler.init(params, us);
@@ -109,7 +111,7 @@ public class MenuPlanHandler {

@Override
public DynPageTreeHandler getTreeWorker(SwMap filter, PageDataset pageDataSet) {
MenuTreeHandler treeHandler = new MenuPlanHandler.MenuTreeHandler(pageId,filter,pageDataSet);
MenuTreeHandler treeHandler = new MenuPlanHandler.MenuTreeHandler(pageId, filter, pageDataSet);
treeHandler.init(params, us);
return treeHandler;
}
@@ -117,11 +119,12 @@ public class MenuPlanHandler {
@Override
protected void afterAddBean(PageDataset dataset, SwMap bean) {
super.afterAddBean(dataset, bean);
if(DS_MENU_CARD.equals(dataset.name)){
bean.put("type",0);
if (DS_MENU_CARD.equals(dataset.name)) {
bean.put("type", 0);
}
}
}

static class MenuListHandler extends DynPageListHandler {
public MenuListHandler(long pageId, SwMap filter, PageDataset pageDataSet) {
super(pageId, filter, pageDataSet);
@@ -129,22 +132,23 @@ public class MenuPlanHandler {

@Override
public SwListData buildListData() {
long plan_id = filter.readLong("plan_id",-1L);
long plan_id = filter.readLong("plan_id", -1L);
List<MenuPlanItem> children = getChildren();
List<SwMap> list = new ArrayList<>();
int total = 0;
if(PubUtil.isNotEmpty(children)){
total= children.size();
for(MenuPlanItem bean: children){
if (PubUtil.isNotEmpty(children)) {
total = children.size();
for (MenuPlanItem bean : children) {
SwMap map = bean.getData();
map.put("plan_id",plan_id);
map.put("type",bean.getMenu()> 0 ? 1: 0);
map.put("type_text",bean.getMenu()> 0 ? "菜单": "目录");
map.put("plan_id", plan_id);
map.put("type", bean.getMenu() > 0 ? 1 : 0);
map.put("type_text", bean.getMenu() > 0 ? "菜单" : "目录");
list.add(map);
}
}
return SwListData.create(list,total);
return SwListData.create(list, total);
}

@Override
public R getTotal() {
SwMap r = new SwMap();
@@ -152,54 +156,58 @@ public class MenuPlanHandler {
r.put("total", children.size());
return R.success(r);
}
private List<MenuPlanItem> getChildren(){
long plan_id = filter.readLong("plan_id",-1L);
long parent_id = filter.readLong("parent_id",-1L);
if(plan_id<=0){

private List<MenuPlanItem> getChildren() {
long plan_id = filter.readLong("plan_id", -1L);
long parent_id = filter.readLong("parent_id", -1L);
if (plan_id <= 0) {
return new ArrayList<>();
}
MenuPlan menuPlan = MenuPlanCache.getInstance().get(plan_id);
if(menuPlan==null){
MenuPlan menuPlan = MenuPlanCache.getInstance().get(plan_id);
if (menuPlan == null) {
return new ArrayList<>();
}
MenuPlanContent menuPlanContent = new MenuPlanContent(menuPlan.getContent());
return menuPlanContent.getChildren(parent_id);
}
}
static class MenuProvider extends DynPageProvider{

static class MenuProvider extends DynPageProvider {
@Override
public SwMap loadData(SwMap filter, PageDataset pageDataSet) {
if(DS_MENU_CARD.equals(pageDataSet.name)){
long id = filter.readLong("id",1L);
long plan_id = filter.readLong("plan_id",1L);
if (DS_MENU_CARD.equals(pageDataSet.name)) {
long id = filter.readLong("id", 1L);
long plan_id = filter.readLong("plan_id", 1L);
MenuPlan menuPlan = MenuPlanCache.getInstance().get(plan_id);
if(menuPlan==null) {
if (menuPlan == null) {
return new SwMap();
}
MenuPlanContent menuPlanContent = new MenuPlanContent(menuPlan.getContent());
MenuPlanItem menuPlanItem = menuPlanContent.findById(id);
if(menuPlanItem == null){
if (menuPlanItem == null) {
return new SwMap();
}
SwMap r = new SwMap();
r.putAll(menuPlanItem.getData());
r.put("plan_id",plan_id);
r.put("type",menuPlanItem.getMenu()> 0 ? 1: 0);
r.put("plan_id", plan_id);
r.put("type", menuPlanItem.getMenu() > 0 ? 1 : 0);
return r;
}
return super.loadData(filter, pageDataSet);
}
}
static class MenuTreeHandler extends DynPageTreeHandler{

static class MenuTreeHandler extends DynPageTreeHandler {
private MenuPlanContent menuPlanContent;

public MenuTreeHandler(long pageId, SwMap filter, PageDataset pageDataSet) {
super(pageId, filter, pageDataSet);
long plan_id = filter.readLong("plan_id",-1L);
if(plan_id<=0){
long plan_id = filter.readLong("plan_id", -1L);
if (plan_id <= 0) {
menuPlanContent = new MenuPlanContent(null);
}
MenuPlan menuPlan = MenuPlanCache.getInstance().get(plan_id);
menuPlanContent = new MenuPlanContent(menuPlan == null ? null: menuPlan.getContent());
menuPlanContent = new MenuPlanContent(menuPlan == null ? null : menuPlan.getContent());
}

@Override
@@ -207,9 +215,9 @@ public class MenuPlanHandler {
boolean exc_menu = params.readBool("exc_menu");
List<SwMap> list = new ArrayList<>();
List<MenuPlanItem> temList = menuPlanContent.getChildren(id);
if(PubUtil.isNotEmpty(temList)){
temList.forEach(bean-> {
if(exc_menu&&bean.getMenu()>0){
if (PubUtil.isNotEmpty(temList)) {
temList.forEach(bean -> {
if (exc_menu && bean.getMenu() > 0) {
return;
}
list.add(bean.getData());
@@ -218,6 +226,10 @@ public class MenuPlanHandler {
return list;
}

protected void buildMenuRight(String menu_id, SwMap bean) {

}

@Override
protected long getId(SwMap bean) {
return bean.readLong("id");


+ 43
- 15
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanItem.java Parādīt failu

@@ -2,7 +2,8 @@ package cc.smtweb.system.bpm.web.sys.user.menuPlan;

import cc.smtweb.framework.core.db.impl.BaseBean;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
@@ -11,58 +12,85 @@ import java.util.List;
* @Desc:
*/
public class MenuPlanItem extends BaseBean {
/** 主键 */
/**
* 主键
*/
public long getId() {
return getLong("id");
}

/** 主键 */
/**
* 主键
*/
public void setId(long id) {
put("id", id);
}
/** 菜单ID */

/**
* 菜单ID
*/
public long getMenu() {
return getLong("menu");
}

/** 菜单ID */
/**
* 菜单ID
*/
public void setMenu(long menu) {
put("menu", menu);
}
/** 标题 */

/**
* 标题
*/
public String getLabel() {
return getStr("label");
}

/** 标题 */
/**
* 标题
*/
public void setLabel(String label) {
put("label", label);
}

/** 图标 */
/**
* 图标
*/
public String getIcon() {
return getStr("icon");
}

/** 图标 */
/**
* 图标
*/
public void setIcon(String icon) {
put("icon", icon);
}

/** 排序码 */
/**
* 排序码
*/
public int getSeq() {
return getInt("seq");
}

/** 排序码 */
/**
* 排序码
*/
public void setSeq(int seq) {
put("seq", seq);
}
public void setChildren(List<MenuPlanItem> children){
put("children",children);

public void setChildren(List<MenuPlanItem> children) {
put("children", children);
}
public List<MenuPlanItem> getChildren(){

public List<MenuPlanItem> getChildren() {
Object obj = get("children");
return obj==null ? null : (List<MenuPlanItem>) obj;
if (obj == null) return null;
List<MenuPlanItem> list = (List<MenuPlanItem>) obj;
Collections.sort(list, new MenuPlanComparator());
return list;
}
}

Notiek ielāde…
Atcelt
Saglabāt