JeeSite内置组件应用.pdfVIP

  • 182
  • 0
  • 约6.13千字
  • 约 7页
  • 2018-04-27 发布于江苏
  • 举报
JeeSite 内置组件的应⽤ 1. 常⽤组件 1.1. 布局组件 布局⽂件配置: / jeesite/src/main/webapp/WEB-INF/decorators.xml 默认布局⽂件: / jeesite/src/main/webapp/WEB-INF/views/layouts/default .j sp ⾮公共,⾃⼰建⽴的布局⽂件: / jeesite/src/main/webapp/WEB-INF/views/模块路径/layouts/布局⽂件.j sp 使⽤布局⽂件: SP的head⾥添加:meta name=decorator content=default/ 1.2. ⽤户⼯具 UserUtils.j ava fns.tld 应⽤场景:在j ava⽂件或j sp页⾯上,获取当前⽤户相关信 1. 获取当前⽤户: 1) UserUtils.getUser(); 2 ) entity .currentUser() 3 ) ${fns:getUser()} 2. 获取当前⽤户部门: 1) UserUtils.getOfficeList() 2 ) ${fns:getOfficeList()} 3. 获取当前⽤户区域: 1) UserUtils.getAreaList() 2 ) ${fns:getAreaList()} 4 . 获取当前⽤户菜单: 1) UserUtils.getMenuList() 2 ) ${fns:getMenuList()} 5. 获取当前⽤户缓存: 1) UserUtils.getCache(key); 2 ) ${fns:getCache(cacheName , defaultValue)} 6. 设置当前⽤户缓存: 1) UserUtils.putCache(key); 1.3. 全局缓存 CacheUtils.j ava 应⽤场景:系统字典 1. 设置应⽤程序缓存:CacheUtils.put(key); 2. 获取应⽤程序缓存:CacheUtils.get(key); 1.4. 字 ⼯具 DictUtils.j ava 应⽤场景:系统全局固定的字典数据,j ava或j sp 中获取字典相关数据。 1. 根据类型和值获取字典标签 (列表取值): a) DictUtils.getDictLabel(Stringvalue , String type , String defaultValue) b) ${ fns:getDictLabel (value ,type , defaultValue)} 2. 根据类型和标签获取字典值 (根据标签取值): a) DictUtils.getDictValue(Stringlabel , String type , String defaultLabel) b) ${fns:getDictValue(label , type ,defaultValue)} 3. 根据类型获取字典列表 (下拉框,复选框,单选框): a) DictUtils.getDictList(Stringtype) b) ${fns:getDictList(type)} 1.5. 功能权限控制 应⽤场景:访问功能授权,查看权限,编辑权限,导⼊权限,审核权限。 1. 给⽅法添加权限标志 @RequiresPermissions(sys:submodule:user:view) @RequiresUser 2. 菜单中设置权限标志。 3. 判断权限: SecurityUtils.getSubject() .isPermitted(sys:user:edit) ; 4 . 视图中控制按钮 (shiro .tld ): shiro:hasPermissionname=sys:user:edit inputid=btnSubmit class=btn btn-primaryt /shiro:hasPermission !-- 任何⼀个符合条件的权限 -- shiro:hasAnyPermissio

文档评论(0)

1亿VIP精品文档

相关文档