1.1. 布局組件
布局文件配置:
/ jeesite/src/main/webapp/WEB-INF/decorators.xml
默認(rèn)布局文件:
/ jeesite/src/main/webapp/WEB-INF/views/layouts/default.jsp
非公共,自己建立的布局文件:
/ jeesite/src/main/webapp/WEB-INF/views/模塊路徑/layouts/布局文件.jsp
使用布局文件:
JSP的head里添加:<meta name="decorator" content="default"/>
1.2. 用戶工具 UserUtils.java fns.tld
應(yīng)用場景:在java文件或jsp頁面上,獲取當(dāng)前用戶相關(guān)信息
1. 獲取當(dāng)前用戶:
1) UserUtils.getUser();
2) entity.currentUser()
3) ${fns:getUser()}
2. 獲取當(dāng)前用戶部門:
1) UserUtils.getOfficeList()
2) ${fns:getOfficeList()}
3. 獲取當(dāng)前用戶區(qū)域:
1) UserUtils.getAreaList()
2) ${fns:getAreaList()}
4. 獲取當(dāng)前用戶菜單:
1) UserUtils.getMenuList()
2) ${fns:getMenuList()}
5. 獲取當(dāng)前用戶緩存:
1) UserUtils.getCache(key);
2) ${fns:getCache(cacheName, defaultValue)}
6. 設(shè)置當(dāng)前用戶緩存:
1) UserUtils.putCache(key);
1.3. 全局緩存 CacheUtils.java
應(yīng)用場景:系統(tǒng)字典
1. 設(shè)置應(yīng)用程序緩存:CacheUtils.put(key);
2. 獲取應(yīng)用程序緩存:CacheUtils.get(key);
1.4. 字典工具 DictUtils.java
應(yīng)用場景:系統(tǒng)全局固定的字典數(shù)據(jù),java或jsp中獲取字典相關(guān)數(shù)據(jù)。
1. 根據(jù)類型和值獲取字典標(biāo)簽(列表取值):
a) DictUtils.getDictLabel(Stringvalue, String type, String defaultValue)
b) ${ fns:getDictLabel (value,type, defaultValue)}
2. 根據(jù)類型和標(biāo)簽獲取字典值(根據(jù)標(biāo)簽取值):
a) DictUtils.getDictValue(Stringlabel, String type, String defaultLabel)
b) ${fns:getDictValue(label, type,defaultValue)}
3. 根據(jù)類型獲取字典列表(下拉框,復(fù)選框,單選框):
a) DictUtils.getDictList(Stringtype)
b) ${fns:getDictList(type)}
1.5. 功能權(quán)限控制
應(yīng)用場景:訪問功能授權(quán),查看權(quán)限,編輯權(quán)限,導(dǎo)入權(quán)限,審核權(quán)限。
1. 給方法添加權(quán)限標(biāo)志
@RequiresPermissions("sys:submodule:user:view")
@RequiresUser
2. 菜單中設(shè)置權(quán)限標(biāo)志。
3. 判斷權(quán)限:
SecurityUtils.getSubject().isPermitted("sys:user:edit");
4. 視圖中控制按鈕(shiro.tld):
<shiro:hasPermissionname="sys:user:edit">
<inputid="btnSubmit" class="btn btn-primary"type="submit" value="保存"/>
</shiro:hasPermission>
<!-- 任何一個(gè)符合條件的權(quán)限 -->
<shiro:hasAnyPermissions name="sys:user:view,sys:user:edit,">
<inputid="btnSubmit" class="btn btn-primary"type="submit" value="返回"/>
</shiro: hasAnyPermissions>
1.6. 數(shù)據(jù)權(quán)限
應(yīng)用場景:某用戶訪問數(shù)據(jù)范圍:公司及子公司,本公司,部門及子部門,本部門,當(dāng)前用戶,明細(xì)設(shè)置。
// 生成數(shù)據(jù)權(quán)限過濾條件(dsf為dataScopeFilter的簡寫,在xml中使用 ${sqlMap.dsf}調(diào)用權(quán)限SQL)
user.getSqlMap().put("dsf", dataScopeFilter(user.getCurrentUser(),"o", "u"));
<!-- 分頁查詢用戶信息 -->
<select id="findList" parameterType="User"resultMap="userResult">
SELECT
<include refid="userColumns"/>
FROM sys_user a
<include refid="userJoins"/>
WHERE a.del_flag = '0'
<!-- 數(shù)據(jù)范圍過濾 -->
${sqlMap.dsf}
</select>
/**
* 數(shù)據(jù)范圍過濾
* @param user 當(dāng)前用戶對(duì)象,通過“entity.getCurrentUser()”獲取
* @param officeAlias 機(jī)構(gòu)表別名,多個(gè)用“,”逗號(hào)隔開。
* @param userAlias 用戶表別名,多個(gè)用“,”逗號(hào)隔開,傳遞空,忽略此參數(shù)
* @return 標(biāo)準(zhǔn)連接條件對(duì)象
*/
String dataScopeFilter (User user, StringofficeAlias, String userAlias)
1.7. 智能分頁組件
// 設(shè)置分頁參數(shù),則分頁,如果不設(shè)置,則根據(jù)條件獲取全部
user.setPage(page);
// 執(zhí)行分頁查詢
page.setList(userDao.findPage(user));
1.8. 樹選擇組件
標(biāo)簽文件:/ jeesite/src/main/webapp/WEB-INF/tags/treeselect.tag
1.8.1. 區(qū)域選擇組件
<tags:treeselect id="area"name="area.id" value="${area.id}" labelName="area.name"labelValue="${area.name}" title="區(qū)域" url="/sys/area/treeData"cssClass="input-small" allowClear="true" notAllowSelectParent="true"/>
多選需要加 checked="true" 屬性
1.8.2. 公司選擇組件
<tags:treeselectid="office" name="office.id"value="${user.office.id}" labelName="office.name"labelValue="${user.office.name}" title="部門" url="/sys/office/treeData?type=1"cssClass="input-small" allowClear="true"notAllowSelectParent="true"/>
多選需要加 checked="true" 屬性
1.8.3. 部門選擇組件
<tags:treeselectid="office" name="office.id"value="${user.office.id}" labelName="office.name"labelValue="${user.office.name}" title="部門" url="/sys/office/treeData?type=2"cssClass="input-small" allowClear="true"notAllowSelectParent="true"/>
多選需要加 checked="true" 屬性
1.8.4. 人員選擇組件
<tags:treeselectid="user" name="user.id" value="${user.id}"labelName="user.name" labelValue="${user.name}" title="用戶" url="/sys/office/treeData?type=3"cssClass="input-small" allowClear="true"notAllowSelectParent="true"/>
多選需要加 checked="true" 屬性
1.9. 文件選擇、文件上傳組件
<form:hidden path="name"htmlEscape="false" maxlength="255"class="input-xlarge"/>
<tags:ckfinder input="name"type="files" uploadPath="/test "/>
1.10. 富文本在線編輯器組件
<form:textarea id="name"htmlEscape="true" path="name" rows="4"maxlength="200" class="input-xxlarge"/>
<tags:ckeditor replace="name"uploadPath="/test " />
1.11. 其它工具
/src/main/java/com/thinkgem/jeesite/common/utils/...
Excel(Export/Import)、StringUtils、DateUtils、FileUtils、Encodes、CookieUtils、Collections3
2.1. 工具類組件
1) UserUtils:用戶工具類(獲取當(dāng)前用戶的相關(guān)信息)。
2) CacheUtils:系統(tǒng)級(jí)別Cache工具類。
3) CookieUtils:Cookie操作工具類
4) DateUtils:日期時(shí)間工具類。
5) FileUtils:文件操作工具類。
6) StringUtils:字符串操作工具類。
7) ExcelExcel導(dǎo)入導(dǎo)出,參考用戶導(dǎo)入導(dǎo)出例子。
8) Reflections:Java對(duì)象操作反射工具類。
9) BeanMapper:Bean與Bean,Bean與Conllection的互轉(zhuǎn)
10) JaxbMapper:XML與Object互轉(zhuǎn)。
11) JsonMapper:JSON與Object互轉(zhuǎn)。
12) Cryptos、Digests:密鑰工具類SHA1、MD5。
13) Collections3:集合對(duì)象工具類。
14) Encodes:各種編碼轉(zhuǎn)換工具類。
15) Exceptions:異常工具類。
16) FreeMarkers:FreeMarkers模板工具類。
17) Identities:唯一標(biāo)識(shí)生成算法工具類(uuid、random)
18) PropertiesLoader:屬性文件操作工具類
19) Threads:線程相關(guān)操作工具類。
2.2. 自定義標(biāo)簽組件
1)ckeditor.tag:HTML在線編輯器。
2)ckfinder.tag:在線文件管理。
3)iconselect.tag:Icon圖標(biāo)選擇。
4)message.tag:消息彈框。
5)validateCode.tag:驗(yàn)證碼。
2.3. EL 函數(shù)組件
1)fns.tld:系統(tǒng)相關(guān)EL函數(shù)。
2.4. JavaScript 組件
1) jQuery:強(qiáng)大的js框架,動(dòng)態(tài)特性,AJAX、插件擴(kuò)展
2) jQuery Validate:基于jQuery的客戶端校驗(yàn)插件。
3) jBox:基于jQuery的多功能對(duì)話框插件。
4) zTree:基于jQuery的樹結(jié)構(gòu)展示查看。
5) My7DatePicker:日期選擇控件。
6) treeTable:基于jQuery的表格數(shù)顯示插件。
7) CKEditor:富文本在線HTML編輯器。
8) CKFinder:在線文件資源管理器。
9) SuperSlide:基于jQuery的滑動(dòng)門插件(滑動(dòng)圖片,Tab,橫幅等)。
top.$.jBox.open('iframe:'+href,'查看評(píng)論',$(top.document).width()-220,$(top.document).height()-180,{
buttons:{"關(guān)閉":true},
loaded:function(h){
$(".jbox-content",top.document).css("overflow-y","hidden");
$(".nav,.form-actions,[class=btn]",h.find("iframe").contents()).hide();
$("body",h.find("iframe").contents()).css("margin","10px");
}
});
更多建議: