@@ -0,0 +1,109 @@ | |||
package cc.smtweb.system.bpm.web.sys.user.menu; | |||
import cc.smtweb.framework.core.annotation.SwTable; | |||
import cc.smtweb.framework.core.common.SwMap; | |||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||
/** | |||
* Created by 1 at 2022-08-03 08:53:34 | |||
* 实体【[菜单定义](SYS_MENU)】的Entity类 | |||
*/ | |||
@SwTable("SYS_MENU") | |||
public class Menu extends DefaultEntity { | |||
public static final String ENTITY_NAME = "SYS_MENU"; | |||
public Menu() { | |||
super(ENTITY_NAME); | |||
} | |||
/** 主键 */ | |||
public long getId() { | |||
return getLong("sm_id"); | |||
} | |||
/** 主键 */ | |||
public void setId(long sm_id) { | |||
put("sm_id", sm_id); | |||
} | |||
/** 排序 */ | |||
public int getSeq() { | |||
return getInt("sm_seq"); | |||
} | |||
/** 排序 */ | |||
public void setSeq(int sm_seq) { | |||
put("sm_seq", sm_seq); | |||
} | |||
/** 名称 */ | |||
public String getName() { | |||
return getStr("sm_name"); | |||
} | |||
/** 名称 */ | |||
public void setName(String sm_name) { | |||
put("sm_name", sm_name); | |||
} | |||
/** 图标 */ | |||
public String getIcon() { | |||
return getStr("sm_icon"); | |||
} | |||
/** 图标 */ | |||
public void setIcon(String sm_icon) { | |||
put("sm_icon", sm_icon); | |||
} | |||
/** 权限点 */ | |||
public String getRight() { | |||
return getStr("sm_right"); | |||
} | |||
/** 权限点 */ | |||
public void setRight(String sm_right) { | |||
put("sm_right", sm_right); | |||
} | |||
/** 类型 */ | |||
public boolean isType() { | |||
return getBool("sm_type"); | |||
} | |||
/** 类型 */ | |||
public void set(boolean sm_type) { | |||
setBool("sm_type", sm_type); | |||
} | |||
/** 请求内容 */ | |||
public String getContent() { | |||
return getStr("sm_content"); | |||
} | |||
/** 请求内容 */ | |||
public void setContent(String sm_content) { | |||
put("sm_content", sm_content); | |||
} | |||
/** 所属项目 */ | |||
public long getPrjId() { | |||
return getLong("sm_prj_id"); | |||
} | |||
/** 所属项目 */ | |||
public void setPrjId(long sm_prj_id) { | |||
put("sm_prj_id", sm_prj_id); | |||
} | |||
/** 所属目录 */ | |||
public long getMcId() { | |||
return getLong("sm_mc_id"); | |||
} | |||
/** 所属目录 */ | |||
public void setMcId(long sm_mc_id) { | |||
put("sm_mc_id", sm_mc_id); | |||
} | |||
/** 备注 */ | |||
public String getRemark() { | |||
return getStr("sm_remark"); | |||
} | |||
/** 备注 */ | |||
public void setRemark(String sm_remark) { | |||
put("sm_remark", sm_remark); | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
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 java.util.ArrayList; | |||
import java.util.Comparator; | |||
import java.util.List; | |||
import java.util.Set; | |||
/** | |||
* Created by 1 at 2022-08-03 08:53:34 | |||
* 实体【[菜单定义](SYS_MENU)】的缓存类 | |||
*/ | |||
@SwCache(ident = "SYS_MENU", title = "菜单定义") | |||
public class MenuCache extends AbstractEntityCache<Menu> { | |||
//缓存key:按编码 | |||
public final static String mk_code = "code"; | |||
public static MenuCache getInstance() { | |||
return CacheManager.getIntance().getCache(MenuCache.class); | |||
} | |||
public MenuCache() { | |||
//缓存key:按编码 | |||
regMap(mk_code, "sm_seq"); | |||
} | |||
//缓存key:按编码 | |||
public final Menu getByCode(String key) { | |||
return getByKey(mk_code, key); | |||
} | |||
} |
@@ -1,10 +1,14 @@ | |||
package cc.smtweb.system.bpm.web.sys.user.menu; | |||
import cc.smtweb.framework.core.common.SwEnum; | |||
import cc.smtweb.framework.core.common.SwMap; | |||
import cc.smtweb.system.bpm.web.design.form.define.PageDataset; | |||
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageListHandler; | |||
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageLoadHandler; | |||
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageTreeHandler; | |||
import java.util.List; | |||
/** | |||
* @Author: tanghp | |||
* @Date: 2022-08-01 17:47 | |||
@@ -14,14 +18,34 @@ public class MenuHandler { | |||
static class MenuLoadHandler extends DynPageLoadHandler { | |||
@Override | |||
public DynPageTreeHandler getTreeWorker(SwMap filter, PageDataset pageDataSet) { | |||
return new MenuTreeHandler(pageId, filter, pageDataSet); | |||
} | |||
return new MenuTreeHandler(pageId,filter,pageDataSet); | |||
@Override | |||
public DynPageListHandler getListWorker(SwMap filter, PageDataset pageDataSet) { | |||
return new MenuListHandler(pageId, filter, pageDataSet); | |||
} | |||
} | |||
static class MenuTreeHandler extends DynPageTreeHandler{ | |||
static class MenuTreeHandler extends DynPageTreeHandler { | |||
public MenuTreeHandler(long pageId, SwMap filter, PageDataset pageDataSet) { | |||
super(pageId, filter, pageDataSet); | |||
} | |||
} | |||
static class MenuListHandler extends DynPageListHandler { | |||
public MenuListHandler(long pageId, SwMap filter, PageDataset pageDataSet) { | |||
super(pageId, filter, pageDataSet); | |||
} | |||
@Override | |||
protected void afterQuery(List<SwMap> listData) { | |||
super.afterQuery(listData); | |||
listData.forEach(row -> { | |||
row.put("sm_type_text", SwEnum.MenuType.instance.getName(row.readInt("sm_type"))); | |||
}); | |||
} | |||
} | |||
} |
@@ -1,55 +0,0 @@ | |||
package cc.smtweb.system.bpm.web.sys.user.menu; | |||
import cc.smtweb.framework.core.annotation.SwTable; | |||
import cc.smtweb.framework.core.common.SwMap; | |||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||
/** | |||
* Created by 1 at 2022-08-01 17:44:00 | |||
* 实体【[菜单方案](SYS_MENU_PLAN)】的Entity类 | |||
*/ | |||
@SwTable("SYS_MENU_PLAN") | |||
public class MenuPlan extends DefaultEntity { | |||
public static final String ENTITY_NAME = "SYS_MENU_PLAN"; | |||
public MenuPlan() { | |||
super(ENTITY_NAME); | |||
} | |||
/** 主键 */ | |||
public long getId() { | |||
return getLong("smp_id"); | |||
} | |||
/** 主键 */ | |||
public void setId(long smp_id) { | |||
put("smp_id", smp_id); | |||
} | |||
/** 名称 */ | |||
public String getName() { | |||
return getStr("smp_name"); | |||
} | |||
/** 名称 */ | |||
public void setName(String smp_name) { | |||
put("smp_name", smp_name); | |||
} | |||
/** 详细 */ | |||
public String getContent() { | |||
return getStr("smp_content"); | |||
} | |||
/** 详细 */ | |||
public void setContent(String smp_content) { | |||
put("smp_content", smp_content); | |||
} | |||
/** 备注 */ | |||
public String getRemark() { | |||
return getStr("smp_remark"); | |||
} | |||
/** 备注 */ | |||
public void setRemark(String smp_remark) { | |||
put("smp_remark", smp_remark); | |||
} | |||
} |
@@ -301,4 +301,10 @@ public interface SwEnum { | |||
return !mapAll.containsKey(v.toLowerCase()); | |||
} | |||
} | |||
class MenuType extends IntEnum { | |||
public static MenuType instance = new MenuType(); | |||
public static IntEnumBean PAGE = instance.addEnum(0, "功能页面"); | |||
public static IntEnumBean LINK = instance.addEnum(1, "外部链接"); | |||
} | |||
} |