思维导图版下载
https://gitee.com/hugo110/springboot-boot/tree/master/文档资料
项目git地址
https://gitee.com/hugo110/springboot-boot
前端
1.权限使用
2.数据字典使用
3.前端通用工具类介绍
4.封装组件介绍
1.权限使用
1.1html使用
源码位置
ShiroExt.java
方法:
shiro.hasPermission(permission)
参数:
permission(权限URL)
示例代码
@if(shiro.hasPermission("/systemUser/toSystemUserAdd")){
<button class="layui-btn boot-layer " boot-title="添加用户" boot-url="${ctxPath}/systemUser/toSystemUserAdd" >
<i class="layui-icon"></i>添加
</button>
@}
1.2 js中使用
源码位置
jquery.shiro.js
方法:
$.shiro.hasPermission(permission)
参数:
permission(权限URL)
示例代码:
if($.shiro.hasPermission('/systemUser/toSystemUserUpdate')){
html+='<a class="layui-btn layui-btn-xs boot-layer " boot-title="修改用户" boot-url="'+ctxPath+'/systemUser/toSystemUserUpdate?id='+d.id+'">编辑</a>';
}
2.数据字典使用
2.1.html使用
源码位置:
DictUtil
方法:
selectOne
参数:
pId(父字典id), dictValue(字典值)
代码:
${dict.selectOne("1234567891023",model.logType).name}
2.2.js使用
源码位置
jquery.dict.js
方法:$.dict.cache(id, dictValue)
参数:id(数据字典表这一类型集合的id),dictValue(字典值)
返回
返回name
代码:
$.dict.cache('1234567891023',d.logType)
3.前端通用工具类介绍
3.1.prototype.ext.js (js原生prototype 开发)
3.1.1String.prototype.equalsIgnoreCase
参考java
忽略大小写比较字符串是否相等
3.2 jquery.layui.util.js (layui通用工具类 集成在jquery上)
参考文档 https://blog.csdn.net/mengxiangxingdong/article/details/87252394
3.3 layui.form.verify.js (layui验证扩展)
验证,基于layui的原生验证扩展
属性 | 作用 |
---|---|
required | 必填 |
phone | 手机号 |
邮箱 | |
url | 网址url |
number | 数字 |
date | 日期 |
identity | 身份证 |
eqVlaue | 验证两个input的输入值是否一致 |
json | 实证是否为标准的json字符串你输入 |
maxlengths | 限制input输入长度,可用自定义属性maxlengths 限制当前表单的maxlengths,默认255 |
decimal | 科学计数法超大数字验证,默认为Long的最大值,最小值 |
fax | 传真 |
3.4 underscore.ext.js(基于 underscore.js 无侵入式扩展)
3.4.1 formatDate
格式化日期
3.4.2idNum
身份证号验证
3.4.3 convertCurrency
把数字金额转换为(中文大写)金额.
3.4.5decimal
科学计数法验证
3.4.6 objToArr
- obj 的key 和value 转变成 对象键值对 例如 :obj={“key”:“test”,“key2”:“test2”}
* 调用之后变为
* arr=[{“name”:“key”,“value”:“test1”},{“name”:“key2”,“value”:“test2”}]
*
3.4.7 listToTree
后台list转变成树
var defaultOptions={
idName:“id”,
pidName:“pid”,
“childArrName”:“childArr”
}
3.5 jquery.ext.js (基于jquery扩展插件)
3.5.1 serializeObject 将表单序列化成json
4.封装方法(组件)
源码位置 layui.ext.js
4.1 html加上class=“className”就可以触发效果
4.1.1 boot-reload (刷新当前页面)
简介
iframe页面中,元素添加这个class样式后,点击会刷新当前页面
属性
无
示例:
<button id="btn-refresh" class="layui-btn boot-reload" >
<i class="iconfont"></i> 刷新数据
</button>
4.1.2 boot-layer (弹出框)
简介
添加这个class之后,点击就会增加弹出layui的iframe弹出层
属性
属性 | 介绍 |
---|---|
bootTitle | 弹出层的标题,默认:不展示标题 |
bootUrl | 请求后台的URL,也可以是静态页面URL,默认找不到提示404 |
bootWidth | 弹窗框的宽,默认800 |
bootHeight | 弹出框的高,默认,($(window).height() - 50); |
end | 弹出层销毁的执行方法,默认什么都不执行 |
示例
<button class="layui-btn boot-layer " boot-title="添加用户" boot-url="${ctxPath}/systemUser/toSystemUserAdd" >
<i class="layui-icon"></i>添加
</button>
4.1.3 boot-ajax(ajax请求)
简介
添加这个class折后,点击会先出现一个询问框,确认之后,会发出ajax请求到后台
属性
属性 | 介绍 |
---|---|
bootTitle | 弹出层的标题,默认:不展示标题 |
bootUrl | 请求后台的URL,也可以是静态页面URL,默认找不到提示404 |
boot-batch | 这次请求是否为批处理,是则提取当前表格的数据 |
boot-data | 请求后台附加的默认参数,必须以{}包裹的标准json字符串 |
示例
<button class="layui-btn layui-btn-primary boot-ajax boot-batch" boot-data='{"state":"2"}' boot-title="确认冻结用户吗?" boot-url="${ctxPath}/systemUser/freezeUserBatch" >
<i class="layui-icon "></i>批量冻结用户
</button>
4.1.4 boot-search-btn(lay table控件专用 )
简介
添加这个class之后,点击刷新当前表格的列表
属性
layTableId
当前表格的layui的id
示例
<button id="search_btn" class="layui-btn boot-search-btn">
<i class="layui-icon"></i>
</button>
4.2 lay-filter(点击之后自动提交表单和验证表单)
4.2.1boot-form-btn(防止表单重复提交)
点击之后自动提交表单和验证表单
4.3 CommonController
4.3.1 通用ztree树
简介
封装弹出层,直接关联弹出ztree树数据
url
common/showTree
属性(注意需要和get拼接在url后面)
属性 | 介绍 |
---|---|
treeUrl | 树数据默认展示的url |
treeTitle | 树数据title |
showNameDom | 回调在父iframe的页面iframeinput框的id |
showIdDom | 回调在父iframe的input框的id |
示例代码
<input type="hidden" id="pId" name="pId" value=""> <input
type="text" id="showNameDom" name="showNameDom"
autocomplete="off" class="layui-input boot-layer"
boot-url="${ctxPath}/common/showTree?treeUrl=${ctxPath}/systemDept/systemDeptList&treeTitle=fullName&showNameDom=showNameDom&showIdDom=pId"
boot-width="300" boot-height="400" boot-title="选择上级部门"
end="function(){}" placeholder="如果不选择,默认为顶级部门" >
4.3.2 通用查看用户设备信息
简介
访问这个url会将userAgent转化为浏览器对象
url
common/userSystemDetail
属性
userAgentStr
字符串
示例
<tr>
<th>userAgentStr:</th>
<th> <button title="点击查看本条记录的系统设备信息详情" class="layui-btn layui-btn-sm boot-layer " boot-title="用户操作系统信息" boot-url="${ctxPath}/common/userSystemDetail?userAgentStr=${model.userAgentStr}" >
<i class="layui-icon"></i>查看系统信息
</button></th>
</tr>
4.4 其他
4.4.1 boot.common.js
boot-substring
截字
4.4.2 验证码调用
<img src="${ctxPath}/images/captcha" onclick="this.src='${ctxPath}/images/captcha?d='+Math.random();" class="captcha" style="width:40%;float:right;"/>
后端
1.shiro
参考ShiroExt.java
2.操作日志记录(@OperationLog)
@OperationLog(logName = “添加部门”, operationLogType = OperationLogType.INSERT)
属性 | 介绍 |
---|---|
logName | 访问当前方法,记录的操作名称 |
operationLogType | 操作类型,增删改查等等 |