diff --git a/pom.xml b/pom.xml index e59e7161..e3070a80 100644 --- a/pom.xml +++ b/pom.xml @@ -18,8 +18,8 @@ 4.3.3.RELEASE 1.3.2 2.7 - 2.5.2 - 2.6.5 + 2.7.0 + 2.6.6 @@ -170,7 +170,7 @@ com.alibaba fastjson - 1.2.19 + 1.2.20 diff --git a/src/main/java/com/smallchill/common/tool/SysCache.java b/src/main/java/com/smallchill/common/tool/SysCache.java index c5a205fa..f529941e 100644 --- a/src/main/java/com/smallchill/common/tool/SysCache.java +++ b/src/main/java/com/smallchill/common/tool/SysCache.java @@ -1,6 +1,7 @@ package com.smallchill.common.tool; import com.smallchill.core.constant.ConstCache; +import com.smallchill.core.constant.ConstCacheKey; import com.smallchill.core.interfaces.ILoader; import com.smallchill.core.plugins.dao.Blade; import com.smallchill.core.toolbox.Func; @@ -13,7 +14,7 @@ import com.smallchill.system.model.Parameter; import com.smallchill.system.model.Role; import com.smallchill.system.model.User; -public class SysCache { +public class SysCache implements ConstCache, ConstCacheKey{ /** * 获取字典表对应中文 * @param code 字典编号 @@ -21,7 +22,7 @@ public class SysCache { * @return */ public static String getDictName(final Object code, final Object num) { - Dict dict = CacheKit.get(ConstCache.DICT_CACHE, "getDictName_" + code + "_" + num, new ILoader() { + Dict dict = CacheKit.get(DICT_CACHE, GET_DICT_NAME + code + "_" + num, new ILoader() { @Override public Object load() { return Blade.create(Dict.class).findFirstBy("code=#{code} and num=#{num}", Paras.create().set("code", code).set("num", num)); @@ -46,7 +47,7 @@ public class SysCache { StringBuilder sb = new StringBuilder(); for(int i = 0 ; i < roleIdArr.length; i++){ final String roleId = roleIdArr[i]; - Role role = CacheKit.get(ConstCache.ROLE_CACHE, "getRoleName" + "_" + roleId, new ILoader() { + Role role = CacheKit.get(ROLE_CACHE, GET_ROLE_NAME + roleId, new ILoader() { @Override public Object load() { return Blade.create(Role.class).findById(roleId); @@ -70,7 +71,7 @@ public class SysCache { StringBuilder sb = new StringBuilder(); for(int i = 0 ; i < roleIdArr.length; i++){ final String roleId = roleIdArr[i]; - Role role = CacheKit.get(ConstCache.ROLE_CACHE, "getRoleAlias" + "_" + roleId, new ILoader() { + Role role = CacheKit.get(ROLE_CACHE, GET_ROLE_ALIAS + roleId, new ILoader() { @Override public Object load() { return Blade.create(Role.class).findById(roleId); @@ -87,7 +88,7 @@ public class SysCache { * @return */ public static String getUserName(final Object userId) { - User user = CacheKit.get(ConstCache.USER_CACHE, "getUserName" + "_" + userId, new ILoader() { + User user = CacheKit.get(USER_CACHE, GET_USER_NAME + userId, new ILoader() { @Override public Object load() { return Blade.create(User.class).findById(userId); @@ -112,7 +113,7 @@ public class SysCache { StringBuilder sb = new StringBuilder(); for(int i = 0 ; i < deptIdArr.length; i++){ final String deptId = deptIdArr[i]; - Dept dept = CacheKit.get(ConstCache.DEPT_CACHE, "getDeptName" + "_" + deptId, new ILoader() { + Dept dept = CacheKit.get(DEPT_CACHE, GET_DEPT_NAME + deptId, new ILoader() { @Override public Object load() { return Blade.create(Dept.class).findById(deptId); diff --git a/src/main/java/com/smallchill/common/vo/ShiroUser.java b/src/main/java/com/smallchill/common/vo/ShiroUser.java index e74443e0..23b5e3d2 100644 --- a/src/main/java/com/smallchill/common/vo/ShiroUser.java +++ b/src/main/java/com/smallchill/common/vo/ShiroUser.java @@ -21,6 +21,7 @@ import java.util.Map; import com.smallchill.common.tool.SysCache; import com.smallchill.core.constant.ConstCache; +import com.smallchill.core.constant.ConstCacheKey; import com.smallchill.core.interfaces.ILoader; import com.smallchill.core.plugins.dao.Db; import com.smallchill.core.toolbox.Func; @@ -90,10 +91,10 @@ public class ShiroUser implements Serializable { this.subRoles = subRoles; // 查找子角色对应账号id集合 - List> listUser = CacheKit.get(ConstCache.USER_CACHE, "user_all_list", new ILoader() { + List> listUser = CacheKit.get(ConstCache.USER_CACHE, ConstCacheKey.USER_ALL_LIST, new ILoader() { @Override public Object load() { - return Db.selectList("SELECT * FROM TFW_USER"); + return Db.selectList("SELECT * FROM TFW_USER where status = 1 and name is not null"); } }); diff --git a/src/main/java/com/smallchill/core/base/controller/BladeController.java b/src/main/java/com/smallchill/core/base/controller/BladeController.java index 8a6c793c..cee0e8a2 100644 --- a/src/main/java/com/smallchill/core/base/controller/BladeController.java +++ b/src/main/java/com/smallchill/core/base/controller/BladeController.java @@ -33,6 +33,7 @@ import org.springframework.web.servlet.ModelAndView; import com.smallchill.core.constant.Const; import com.smallchill.core.constant.ConstCache; +import com.smallchill.core.constant.ConstCacheKey; import com.smallchill.core.constant.ConstCurd; import com.smallchill.core.constant.ConstShiro; import com.smallchill.core.constant.Cst; @@ -55,7 +56,7 @@ import com.smallchill.core.toolbox.support.WafRequestWrapper; /** * @author Chill Zhuang */ -public class BladeController implements ConstCurd, ConstCache{ +public class BladeController implements ConstCurd, ConstCache, ConstCacheKey { private static final Logger log = LoggerFactory.getLogger(BladeController.class); diff --git a/src/main/java/com/smallchill/core/beetl/func/BeetlExt.java b/src/main/java/com/smallchill/core/beetl/func/BeetlExt.java index 9ca230d5..4bd6c07a 100644 --- a/src/main/java/com/smallchill/core/beetl/func/BeetlExt.java +++ b/src/main/java/com/smallchill/core/beetl/func/BeetlExt.java @@ -26,6 +26,7 @@ import java.util.Set; import com.smallchill.common.tool.SysCache; import com.smallchill.core.constant.ConstCache; +import com.smallchill.core.constant.ConstCacheKey; import com.smallchill.core.constant.ConstConfig; import com.smallchill.core.interfaces.ILoader; import com.smallchill.core.plugins.dao.Db; @@ -462,7 +463,7 @@ public class BeetlExt { * @return String */ public String getRightMenu(final Object userId, Object roleId,final String code) { - Map userRole = CacheKit.get(ConstCache.MENU_CACHE, "roleExt_" + userId, + Map userRole = CacheKit.get(ConstCache.MENU_CACHE, ConstCacheKey.ROLE_EXT + userId, new ILoader() { public Object load() { return Db.selectOne("select * from TFW_ROLE_EXT where userId=#{userId}", Paras.create().set("userId", userId)); @@ -489,7 +490,7 @@ public class BeetlExt { sql.append(" )"); sql.append(" order by num"); - List> btnList = CacheKit.get(ConstCache.MENU_CACHE, "btnList_rightMenu_" + code + "_" + userId, new ILoader() { + List> btnList = CacheKit.get(ConstCache.MENU_CACHE, ConstCacheKey.RIGHT_MENU + code + "_" + userId, new ILoader() { public Object load() { return Db.selectList(sql.toString(), Paras.create().set("code", code)); } diff --git a/src/main/java/com/smallchill/core/beetl/tag/DropDownTag.java b/src/main/java/com/smallchill/core/beetl/tag/DropDownTag.java index 9bf45e55..2cc4b814 100644 --- a/src/main/java/com/smallchill/core/beetl/tag/DropDownTag.java +++ b/src/main/java/com/smallchill/core/beetl/tag/DropDownTag.java @@ -24,6 +24,7 @@ import org.beetl.core.Tag; import com.smallchill.common.vo.TreeNode; import com.smallchill.core.constant.ConstCache; +import com.smallchill.core.constant.ConstCacheKey; import com.smallchill.core.interfaces.ILoader; import com.smallchill.core.plugins.dao.Db; import com.smallchill.core.plugins.dao.Md; @@ -64,7 +65,7 @@ public class DropDownTag extends Tag { final String sqlstr = sql; - List> dict = CacheKit.get(ConstCache.DICT_CACHE,"dropdown_"+ type + "_" + code, new ILoader() { + List> dict = CacheKit.get(ConstCache.DICT_CACHE, ConstCacheKey.DROPDOWN + type + "_" + code, new ILoader() { @Override public Object load() { return Db.selectList(sqlstr); diff --git a/src/main/java/com/smallchill/core/beetl/tag/SelectTag.java b/src/main/java/com/smallchill/core/beetl/tag/SelectTag.java index 188ee118..5ab7fc50 100644 --- a/src/main/java/com/smallchill/core/beetl/tag/SelectTag.java +++ b/src/main/java/com/smallchill/core/beetl/tag/SelectTag.java @@ -23,6 +23,7 @@ import org.beetl.core.Tag; import com.smallchill.core.aop.AopContext; import com.smallchill.core.constant.ConstCache; +import com.smallchill.core.constant.ConstCacheKey; import com.smallchill.core.constant.Cst; import com.smallchill.core.interfaces.ILoader; import com.smallchill.core.interfaces.IQuery; @@ -93,7 +94,7 @@ public class SelectTag extends Tag { final Map _modelOrMap = modelOrMap; final IQuery _intercept = intercept; - List> dict = CacheKit.get(CACHE_NAME, "dict_" + type + "_" + code + "_" + ShiroKit.getUser().getId(), new ILoader() { + List> dict = CacheKit.get(CACHE_NAME, ConstCacheKey.DICT + type + "_" + code + "_" + ShiroKit.getUser().getId(), new ILoader() { @Override public Object load() { return Db.selectList(_sql, _modelOrMap, new AopContext(), _intercept); diff --git a/src/main/java/com/smallchill/core/constant/ConstCacheKey.java b/src/main/java/com/smallchill/core/constant/ConstCacheKey.java new file mode 100644 index 00000000..124986c6 --- /dev/null +++ b/src/main/java/com/smallchill/core/constant/ConstCacheKey.java @@ -0,0 +1,75 @@ +package com.smallchill.core.constant; + +public interface ConstCacheKey { + + //-----------------------------menu--------------------------------------- + + String SIDEBAR = "sideBar_"; + + String RIGHT_MENU = "rightMenu_"; + + String DROPDOWN = "dropdown_"; + + String MENU_TREE_ALL = "menu_tree_all"; + + String MENU_TREE = "menu_tree_"; + + String MENU_TABLE_ALL = "menu_table_all"; + + //-----------------------------dept--------------------------------------- + + String GET_DEPT_NAME = "get_dept_name_"; + + String DEPT_ALL_LIST = "dept_all_list"; + + String DEPT_TREE_ALL = "dept_tree_all"; + + //-----------------------------dict--------------------------------------- + + String GET_DICT_NAME = "get_dict_name_"; + + String DICT = "dict_"; + + String DICT_TREE_ALL = "dict_tree_all"; + + String DICT_SELECT = "dict_select_"; + + String DICT_COMBO = "dict_combo_"; + + String DICT_SELECT_USER = "dict_select_user_all"; + + String DICT_ZTREE_LIST = "ztree_list_"; + + //-----------------------------role--------------------------------------- + + String GET_ROLE_NAME = "get_role_name_"; + + String GET_ROLE_ALIAS = "get_role_alias_"; + + String ROLE_EXT = "role_ext_"; + + String ROLE_ALL_LIST = "role_all_list"; + + String ROLE_TREE_ALL = "role_tree_all"; + + String ROLE_TREE = "role_tree_"; + + //-----------------------------user--------------------------------------- + + String GET_USER_NAME = "get_user_name_"; + + String USER_ALL_LIST = "user_all_list"; + + String USER_TREE_ALL = "user_tree_all"; + + //-----------------------------system--------------------------------------- + + String PARAMETER_LOG = "parameter_log"; + + String EXCEL_SQL = "excel_sql_"; + + String EXCEL_COL_NAME = "excel_colname_"; + + String EXCEL_COL_MODEL = "excel_colmodel_"; + +} diff --git a/src/main/java/com/smallchill/core/toolbox/log/BladeLogFactory.java b/src/main/java/com/smallchill/core/toolbox/log/BladeLogFactory.java index f2cbdd46..851de6e0 100644 --- a/src/main/java/com/smallchill/core/toolbox/log/BladeLogFactory.java +++ b/src/main/java/com/smallchill/core/toolbox/log/BladeLogFactory.java @@ -21,6 +21,7 @@ import java.util.Map; import com.smallchill.common.vo.ShiroUser; import com.smallchill.core.constant.Const; import com.smallchill.core.constant.ConstCache; +import com.smallchill.core.constant.ConstCacheKey; import com.smallchill.core.interfaces.ILoader; import com.smallchill.core.interfaces.ILog; import com.smallchill.core.plugins.dao.Blade; @@ -58,7 +59,7 @@ public class BladeLogFactory implements ILog { public boolean isDoLog() { @SuppressWarnings("rawtypes") - Map map = CacheKit.get(ConstCache.SYS_CACHE, "parameter_log", new ILoader() { + Map map = CacheKit.get(ConstCache.SYS_CACHE, ConstCacheKey.PARAMETER_LOG, new ILoader() { @Override public Object load() { return Db.selectOne("select para from tfw_parameter where code = #{code}", Paras.create().set("code", Const.PARA_LOG_CODE)); diff --git a/src/main/java/com/smallchill/system/controller/CacheController.java b/src/main/java/com/smallchill/system/controller/CacheController.java index 62ac8c32..b1733274 100644 --- a/src/main/java/com/smallchill/system/controller/CacheController.java +++ b/src/main/java/com/smallchill/system/controller/CacheController.java @@ -142,7 +142,7 @@ public class CacheController extends BladeController { public AjaxResult getSelect() { final String code = getParameter("code"); final String num = getParameter("num"); - List> dict = CacheKit.get(DICT_CACHE, "dict_common_" + code, + List> dict = CacheKit.get(DICT_CACHE, DICT_SELECT + code, new ILoader() { public Object load() { return Db.selectList("select num as ID,pId as PID,name as TEXT from TFW_DICT where code=#{code} and num>0", Paras.create().set("code", code)); @@ -163,7 +163,7 @@ public class CacheController extends BladeController { @RequestMapping("/getCombo") public AjaxResult getCombo() { final String code = getParameter("code"); - List> dict = CacheKit.get(DICT_CACHE, "dict_combo_" + code, + List> dict = CacheKit.get(DICT_CACHE, DICT_COMBO + code, new ILoader() { public Object load() { return Db.selectList("select num as \"id\",name as \"text\" from TFW_DICT where code=#{code} and num>0", Paras.create().set("code", code), new AopContext("ztree")); @@ -177,7 +177,7 @@ public class CacheController extends BladeController { @RequestMapping("/getDeptSelect") public AjaxResult getDeptSelect() { final String num = getParameter("num"); - List> dept = CacheKit.get(DEPT_CACHE, "dept_all", + List> dept = CacheKit.get(DEPT_CACHE, DEPT_ALL_LIST, new ILoader() { public Object load() { return Db.selectList("select ID,PID,simpleName as TEXT from TFW_DEPT order by pId,num asc", Paras.create(), new AopContext(), Cst.me().getDefaultSelectFactory().deptIntercept()); @@ -198,7 +198,7 @@ public class CacheController extends BladeController { @RequestMapping("/getUserSelect") public AjaxResult getUserSelect() { final String num = getParameter("num"); - List> dept = CacheKit.get(DEPT_CACHE, "user_all", + List> dept = CacheKit.get(DEPT_CACHE, DICT_SELECT_USER, new ILoader() { public Object load() { return Db.selectList("select ID,name TEXT from TFW_USER where status=1 and name is not null order by name ", Paras.create(), new AopContext(), Cst.me().getDefaultSelectFactory().userIntercept()); @@ -219,7 +219,7 @@ public class CacheController extends BladeController { @RequestMapping("/getRoleSelect") public AjaxResult getRoleSelect() { final String num = getParameter("num"); - List> dept = CacheKit.get(ROLE_CACHE, "role_all", + List> dept = CacheKit.get(ROLE_CACHE, ROLE_ALL_LIST, new ILoader() { public Object load() { return Db.selectList("select ID,name TEXT from TFW_Role where name is not null order by name ", Paras.create(), new AopContext("ztree")); @@ -239,7 +239,7 @@ public class CacheController extends BladeController { @ResponseBody @RequestMapping("/dicTreeList") public AjaxResult dicTreeList() { - List> dic = CacheKit.get(DICT_CACHE, "dict_all", + List> dic = CacheKit.get(DICT_CACHE, DICT_TREE_ALL, new ILoader() { public Object load() { return Db.selectList("select code \"code\",id \"id\",pId \"pId\",name \"name\",num \"num\",'false' \"open\" from TFW_DICT order by code asc,num asc", Paras.create()); @@ -252,7 +252,7 @@ public class CacheController extends BladeController { @ResponseBody @RequestMapping("/deptTreeList") public AjaxResult deptTreeList() { - List> dept = CacheKit.get(DEPT_CACHE, "dept_tree_all_" + ShiroKit.getUser().getId(), + List> dept = CacheKit.get(DEPT_CACHE, DEPT_TREE_ALL + "_" + ShiroKit.getUser().getId(), new ILoader() { public Object load() { return Db.selectList("select id \"id\",pId \"pId\",simpleName as \"name\",(case when (pId=0 or pId is null) then 'true' else 'false' end) \"open\" from TFW_DEPT ", Paras.create(), new AopContext("ztree"), Cst.me().getDefaultSelectFactory().deptIntercept()); @@ -265,7 +265,7 @@ public class CacheController extends BladeController { @ResponseBody @RequestMapping("/roleTreeList") public AjaxResult roleTreeList() { - List> dept = CacheKit.get(ROLE_CACHE, "role_tree_all_" + ShiroKit.getUser().getId(), + List> dept = CacheKit.get(ROLE_CACHE, ROLE_TREE_ALL + "_" + ShiroKit.getUser().getId(), new ILoader() { public Object load() { return Db.selectList("select id \"id\",pId \"pId\",name as \"name\",(case when (pId=0 or pId is null) then 'true' else 'false' end) \"open\" from TFW_ROLE ", Paras.create(), new AopContext("ztree"), Cst.me().getDefaultSelectFactory().roleIntercept()); @@ -279,7 +279,7 @@ public class CacheController extends BladeController { @RequestMapping("/getDicById") public AjaxResult getDicById() { final int id = getParameterToInt("id"); - List> dict = CacheKit.get(DICT_CACHE, "dict_" + id, + List> dict = CacheKit.get(DICT_CACHE, DICT + id, new ILoader() { public Object load() { return Db.selectList("select CODE from TFW_DICT where id=#{id}",Paras.create().set("id", id), new AopContext("ztree")); @@ -291,7 +291,7 @@ public class CacheController extends BladeController { @ResponseBody @RequestMapping("/menuTreeList") public AjaxResult menuTreeList() { - List> menu = CacheKit.get(MENU_CACHE, "menu_tree_all", + List> menu = CacheKit.get(MENU_CACHE, MENU_TREE_ALL, new ILoader() { public Object load() { return Db.selectList("select code \"id\",pCode \"pId\",name \"name\",(case when levels=1 then 'true' else 'false' end) \"open\" from TFW_MENU where status=1 order by levels asc,num asc"); @@ -305,7 +305,7 @@ public class CacheController extends BladeController { @RequestMapping("/menuTreeListByRoleId") public AjaxResult menuTreeListByRoleId() { final String roleId = getParameter("roleId", "0"); - List> menu = CacheKit.get(MENU_CACHE, "tree_role_" + roleId, + List> menu = CacheKit.get(MENU_CACHE, MENU_TREE + roleId, new ILoader() { @SuppressWarnings("rawtypes") public Object load() { @@ -341,7 +341,7 @@ public class CacheController extends BladeController { public AjaxResult roleTreeListById() { final String Id = getParameter("id"); final String roleId = getParameter("roleId", "0"); - List> menu = CacheKit.get(ROLE_CACHE, "role_tree_" + Id, + List> menu = CacheKit.get(ROLE_CACHE, ROLE_TREE + Id, new ILoader() { public Object load() { String sql = "select id \"id\",pId \"pId\",name as \"name\",(case when (pId=0 or pId is null) then 'true' else 'false' end) \"open\" from TFW_ROLE order by pId,num asc"; diff --git a/src/main/java/com/smallchill/system/controller/ExcelController.java b/src/main/java/com/smallchill/system/controller/ExcelController.java index b0b46764..7943b711 100644 --- a/src/main/java/com/smallchill/system/controller/ExcelController.java +++ b/src/main/java/com/smallchill/system/controller/ExcelController.java @@ -66,12 +66,12 @@ public class ExcelController extends BladeController{ String orderby = (Func.isOneEmpty(sort, order)) ? (" order by " + sort + " " + order) : ""; String sql = "select {} from (" + _source + ") a " + SqlKeyword.getWhere((String) where) + orderby; - CacheKit.remove(cacheName, "excel_sql_" + code); - CacheKit.remove(cacheName, "excel_colname_" + code); - CacheKit.remove(cacheName, "excel_colmodel_" + code); - CacheKit.put(cacheName, "excel_sql_" + code, sql); - CacheKit.put(cacheName, "excel_colname_" + code, _colname); - CacheKit.put(cacheName, "excel_colmodel_" + code, _colmodel); + CacheKit.remove(cacheName, EXCEL_SQL + code); + CacheKit.remove(cacheName, EXCEL_COL_NAME + code); + CacheKit.remove(cacheName, EXCEL_COL_MODEL + code); + CacheKit.put(cacheName, EXCEL_SQL + code, sql); + CacheKit.put(cacheName, EXCEL_COL_NAME + code, _colname); + CacheKit.put(cacheName, EXCEL_COL_MODEL + code, _colmodel); return json(code); } @@ -81,9 +81,9 @@ public class ExcelController extends BladeController{ */ @RequestMapping("/export") public String export(ModelMap modelMap, HttpServletResponse response, @RequestParam String code) { - String sql = CacheKit.get(cacheName, "excel_sql_" + code); - String [] _colname = CacheKit.get(cacheName, "excel_colname_" + code); - List> _colmodel = CacheKit.get(cacheName, "excel_colmodel_" + code); + String sql = CacheKit.get(cacheName, EXCEL_SQL + code); + String [] _colname = CacheKit.get(cacheName, EXCEL_COL_NAME + code); + List> _colmodel = CacheKit.get(cacheName, EXCEL_COL_MODEL + code); List entityList = new ArrayList(); StringBuilder sb = new StringBuilder(); @@ -117,7 +117,7 @@ public class ExcelController extends BladeController{ } private String getInfoByCode(String code, String col) { - List> menu = CacheKit.get("menuCache", "menu_table_all", + List> menu = CacheKit.get(MENU_CACHE, MENU_TABLE_ALL, new ILoader() { public Object load() { return Db.selectList("select CODE,PCODE,NAME,URL,SOURCE,PATH,TIPS,ISOPEN from TFW_MENU order by levels asc,num asc"); diff --git a/src/main/java/com/smallchill/system/controller/GenerateController.java b/src/main/java/com/smallchill/system/controller/GenerateController.java index d146dd2f..4b4d96ba 100644 --- a/src/main/java/com/smallchill/system/controller/GenerateController.java +++ b/src/main/java/com/smallchill/system/controller/GenerateController.java @@ -104,7 +104,7 @@ public class GenerateController extends CurdController { String serviceimplPath = path + File.separator + "service" + File.separator + "impl" + File.separator + upperModelName + "ServiceImpl.java"; //resources - String sqlPath = resourcesPath + File.separator + "beetlsql" + File.separator + upperModelName + ".md"; + String sqlPath = resourcesPath + File.separator + "beetlsql" + File.separator + lowerModelName + ".md"; //webapp String indexPath = webappPath + File.separator + "gen" + File.separator + lowerModelName + File.separator + lowerModelName + ".html"; diff --git a/src/main/java/com/smallchill/system/controller/LoginController.java b/src/main/java/com/smallchill/system/controller/LoginController.java index cbe9b87b..9ea5eb68 100644 --- a/src/main/java/com/smallchill/system/controller/LoginController.java +++ b/src/main/java/com/smallchill/system/controller/LoginController.java @@ -58,7 +58,7 @@ public class LoginController extends BaseController implements Const{ } /** - * GET 登录 + * 登陆地址 */ @GetMapping("/login") public String login() { @@ -69,7 +69,7 @@ public class LoginController extends BaseController implements Const{ } /** - * POST 登录 + * 登陆请求 */ @Before(LoginValidator.class) @ResponseBody @@ -115,7 +115,7 @@ public class LoginController extends BaseController implements Const{ return REDIRECT + "/login"; } - @RequestMapping(value = "/unauth") + @RequestMapping("/unauth") public String unauth() { if (ShiroKit.notAuthenticated()) { return REDIRECT + "/login"; diff --git a/src/main/java/com/smallchill/system/controller/MenuController.java b/src/main/java/com/smallchill/system/controller/MenuController.java index 674ddc33..255af641 100644 --- a/src/main/java/com/smallchill/system/controller/MenuController.java +++ b/src/main/java/com/smallchill/system/controller/MenuController.java @@ -29,7 +29,6 @@ import org.springframework.web.bind.annotation.ResponseBody; import com.smallchill.common.base.BaseController; import com.smallchill.core.annotation.Before; import com.smallchill.core.annotation.Permission; -import com.smallchill.core.constant.ConstCache; import com.smallchill.core.constant.ConstShiro; import com.smallchill.core.interfaces.ILoader; import com.smallchill.core.plugins.dao.Db; @@ -187,11 +186,10 @@ public class MenuController extends BaseController implements ConstShiro{ @ResponseBody @RequestMapping("/getMenu") public List> getMenu(){ - String MENU_CACHE = ConstCache.MENU_CACHE; final Object userId = getParameter("userId"); final Object roleId = getParameter("roleId"); - Map userRole = CacheKit.get(MENU_CACHE, "role_ext_" + userId, new ILoader() { + Map userRole = CacheKit.get(MENU_CACHE, ROLE_EXT + userId, new ILoader() { @Override public Object load() { return Db.selectOne("select * from TFW_ROLE_EXT where USERID=#{userId}", Paras.create().set("userId", userId)); @@ -216,7 +214,7 @@ public class MenuController extends BaseController implements ConstShiro{ sql.append(" )"); sql.append(" order by levels,pCode,num"); - List> sideBar = CacheKit.get(MENU_CACHE, "sideBar_" + userId, new ILoader() { + List> sideBar = CacheKit.get(MENU_CACHE, SIDEBAR + userId, new ILoader() { @Override public Object load() { return Db.selectList(sql.toString()); diff --git a/src/main/java/com/smallchill/system/controller/UserController.java b/src/main/java/com/smallchill/system/controller/UserController.java index 3a0090f5..0ad3d698 100644 --- a/src/main/java/com/smallchill/system/controller/UserController.java +++ b/src/main/java/com/smallchill/system/controller/UserController.java @@ -416,7 +416,7 @@ public class UserController extends BaseController implements ConstShiro{ @ResponseBody @RequestMapping("/userTreeList") public AjaxResult userTreeList() { - List> dept = CacheKit.get(DEPT_CACHE, "user_tree_all", + List> dept = CacheKit.get(DEPT_CACHE, USER_TREE_ALL, new ILoader() { public Object load() { return Db.selectList("select id \"id\",pId \"pId\",simpleName as \"name\",(case when (pId=0 or pId is null) then 'true' else 'false' end) \"open\" from TFW_DEPT order by pId,num asc", Paras.create(), new AopContext(), new IQuery() { diff --git a/src/main/java/com/smallchill/system/controller/ZTreeController.java b/src/main/java/com/smallchill/system/controller/ZTreeController.java index 8df2fd94..d5f591f3 100644 --- a/src/main/java/com/smallchill/system/controller/ZTreeController.java +++ b/src/main/java/com/smallchill/system/controller/ZTreeController.java @@ -98,7 +98,7 @@ public class ZTreeController extends BladeController { final Map modelOrMap = params; - List> list = CacheKit.get(DICT_CACHE, "ztree_list_" + type, + List> list = CacheKit.get(DICT_CACHE, DICT_ZTREE_LIST + type, new ILoader() { public Object load() { return Db.selectList(sqlSource, modelOrMap); diff --git a/src/main/webapp/WEB-INF/view/common/_template/_controller/_controller.bld b/src/main/webapp/WEB-INF/view/common/_template/_controller/_controller.bld index 7cb57ed0..fd57f084 100644 --- a/src/main/webapp/WEB-INF/view/common/_template/_controller/_controller.bld +++ b/src/main/webapp/WEB-INF/view/common/_template/_controller/_controller.bld @@ -23,7 +23,7 @@ ${"@"}RequestMapping("/${lowerModelName}") public class ${modelName}Controller extends BaseController { private static String CODE = "${lowerModelName}"; private static String PREFIX = "${tableName}"; - private static String LIST_SOURCE = "${modelName}.list"; + private static String LIST_SOURCE = "${lowerModelName}.list"; private static String BASE_PATH = "/platform/${lowerModelName}/"; ${"@"}Autowired