代码优化

This commit is contained in:
zhuangqian 2016-10-29 09:37:20 +08:00
parent 4a37b44116
commit 46b8249afc
17 changed files with 130 additions and 50 deletions

View File

@ -18,8 +18,8 @@
<spring.version>4.3.3.RELEASE</spring.version>
<shiro.version>1.3.2</shiro.version>
<log4j2.version>2.7</log4j2.version>
<beetl.version>2.5.2</beetl.version>
<beetlsql.version>2.6.5</beetlsql.version>
<beetl.version>2.7.0</beetl.version>
<beetlsql.version>2.6.6</beetlsql.version>
</properties>
<dependencies>
@ -170,7 +170,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.19</version>
<version>1.2.20</version>
</dependency>
<!-- easypoi -->

View File

@ -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);

View File

@ -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<Map<String, Object>> listUser = CacheKit.get(ConstCache.USER_CACHE, "user_all_list", new ILoader() {
List<Map<String, Object>> 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");
}
});

View File

@ -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);

View File

@ -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<String, Object> userRole = CacheKit.get(ConstCache.MENU_CACHE, "roleExt_" + userId,
Map<String, Object> 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<Map<String, Object>> btnList = CacheKit.get(ConstCache.MENU_CACHE, "btnList_rightMenu_" + code + "_" + userId, new ILoader() {
List<Map<String, Object>> 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));
}

View File

@ -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<Map<String, Object>> dict = CacheKit.get(ConstCache.DICT_CACHE,"dropdown_"+ type + "_" + code, new ILoader() {
List<Map<String, Object>> dict = CacheKit.get(ConstCache.DICT_CACHE, ConstCacheKey.DROPDOWN + type + "_" + code, new ILoader() {
@Override
public Object load() {
return Db.selectList(sqlstr);

View File

@ -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<String, Object> _modelOrMap = modelOrMap;
final IQuery _intercept = intercept;
List<Map<String, Object>> dict = CacheKit.get(CACHE_NAME, "dict_" + type + "_" + code + "_" + ShiroKit.getUser().getId(), new ILoader() {
List<Map<String, Object>> 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);

View File

@ -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_";
}

View File

@ -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));

View File

@ -142,7 +142,7 @@ public class CacheController extends BladeController {
public AjaxResult getSelect() {
final String code = getParameter("code");
final String num = getParameter("num");
List<Map<String, Object>> dict = CacheKit.get(DICT_CACHE, "dict_common_" + code,
List<Map<String, Object>> 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<Map<String, Object>> dict = CacheKit.get(DICT_CACHE, "dict_combo_" + code,
List<Map<String, Object>> 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<Map<String, Object>> dept = CacheKit.get(DEPT_CACHE, "dept_all",
List<Map<String, Object>> 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<Map<String, Object>> dept = CacheKit.get(DEPT_CACHE, "user_all",
List<Map<String, Object>> 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<Map<String, Object>> dept = CacheKit.get(ROLE_CACHE, "role_all",
List<Map<String, Object>> 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<Map<String, Object>> dic = CacheKit.get(DICT_CACHE, "dict_all",
List<Map<String, Object>> 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<Map<String, Object>> dept = CacheKit.get(DEPT_CACHE, "dept_tree_all_" + ShiroKit.getUser().getId(),
List<Map<String, Object>> 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<Map<String, Object>> dept = CacheKit.get(ROLE_CACHE, "role_tree_all_" + ShiroKit.getUser().getId(),
List<Map<String, Object>> 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<Map<String, Object>> dict = CacheKit.get(DICT_CACHE, "dict_" + id,
List<Map<String, Object>> 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<Map<String, Object>> menu = CacheKit.get(MENU_CACHE, "menu_tree_all",
List<Map<String, Object>> 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<Map<String, Object>> menu = CacheKit.get(MENU_CACHE, "tree_role_" + roleId,
List<Map<String, Object>> 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<Map<String, Object>> menu = CacheKit.get(ROLE_CACHE, "role_tree_" + Id,
List<Map<String, Object>> 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";

View File

@ -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<Map<String, String>> _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<Map<String, String>> _colmodel = CacheKit.get(cacheName, EXCEL_COL_MODEL + code);
List<ExcelExportEntity> entityList = new ArrayList<ExcelExportEntity>();
StringBuilder sb = new StringBuilder();
@ -117,7 +117,7 @@ public class ExcelController extends BladeController{
}
private String getInfoByCode(String code, String col) {
List<Map<String, Object>> menu = CacheKit.get("menuCache", "menu_table_all",
List<Map<String, Object>> 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");

View File

@ -104,7 +104,7 @@ public class GenerateController extends CurdController<Generate> {
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";

View File

@ -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";

View File

@ -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<Map<String, Object>> getMenu(){
String MENU_CACHE = ConstCache.MENU_CACHE;
final Object userId = getParameter("userId");
final Object roleId = getParameter("roleId");
Map<String, Object> userRole = CacheKit.get(MENU_CACHE, "role_ext_" + userId, new ILoader() {
Map<String, Object> 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<Map<String, Object>> sideBar = CacheKit.get(MENU_CACHE, "sideBar_" + userId, new ILoader() {
List<Map<String, Object>> sideBar = CacheKit.get(MENU_CACHE, SIDEBAR + userId, new ILoader() {
@Override
public Object load() {
return Db.selectList(sql.toString());

View File

@ -416,7 +416,7 @@ public class UserController extends BaseController implements ConstShiro{
@ResponseBody
@RequestMapping("/userTreeList")
public AjaxResult userTreeList() {
List<Map<String, Object>> dept = CacheKit.get(DEPT_CACHE, "user_tree_all",
List<Map<String, Object>> 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() {

View File

@ -98,7 +98,7 @@ public class ZTreeController extends BladeController {
final Map<String, Object> modelOrMap = params;
List<Map<String, Object>> list = CacheKit.get(DICT_CACHE, "ztree_list_" + type,
List<Map<String, Object>> list = CacheKit.get(DICT_CACHE, DICT_ZTREE_LIST + type,
new ILoader() {
public Object load() {
return Db.selectList(sqlSource, modelOrMap);

View File

@ -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