上传后台管理系统代码

This commit is contained in:
xxy
2020-05-06 07:40:43 +08:00
parent 8ba73ed42b
commit ca9fd1c2f7
1182 changed files with 276446 additions and 0 deletions

View File

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<form class="form-horizontal m-t" id="signupForm">
<div class="form-group">
<label class="col-sm-3 control-label">标签名:</label>
<div class="col-sm-8">
<input id="name" name="name" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">数据值:</label>
<div class="col-sm-8">
<input id="value" name="value" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">类型:</label>
<div class="col-sm-8">
<input id="type" name="type" th:value="${type}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">描述:</label>
<div class="col-sm-8">
<input id="description" name="description" th:value="${description}" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">排序(升序):</label>
<div class="col-sm-8">
<input id="sort" name="sort" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注信息:</label>
<div class="col-sm-8">
<input id="remarks" name="remarks" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-3">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/js/appjs/common/dict/add.js">
</script>
</body>
</html>

View File

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<div class="fixed-table-toolbar">
<div class="columns pull-left">
<button shiro:hasPermission="common:dict:add" type="button"
class="btn btn-primary" onclick="add()">
<i class="fa fa-plus" aria-hidden="true"></i>添加
</button>
<button shiro:hasPermission="common:dict:batchRemove"
type="button" class="btn btn-danger" onclick="batchRemove()">
<i class="fa fa-trash" aria-hidden="true"></i>删除
</button>
</div>
<div class="columns pull-right">
<button class="btn btn-success" onclick="reLoad()">查询</button>
</div>
<div class="columns pull-right col-md-2">
<select data-placeholder="选择类别" class="form-control chosen-select"
tabindex="2" style="width: 100%">
<option value="">选择类别</option>
</select>
</div>
</div>
<table id="exampleTable" data-mobile-responsive="true">
</table>
</div>
</div>
</div>
</div>
<!--shiro控制bootstraptable行内按钮看见性-->
<div>
<script type="text/javascript">
var s_edit_h = 'hidden';
var s_remove_h = 'hidden';
var s_resetPwd_h = 'hidden';
</script>
</div>
<div shiro:hasPermission="common:dict:edit">
<script type="text/javascript">
s_edit_h = '';
</script>
</div>
<div shiro:hasPermission="common:dict:remove">
<script type="text/javascript">
var s_remove_h = '';
</script>
</div>
<div shiro:hasPermission="common:dict:add">
<script type="text/javascript">
var s_add_h = '';
</script>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript"
src="/js/appjs/common/dict/dict.js"></script>
</body>
</html>

View File

@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<form class="form-horizontal m-t" id="signupForm">
<input id="id" name="id" th:value="${dict.id}"
class="form-control" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">标签名:</label>
<div class="col-sm-8">
<input id="name" name="name" th:value="${dict.name}"
class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">数据值:</label>
<div class="col-sm-8">
<input id="value" name="value" th:value="${dict.value}"
class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">类型:</label>
<div class="col-sm-8">
<input id="type" name="type" th:value="${dict.type}"
class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">描述:</label>
<div class="col-sm-8">
<input id="description" name="description"
th:value="${dict.description}" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">排序:</label>
<div class="col-sm-8">
<input id="sort" name="sort" th:value="${dict.sort}"
class="form-control" type="text">
</div>
</div>
<div class="form-group hidden">
<label class="col-sm-3 control-label ">父级编号:</label>
<div class="col-sm-8">
<input id="parentId" name="parentId"
th:value="${dict.parentId}" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注信息:</label>
<div class="col-sm-8">
<input id="remarks" name="remarks"
th:value="${dict.remarks}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-3">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/js/appjs/common/dict/edit.js">
</script>
</body>
</html>

View File

@ -0,0 +1,220 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>小说精品屋 - 文件管理器</title>
<meta name="keywords" content="">
<meta name="description" content="">
<link rel="shortcut icon" href="favicon.ico">
<link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
<link href="/css/animate.css" rel="stylesheet">
<link href="/css/layui.css" rel="stylesheet">
<link href="/css/style.css?v=4.1.0" rel="stylesheet">
<style>
.aactive {
color: #13b5b7 !important;
}
.hactive:hover{
color: #13b5b7 !important;
}
</style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content" id="app">
<div class="row">
<div class="col-sm-3">
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="file-manager">
<button type="button" class="layui-btn" id="test1">
<i class="fa fa-cloud"></i>上传文件
</button>
<div class="hr-line-dashed"></div>
<ul class="folder-list" style="padding: 0">
<li><a href="javascript:void(0)" class="file-control hactive" :class="{'aactive':type === ''}"
v-on:click="changeType('')"><i class="fa fa-folder"></i>所有文件</a></li>
<li><a href="javascript:void(0)" class="file-control hactive" :class="{'aactive':type === 0}"
v-on:click="changeType(0)"><i class="fa fa-folder"></i>图片</a></li>
<li><a href="javascript:void(0)" :class="{'aactive':type === 1}"
v-on:click="changeType(1)" class="file-control hactive"><i class="fa fa-folder"></i>文档</a>
</li>
<li><a href="javascript:void(0)" v-on:click="changeType(2)" :class="{'aactive':type === 2}"
class="file-control hactive"><i class="fa fa-folder"></i>视频</a></li>
<li><a href="javascript:void(0)" v-on:click="changeType(3)" :class="{'aactive':type === 3}"
class="file-control hactive"><i class="fa fa-folder"></i>音乐</a></li>
<li><a href="javascript:void(0)" v-on:click="changeType(99)" :class="{'aactive':type === 99}"
class="file-control hactive"><i class="fa fa-folder"></i>其他</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="col-sm-9 animated fadeInRight">
<div class="row">
<div class="col-sm-12">
<div class="file-box" v-for="row in rows">
<div class="file">
<a href="#">
<span class="corner"></span>
<div class="image">
<img alt="image" class="img-responsive" :src="row.url">
</div>
<div class="file-name">
<br/>
<small>{{row.createDate}}</small>
</div>
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<button
class="btn btn-warning btn-xs copy" :url="row.url">复制
</button>&nbsp; &nbsp; &nbsp; &nbsp;<button class="btn btn-danger btn-xs"
@click="remove(row.id)">删除
</button>
</a>
</div>
</div>
<div id="incomeNum"></div>
</div>
</div>
<div>
<ul id="page"></ul>
</div>
</div>
</div>
</div>
<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/js/bootstrap-paginator.min.js"></script>
<script src="/js/content.js?v=1.0.0"></script>
<script src="/js/layui.js"></script>
<script src="/js/plugins/clipboard/clipboard.min.js"></script>
<script src="/js/plugins/layer/layer.min.js"></script>
<script src="/js/vue.min.js"></script>
<script>
var app = new Vue({
el: '#app',
data: {
limit: 12,
offset: 0,
total: 0,
file: '',
type: '',
rows: '',
},
methods: {
getData: function () {
$.getJSON("/common/sysFile/list", {
limit: this.limit,
offset: this.offset,
type: this.type
}, function (r) {
app.total = r.total;
app.rows = r.rows;
app.page();
});
},
page: function () {
var options = {
currentPage: app.offset / 12 + 1, //当前页
totalPages: Math.ceil(app.total / 12), //总页数
numberofPages: 4, //显示的页数
bootstrapMajorVersion: 3,
alignment: 'center',
size: 'large',
shouldShowPage: true,
itemTexts: function (type, page, current) { //修改显示文字
switch (type) {
case "first":
return "首页";
case "prev":
return "上一页";
case "next":
return "下一页";
case "last":
return "尾页";
case "page":
return page;
}
},
onPageClicked: function (event, originalEvent, type, page) {
app.offset = (page - 1) * 12;
app.getData();
}
};
$('#page').bootstrapPaginator(options);
},
remove: function (id) {
layer.confirm('确定要删除选中的记录?', {
btn: ['确定', '取消']
}, function () {
$.ajax({
url: "/common/sysFile/remove",
type: "post",
data: {
'id': id
},
success: function (r) {
if (r.code == 0) {
layer.msg(r.msg);
app.getData();
} else {
layer.msg(r.msg);
app.getData();
}
}
});
})
},
changeType: function (i) {
this.type = i;
this.offset = 0;
this.getData();
}
},
created: function () {
this.changeType('')
}
});
</script>
<script type="text/javascript">
var clipboard = new Clipboard('button.copy', {
text: function (trigger) {
layer.msg('文件路径已复制到粘贴板');
return $(trigger).attr('url');
}
});
layui.use('upload', function () {
var upload = layui.upload;
//执行实例
var uploadInst = upload.render({
elem: '#test1', //绑定元素
url: '/common/sysFile/upload', //上传接口
size: 1000,
accept: 'file',
done: function (r) {
layer.msg(r.msg);
app.getData();
},
error: function (r) {
layer.msg(r.msg);
}
});
});
// function changeType(i) {
// app.type = i;
// app.offset = 0;
// app.getData();
// }
</script>
</body>
</html>

View File

@ -0,0 +1,108 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<form class="form-horizontal m-t" id="signupForm">
<div class="form-group">
<label class="col-sm-3 control-label">表名:</label>
<div class="col-sm-8">
<input id="tableName" name="tableName" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">列名:</label>
<div class="col-sm-8">
<input id="columnName" name="columnName" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">列类型:</label>
<div class="col-sm-8">
<input id="columnType" name="columnType" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">映射java类型</label>
<div class="col-sm-8">
<input id="javaType" name="javaType" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">列注释:</label>
<div class="col-sm-8">
<input id="columnComment" name="columnComment" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">列排序(升序):</label>
<div class="col-sm-8">
<input id="columnSort" name="columnSort" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">列标签名:</label>
<div class="col-sm-8">
<input id="columnLabel" name="columnLabel" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">页面显示类型1、文本框 2、下拉框 3、数值4、日期 5、文本域6、富文本 7、上传图片【单文件】
8、上传图片【多文件】9、上传文件【单文件】 10、上传文件【多文件】</label>
<div class="col-sm-8">
<input id="pageType" name="pageType" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否必填:</label>
<div class="col-sm-8">
<input id="isRequired" name="isRequired" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">页面显示为下拉时使用,字典类型从字典表中取出:</label>
<div class="col-sm-8">
<input id="dictType" name="dictType" class="form-control"
type="text">
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-3">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/js/appjs/common/genColumns/add.js">
</script>
</body>
</html>

View File

@ -0,0 +1,132 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<form class="form-horizontal m-t" id="signupForm">
<input id="id" name="id" th:value="${genColumns.id}"
type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">表名:</label>
<div class="col-sm-8">
<input readonly id="tableName" name="tableName" class="form-control"
th:value="${genColumns.tableName}"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">列名:</label>
<div class="col-sm-8">
<input readonly id="columnName" name="columnName" class="form-control"
th:value="${genColumns.columnName}"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">列类型:</label>
<div class="col-sm-8">
<input readonly id="columnType" name="columnType" class="form-control"
th:value="${genColumns.columnType}"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">映射java类型</label>
<div class="col-sm-8">
<input readonly id="javaType" name="javaType" class="form-control"
th:value="${genColumns.javaType}"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">列注释:</label>
<div class="col-sm-8">
<input readonly id="columnComment" name="columnComment" class="form-control"
th:value="${genColumns.columnComment}"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">列排序(升序):</label>
<div class="col-sm-8">
<input readonly id="columnSort" name="columnSort" class="form-control"
th:value="${genColumns.columnSort}"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">列标签名:</label>
<div class="col-sm-8">
<input readonly id="columnLabel" name="columnLabel" class="form-control"
th:value="${genColumns.columnLabel}"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">页面显示类型1、文本框 2、下拉框 3、数值4、日期 5、文本域6、富文本 7、上传图片【单文件】 8、上传图片【多文件】9、上传文件【单文件】 10、上传文件【多文件】</label>
<div class="col-sm-8">
<input readonly id="pageType" name="pageType" class="form-control"
th:value="${genColumns.pageType}"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否必填:</label>
<div class="col-sm-8">
<input readonly id="isRequired" name="isRequired" class="form-control"
th:value="${genColumns.isRequired}"
type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">页面显示为下拉时使用,字典类型从字典表中取出:</label>
<div class="col-sm-8">
<input readonly id="dictType" name="dictType" class="form-control"
th:value="${genColumns.dictType}"
type="text">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div th:include="include::footer"></div>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header">
</head>
<link rel="stylesheet" href="/js/plugins/edittable/jquery.edittable.css">
<link rel="stylesheet" href="/js/plugins/edittable/main.css">
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<input id="genColumns" type="hidden" th:value="${genColumns}"/>
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<form class="form-horizontal m-t" id="signupForm">
<div id="edittable"></div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-3">
<button style="padding: 0px 12px;" type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="/js/plugins/edittable/jquery.edittable.js"></script>
<script type="text/javascript" src="/js/appjs/common/genColumns/edit.js">
</script>
</body>
</html>

View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<input type="hidden" id="tableName" th:value="${tableName}"/>
<!--<div class="fixed-table-toolbar">
<div class="columns pull-left">
<button shiro:hasPermission="common:genColumns:add" type="button"
class="btn btn-primary" onclick="add()">
<i class="fa fa-plus" aria-hidden="true"></i>添加
</button>
<button shiro:hasPermission="common:genColumns:batchRemove" type="button"
class="btn btn-danger"
onclick="batchRemove()">
<i class="fa fa-trash" aria-hidden="true"></i>删除
</button>
</div>
<div class="columns pull-right">
<button class="btn btn-success" onclick="reLoad()">查询</button>
</div>
<form id="searchForm">
<div class="columns pull-right col-md-2">
<input id="id" name="id" type="text" class="form-control"
placeholder="主键">
</div>
</form>
</div>-->
<table id="exampleTable" data-mobile-responsive="true">
</table>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-3">
<button onclick="save()" type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/appjs/common/genColumns/genColumns.js"></script>
</body>
</html>

View File

@ -0,0 +1,135 @@
package ${package}.controller;
import java.util.List;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import io.swagger.annotations.ApiOperation;
import ${package}.domain.${className}DO;
import ${package}.service.${className}Service;
import com.java2nb.common.utils.PageBean;
import com.java2nb.common.utils.Query;
import com.java2nb.common.utils.R;
/**
* ${comments}
*
* @author ${author}
* @email ${email}
* @date ${datetime}
*/
@Controller
@RequestMapping("/${pathName}/${classname}")
public class ${className}Controller {
@Autowired
private ${className}Service ${classname}Service;
@GetMapping()
@RequiresPermissions("${pathName}:${classname}:${classname}")
String ${className}() {
return "${pathName}/${classname}/${classname}";
}
@ApiOperation(value = "获取${comments}列表", notes = "获取${comments}列表")
@ResponseBody
@GetMapping("/list")
@RequiresPermissions("${pathName}:${classname}:${classname}")
public R list(@RequestParam Map<String, Object> params) {
//查询列表数据
Query query = new Query(params);
List<${className}DO> ${classname}List = ${classname}Service.list(query);
int total = ${classname}Service.count(query);
PageBean pageBean = new PageBean(${classname}List, total);
return R.ok().put("data", pageBean);
}
@ApiOperation(value = "新增${comments}页面", notes = "新增${comments}页面")
@GetMapping("/add")
@RequiresPermissions("${pathName}:${classname}:add")
String add() {
return "${pathName}/${classname}/add";
}
@ApiOperation(value = "修改${comments}页面", notes = "修改${comments}页面")
@GetMapping("/edit/{${pk.attrname}}")
@RequiresPermissions("${pathName}:${classname}:edit")
String edit(@PathVariable("${pk.attrname}") ${pk.javaType} ${pk.attrname}, Model model) {
${className}DO ${classname} = ${classname}Service.get(${pk.attrname});
model.addAttribute("${classname}", ${classname});
return "${pathName}/${classname}/edit";
}
@ApiOperation(value = "查看${comments}页面", notes = "查看${comments}页面")
@GetMapping("/detail/{${pk.attrname}}")
@RequiresPermissions("${pathName}:${classname}:detail")
String detail(@PathVariable("${pk.attrname}") ${pk.javaType} ${pk.attrname}, Model model) {
${className}DO ${classname} = ${classname}Service.get(${pk.attrname});
model.addAttribute("${classname}", ${classname});
return "${pathName}/${classname}/detail";
}
/**
* 保存
*/
@ApiOperation(value = "新增${comments}", notes = "新增${comments}")
@ResponseBody
@PostMapping("/save")
@RequiresPermissions("${pathName}:${classname}:add")
public R save( ${className}DO ${classname}) {
if (${classname}Service.save(${classname}) > 0) {
return R.ok();
}
return R.error();
}
/**
* 修改
*/
@ApiOperation(value = "修改${comments}", notes = "修改${comments}")
@ResponseBody
@RequestMapping("/update")
@RequiresPermissions("${pathName}:${classname}:edit")
public R update( ${className}DO ${classname}) {
${classname}Service.update(${classname});
return R.ok();
}
/**
* 删除
*/
@ApiOperation(value = "删除${comments}", notes = "删除${comments}")
@PostMapping("/remove")
@ResponseBody
@RequiresPermissions("${pathName}:${classname}:remove")
public R remove( ${pk.javaType} ${pk.attrname}) {
if (${classname}Service.remove(${pk.attrname}) > 0) {
return R.ok();
}
return R.error();
}
/**
* 删除
*/
@ApiOperation(value = "批量删除${comments}", notes = "批量删除${comments}")
@PostMapping("/batchRemove")
@ResponseBody
@RequiresPermissions("${pathName}:${classname}:batchRemove")
public R remove(@RequestParam("ids[]") ${pk.javaType}[] ${pk.attrname}s) {
${classname}Service.batchRemove(${pk.attrname}s);
return R.ok();
}
}

View File

@ -0,0 +1,32 @@
package ${package}.dao;
import ${package}.domain.${className}DO;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
* @author ${author}
* @email ${email}
* @date ${datetime}
*/
@Mapper
public interface ${className}Dao {
${className}DO get(${pk.javaType} ${pk.attrname});
List<${className}DO> list(Map<String,Object> map);
int count(Map<String,Object> map);
int save(${className}DO ${classname});
int update(${className}DO ${classname});
int remove(${pk.javaType} ${pk.columnName});
int batchRemove(${pk.javaType}[] ${pk.attrname}s);
}

View File

@ -0,0 +1,94 @@
package ${package}.dao;
import ${package}.domain.${className}DO;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
/**
* ${comments}
*
* @author ${author}
* @email ${email}
* @date ${datetime}
*/
@Mapper
public interface ${className}Mapper {
@Select("select #foreach($column in $columns)
`$column.columnName`#if($velocityCount != $columns.size()), #end
#end from ${tableName} where ${pk.columnName} = #{id}")
${className}DO get(${pk.javaType} ${pk.attrname});
@Select("<script>" +
"select * from ${tableName} " +
"<where>" +
#foreach($column in $columns)
"<if test=\"$column.attrname != null and $column.attrname.trim() != ''\">"+ "and $column.columnName = #{$column.attrname} " + "</if>" +
#end
"</where>"+
" <choose>" +
"<when test=\"sort != null and sort.trim() != ''\">" +
"order by ${sort} ${order}" +
"</when>" +
"<otherwise>" +
"order by ${pk.columnName} desc" +
"</otherwise>" +
"</choose>"+
"<if test=\"offset != null and limit != null\">"+
"limit #{offset}, #{limit}" +
"</if>"+
"</script>")
List<${className}DO> list(Map<String,Object> map);
@Select("<script>" +
"select count(*) from ${tableName} " +
"<where>" +
#foreach($column in $columns)
"<if test=\"$column.attrname != null and $column.attrname.trim() != ''\">"+ "and $column.columnName = #{$column.attrname} " + "</if>" +
#end
"</where>"+
"</script>")
int count(Map<String,Object> map);
@Insert("insert into ${tableName} (#foreach($column in $columns)
#if($column.columnName != $pk.columnName || $pk.extra != 'auto_increment')
`$column.columnName`#if($velocityCount != $columns.size()), #end
#end
#end)"
+ "values (#foreach($column in $columns)
#if($column.columnName != $pk.columnName || $pk.extra != 'auto_increment')
#{$column.attrname}#if($velocityCount != $columns.size()), #end
#end
#end)")
int save(${className}DO ${classname});
int saveSelective(${className}DO ${classname});
@Update("<script>"+
"update ${tableName} " +
"<set>" +
#foreach($column in $columns)
"<if test=\"$column.attrname != null\">`$column.columnName` = #{$column.attrname}, </if>" +
#end
"</set>" +
"where ${pk.columnName} = #{${pk.attrname}}"+
"</script>")
int update(${className}DO ${classname});
@Delete("delete from ${tableName} where ${pk.columnName} =#{${pk.attrname}}")
int remove(${pk.javaType} ${pk.columnName});
@Delete("<script>"+
"delete from ${tableName} where ${pk.columnName} in " +
"<foreach item=\"${pk.attrname}\" collection=\"array\" open=\"(\" separator=\",\" close=\")\">" +
"#{${pk.attrname}}" +
"</foreach>"+
"</script>")
int batchRemove(${pk.javaType}[] ${pk.attrname}s);
}

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${package}.dao.${className}Dao">
<select id="get" resultType="${package}.domain.${className}DO">
select #foreach($column in $columns)`$column.columnName`#if($velocityCount != $columns.size()),#end#end from ${tableName} where ${pk.columnName} = #{value}
</select>
<select id="list" resultType="${package}.domain.${className}DO">
select #foreach($column in $columns)`$column.columnName`#if($velocityCount != $columns.size()),#end#end from ${tableName}
<where>
#foreach($column in $columns)
<if test="$column.attrname != null and $column.attrname.trim() != ''"> and $column.columnName = #{$column.attrname} </if>
#end
</where>
<choose>
<when test="sort != null and sort.trim() != ''">
order by ${sort} ${order}
</when>
<otherwise>
order by ${pk.columnName} desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="count" resultType="int">
select count(*) from ${tableName}
<where>
#foreach($column in $columns)
<if test="$column.attrname != null and $column.attrname.trim() != ''"> and $column.columnName = #{$column.attrname} </if>
#end
</where>
</select>
<insert id="save" parameterType="${package}.domain.${className}DO"#if($pk.extra == 'auto_increment') useGeneratedKeys="true" keyProperty="$pk.attrname"#end>
insert into ${tableName}
(
#foreach($column in $columns)
#if($column.columnName != $pk.columnName || $pk.extra != 'auto_increment')
`$column.columnName`#if($velocityCount != $columns.size()), #end
#end
#end
)
values
(
#foreach($column in $columns)
#if($column.columnName != $pk.columnName || $pk.extra != 'auto_increment')
#{$column.attrname}#if($velocityCount != $columns.size()), #end
#end
#end
)
</insert>
<insert id="saveSelective" parameterType="${package}.domain.${className}DO"#if($pk.extra == 'auto_increment') useGeneratedKeys="true" keyProperty="$pk.attrname"#end>
insert into ${tableName}
(
#foreach($column in $columns)
<if test="$column.attrname != null"> `$column.columnName`#if($velocityCount != $columns.size()), #end </if>
#end
)
values
(
#foreach($column in $columns)
<if test="$column.attrname != null"> #{$column.attrname}#if($velocityCount != $columns.size()), #end </if>
#end
)
</insert>
<update id="update" parameterType="${package}.domain.${className}DO">
update ${tableName}
<set>
#foreach($column in $columns)
#if($column.columnName != $pk.columnName)
<if test="$column.attrname != null">`$column.columnName` = #{$column.attrname}#if($velocityCount != $columns.size()), #end</if>
#end
#end
</set>
where ${pk.columnName} = #{${pk.attrname}}
</update>
<delete id="remove">
delete from ${tableName} where ${pk.columnName} = #{value}
</delete>
<delete id="batchRemove">
delete from ${tableName} where ${pk.columnName} in
<foreach item="${pk.attrname}" collection="array" open="(" separator="," close=")">
#{${pk.attrname}}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,30 @@
package ${package}.service;
import ${package}.domain.${className}DO;
import java.util.List;
import java.util.Map;
/**
* ${comments}
*
* @author ${author}
* @email ${email}
* @date ${datetime}
*/
public interface ${className}Service {
${className}DO get(${pk.javaType} ${pk.attrname});
List<${className}DO> list(Map<String, Object> map);
int count(Map<String, Object> map);
int save(${className}DO ${classname});
int update(${className}DO ${classname});
int remove(${pk.javaType} ${pk.attrname});
int batchRemove(${pk.javaType}[] ${pk.attrname}s);
}

View File

@ -0,0 +1,55 @@
package ${package}.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import ${package}.dao.${className}Dao;
import ${package}.domain.${className}DO;
import ${package}.service.${className}Service;
@Service
public class ${className}ServiceImpl implements ${className}Service {
@Autowired
private ${className}Dao ${classname}Dao;
@Override
public ${className}DO get(${pk.javaType} ${pk.attrname}){
return ${classname}Dao.get(${pk.attrname});
}
@Override
public List<${className}DO> list(Map<String, Object> map){
return ${classname}Dao.list(map);
}
@Override
public int count(Map<String, Object> map){
return ${classname}Dao.count(map);
}
@Override
public int save(${className}DO ${classname}){
return ${classname}Dao.save(${classname});
}
@Override
public int update(${className}DO ${classname}){
return ${classname}Dao.update(${classname});
}
@Override
public int remove(${pk.javaType} ${pk.attrname}){
return ${classname}Dao.remove(${pk.attrname});
}
@Override
public int batchRemove(${pk.javaType}[] ${pk.attrname}s){
return ${classname}Dao.batchRemove(${pk.attrname}s);
}
}

View File

@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<form class="form-horizontal m-t" id="signupForm">
#foreach($column in $columns)
#if($column.columnName != $pk.columnName)
<div class="form-group">
#if($column.pageType != 11 && $column.pageType != 12)
<label class="col-sm-3 control-label">${column.columnLabel}</label>
#end
<div class="col-sm-8">
#if($column.pageType == 4)
<input type="text" class="laydate-icon layer-date form-control"
id="${column.attrname}"
name="${column.attrname}"
onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
style="background-color: #fff;" readonly="readonly"/>
#elseif($column.pageType == 1)
<input id="${column.attrname}" name="${column.attrname}"
class="form-control"
type="text">
#elseif($column.pageType == 2)
<select data-placeholder="--选择--" id="${column.attrname}"
name="${column.attrname}"
class="form-control chosen-select" tabindex="2"
dict-type="${column.dictType}">
</select>
#elseif($column.pageType == 3)
<input id="${column.attrname}" name="${column.attrname}"
class="form-control"
type="number">
#elseif($column.pageType == 5)
<textarea id="${column.attrname}" name="${column.attrname}"
class="form-control"></textarea>
#elseif($column.pageType == 6)
<input type="hidden" id="${column.attrname}" name="${column.attrname}"/>
<div id="contentEditor${column.attrname}">
</div>
#elseif($column.pageType == 7)
<img title="点击选择图片" id="picImage${column.attrname}"
style="cursor:pointer;width: 100px;height: 100px"
src="/img/webuploader.png"/>
<input id="${column.attrname}" name="${column.attrname}"
class="form-control"
type="hidden">
#elseif($column.pageType == 11)
<input type="hidden" id="${column.attrname}" name="${column.attrname}"/>
#*#else
<input id="${column.attrname}" name="${column.attrname}"
class="form-control"
type="text">*#
#end
</div>
</div>
#end
#end
<div class="form-group">
<div class="col-sm-8 col-sm-offset-3">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/wangEditor/release/wangEditor.js"></script>
<script type="text/javascript" src="/js/appjs/${pathName}/${classname}/add.js">
</script>
</body>
</html>

View File

@ -0,0 +1,121 @@
var E = window.wangEditor;
$("[id^='contentEditor']").each(function (index, ele) {
var relName = $(ele).attr("id").substring(13);
var editor = new E('#contentEditor' + relName);
// 自定义菜单配置
editor.customConfig.menus = [
'head', // 标题
'bold', // 粗体
'fontSize', // 字号
'fontName', // 字体
'italic', // 斜体
'underline', // 下划线
'strikeThrough', // 删除线
'foreColor', // 文字颜色
//'backColor', // 背景颜色
//'link', // 插入链接
'list', // 列表
'justify', // 对齐方式
'quote', // 引用
'emoticon', // 表情
'image', // 插入图片
//'table', // 表格
//'video', // 插入视频
//'code', // 插入代码
'undo', // 撤销
'redo' // 重复
];
editor.customConfig.onchange = function (html) {
// html 即变化之后的内容
$("#" + relName).val(html);
}
editor.customConfig.uploadImgShowBase64 = true;
editor.create();
})
$("[id^='picImage']").each(function (index, ele) {
var relName = $(ele).attr("id").substring(8);
layui.use('upload', function () {
var upload = layui.upload;
//执行实例
var uploadInst = upload.render({
elem: '#picImage' + relName, //绑定元素
url: '/common/sysFile/upload', //上传接口
size: 1000,
accept: 'file',
done: function (r) {
$("#picImage" + relName).attr("src", r.fileName);
$("#" + relName).val(r.fileName);
},
error: function (r) {
layer.msg(r.msg);
}
});
});
});
$().ready(function () {
validateRule();
});
$.validator.setDefaults({
submitHandler: function () {
save();
}
});
function save() {
$.ajax({
cache: true,
type: "POST",
url: "/${pathName}/${classname}/save",
data: $('#signupForm').serialize(),// 你的formid
async: false,
error: function (request) {
parent.layer.alert("Connection error");
},
success: function (data) {
if (data.code == 0) {
parent.layer.msg("操作成功");
parent.reLoad();
var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
parent.layer.close(index);
} else {
parent.layer.alert(data.msg)
}
}
});
}
function validateRule() {
var icon = "<i class='fa fa-times-circle'></i> ";
$("#signupForm").validate({
ignore: "",
rules: {
#foreach($column in $columns)
#if($column.columnName != $pk.columnName && $column.isRequired == 1)
${column.attrname}: {
required: true
}#if($velocityCount != $columns.size()), #end
#end
#end
},
messages: {
#foreach($column in $columns)
#if($column.columnName != $pk.columnName && $column.isRequired == 1)
${column.attrname}: {
required: icon + "请选择${column.columnLabel}"
}#if($velocityCount != $columns.size()), #end
#end
#end
}
})
}

View File

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<form class="form-horizontal m-t" id="signupForm">
<input id="${pk.columnName}" name="${pk.columnName}" th:value="${${classname}.${pk.columnName}}"
type="hidden">
#foreach($column in $columns)
#if($column.columnName != $pk.columnName)
<div class="form-group">
<label class="col-sm-3 control-label">${column.columnLabel}</label>
#if($column.pageType == 4)
<div style="padding-top:8px" class="col-sm-8"
th:text="${${classname}.${column.attrname}}==null?null:${#dates.format(${classname}.${column.attrname},'yyyy-MM-dd HH:mm:ss')}">
</div>
#elseif($column.pageType == 2)
<div style="padding-top:8px" class="col-sm-8 dict-type" dict-type="${column.dictType}"
th:attr="dict-value=${${classname}.${column.attrname}}">
</div>
#elseif($column.pageType == 6)
<div style="padding-top:8px" class="col-sm-8"
th:utext="${${classname}.${column.attrname}}"></div>
#elseif($column.pageType == 7)
<div style="padding-top:8px" class="col-sm-8">
<img id="picImage${column.attrname}"
style="cursor:pointer;width: 100px;height: 100px"
th:src="${${classname}.${column.attrname}}==null?'/img/webuploader.png':${${classname}.${column.attrname}}"/>
</div>
#else
<div style="padding-top:8px" class="col-sm-8"
th:text="${${classname}.${column.attrname}}">
</div>
#*#else
<input id="${column.attrname}" name="${column.attrname}"
class="form-control"
type="text">*#
#end
</div>
#end
#end
</form>
</div>
</div>
</div>
</div>
</div>
<div th:include="include::footer"></div>
</body>
</html>

View File

@ -0,0 +1,55 @@
package ${package}.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.java2nb.common.jsonserializer.LongToStringSerializer;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* ${comments}
*
* @author ${author}
* @email ${email}
* @date ${datetime}
*/
public class ${className}DO implements Serializable {
private static final long serialVersionUID = 1L;
#foreach ($column in $columns)
//$column.columnComment
#if($column.javaType == "Long")
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
//所以通过序列化成字符串来解决
@JsonSerialize(using = LongToStringSerializer.class)
#end
#if($column.javaType == "Date")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
#end
private $column.javaType $column.attrname;
#end
#foreach ($column in $columns)
/**
* 设置:${column.columnComment}
*/
public void set${column.attrName}($column.javaType $column.attrname) {
this.$column.attrname = $column.attrname;
}
/**
* 获取:${column.columnComment}
*/
public $column.javaType get${column.attrName}() {
return $column.attrname;
}
#end
}

View File

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-sm-12">
<div class="ibox-content">
<form class="form-horizontal m-t" id="signupForm">
<div class="form-group">
<label class="col-sm-3 control-label">作者:</label>
<div class="col-sm-8">
<input id="author" name="author" class="form-control"
type="text" th:value="${property.author}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">邮箱:</label>
<div class="col-sm-8">
<input id="email" name="email" class="form-control" type="text"
th:value="${property.email}" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">本地项目Src路径</label>
<div class="col-sm-8">
<input id="srcPath" name="srcPath" class="form-control"
type="text" th:value="${property.srcPath}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">包名:</label>
<div class="col-sm-8">
<input id="package" name="package" class="form-control"
type="text" th:value="${property.package}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">自动去掉表前缀:</label>
<div class="col-sm-2 i-checks icheckbox_square-green checked">
<input id="autoRemovePre" name="autoRemovePre"
class="form-control" type="checkbox"
value="true"
th:checked="${property.autoRemovePre}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">去掉指定表前缀:</label>
<div class="col-sm-8">
<input id="tablePrefix" name="tablePrefix" class="form-control"
type="text" th:value="${property.tablePrefix}">
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-3">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/js/appjs/common/generator/edit.js">
</script>
</body>
</html>

View File

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<form class="form-horizontal m-t" id="signupForm">
<input id="${pk.columnName}" name="${pk.columnName}" th:value="${${classname}.${pk.columnName}}"
type="hidden">
#foreach($column in $columns)
#if($column.columnName != $pk.columnName)
<div class="form-group">
#if($column.pageType != 11 && $column.pageType != 12)
<label class="col-sm-3 control-label">${column.columnLabel}</label>
#end
<div class="col-sm-8">
#if($column.pageType == 4)
<input type="text" class="laydate-icon layer-date form-control"
id="${column.attrname}"
name="${column.attrname}"
th:value="${${classname}.${column.attrname}}==null?null:${#dates.format(${classname}.${column.attrname},'yyyy-MM-dd HH:mm:ss')}"
onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
style="background-color: #fff;" readonly="readonly"/>
#elseif($column.pageType == 1)
<input id="${column.attrname}" name="${column.attrname}"
th:value="${${classname}.${column.attrname}}"
class="form-control"
type="text">
#elseif($column.pageType == 2)
<select data-placeholder="--选择--" id="${column.attrname}"
name="${column.attrname}"
class="form-control chosen-select" tabindex="2"
dict-type="${column.dictType}"
th:attr="dict-value=${${classname}.${column.attrname}}" >
</select>
#elseif($column.pageType == 3)
<input id="${column.attrname}" name="${column.attrname}"
th:value="${${classname}.${column.attrname}}"
class="form-control"
type="number">
#elseif($column.pageType == 5)
<textarea id="${column.attrname}" name="${column.attrname}"
class="form-control" th:text="${${classname}.${column.attrname}}"></textarea>
#elseif($column.pageType == 6)
<input type="hidden" id="${column.attrname}" name="${column.attrname}" th:value="${${classname}.${column.attrname}}"/>
<div id="contentEditor${column.attrname}">
</div>
#elseif($column.pageType == 7)
<img title="点击选择图片" id="picImage${column.attrname}"
style="cursor:pointer;width: 100px;height: 100px"
th:src="${${classname}.${column.attrname}}==null?'/img/webuploader.png':${${classname}.${column.attrname}}"/>
<input id="${column.attrname}" name="${column.attrname}" th:value="${${classname}.${column.attrname}}"
class="form-control"
type="hidden">
#elseif($column.pageType == 11)
<input type="hidden" id="${column.attrname}" name="${column.attrname}" th:value="${${classname}.${column.attrname}}"/>
#*#else
<input id="${column.attrname}" name="${column.attrname}"
class="form-control"
type="text">*#
#end
</div>
</div>
#end
#end
<div class="form-group">
<div class="col-sm-8 col-sm-offset-3">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/wangEditor/release/wangEditor.js"></script>
<script type="text/javascript" src="/js/appjs/${pathName}/${classname}/edit.js">
</script>
</body>
</html>

View File

@ -0,0 +1,119 @@
var E = window.wangEditor;
$("[id^='contentEditor']").each(function (index, ele) {
var relName = $(ele).attr("id").substring(13);
var editor = new E('#contentEditor' + relName);
// 自定义菜单配置
editor.customConfig.menus = [
'head', // 标题
'bold', // 粗体
'fontSize', // 字号
'fontName', // 字体
'italic', // 斜体
'underline', // 下划线
'strikeThrough', // 删除线
'foreColor', // 文字颜色
//'backColor', // 背景颜色
//'link', // 插入链接
'list', // 列表
'justify', // 对齐方式
'quote', // 引用
'emoticon', // 表情
'image', // 插入图片
//'table', // 表格
//'video', // 插入视频
//'code', // 插入代码
'undo', // 撤销
'redo' // 重复
];
editor.customConfig.onchange = function (html) {
// html 即变化之后的内容
$("#" + relName).val(html);
}
editor.customConfig.uploadImgShowBase64 = true;
editor.create();
editor.txt.html($("#" + relName).val());
})
$("[id^='picImage']").each(function (index, ele) {
var relName = $(ele).attr("id").substring(8);
layui.use('upload', function () {
var upload = layui.upload;
//执行实例
var uploadInst = upload.render({
elem: '#picImage' + relName, //绑定元素
url: '/common/sysFile/upload', //上传接口
size: 1000,
accept: 'file',
done: function (r) {
$("#picImage" + relName).attr("src", r.fileName);
$("#" + relName).val(r.fileName);
},
error: function (r) {
layer.msg(r.msg);
}
});
});
});
$().ready(function () {
validateRule();
});
$.validator.setDefaults({
submitHandler: function () {
update();
}
});
function update() {
$.ajax({
cache: true,
type: "POST",
url: "/${pathName}/${classname}/update",
data: $('#signupForm').serialize(),// 你的formid
async: false,
error: function (request) {
parent.layer.alert("Connection error");
},
success: function (data) {
if (data.code == 0) {
parent.layer.msg("操作成功");
parent.reLoad();
var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
parent.layer.close(index);
} else {
parent.layer.alert(data.msg)
}
}
});
}
function validateRule() {
var icon = "<i class='fa fa-times-circle'></i> ";
$("#signupForm").validate({
ignore: "",
rules: {
#foreach($column in $columns)
#if($column.columnName != $pk.columnName && $column.isRequired == 1)
${column.attrname}:
{
required: true
}#if($velocityCount != $columns.size()), #end
#end
#end
},
messages: {
#foreach($column in $columns)
#if($column.columnName != $pk.columnName && $column.isRequired == 1)
${column.attrname}:
{
required: icon + "请选择${column.columnLabel}"
}#if($velocityCount != $columns.size()), #end
#end
#end
}
})
}

View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<div class="fixed-table-toolbar">
<div class="columns pull-left">
<!--<button type="button" class="btn btn-primary"
onclick="batchDownload()">
<i class="" aria-hidden="true"></i>批量下载
</button>
<button type="button" class="btn btn-success"
onclick="batchCode()">
<i class="" aria-hidden="true"></i>批量生成
</button>-->
<button type="button" class="btn btn-info"
onclick="edit()">
<i class="" aria-hidden="true"></i>生成配置
</button>
</div>
<div class="columns pull-right">
<button class="btn btn-success" onclick="reLoad()">查询</button>
</div>
<div class="columns pull-right col-md-2">
<input id="tableName" type="text" class="form-control"
placeholder="表名">
</div>
</div>
<table id="exampleTable" data-mobile-responsive="true">
</table>
</div>
</div>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/appjs/common/generator/list.js"></script>
</body>
</html>

View File

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<div class="fixed-table-toolbar">
<div class="columns pull-left">
<button shiro:hasPermission="${pathName}:${classname}:add" type="button"
class="btn btn-primary" onclick="add()">
<i class="fa fa-plus" aria-hidden="true"></i>添加
</button>
<button shiro:hasPermission="${pathName}:${classname}:batchRemove" type="button"
class="btn btn-danger"
onclick="batchRemove()">
<i class="fa fa-trash" aria-hidden="true"></i>删除
</button>
</div>
<div class="columns pull-right">
<button class="btn btn-success" onclick="reLoad()">查询</button>
</div>
<form id="searchForm">
<div class="columns pull-right col-md-2">
<input id="id" name="id" type="text" class="form-control"
placeholder="主键">
</div>
</form>
</div>
<table id="exampleTable" data-mobile-responsive="true">
</table>
</div>
</div>
</div>
</div>
<!--shiro控制bootstraptable行内按钮看见性 -->
<div>
<script type="text/javascript">
var s_detail_h = 'hidden';
var s_edit_h = 'hidden';
var s_remove_h = 'hidden';
</script>
</div>
<div shiro:hasPermission="test:order:detail">
<script type="text/javascript">
s_detail_h = '';
</script>
</div>
<div shiro:hasPermission="${pathName}:${classname}:edit">
<script type="text/javascript">
s_edit_h = '';
</script>
</div>
<div shiro:hasPermission="${pathName}:${classname}:remove">
<script type="text/javascript">
var s_remove_h = '';
</script>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/appjs/${pathName}/${classname}/${classname}.js"></script>
</body>
</html>

View File

@ -0,0 +1,197 @@
var prefix = "/${pathName}/${classname}"
$(function () {
load();
});
function load() {
$('#exampleTable')
.bootstrapTable(
{
method: 'get', // 服务器数据的请求方式 get or post
url: prefix + "/list", // 服务器数据的加载地址
// showRefresh : true,
// showToggle : true,
// showColumns : true,
iconSize: 'outline',
toolbar: '#exampleToolbar',
striped: true, // 设置为true会有隔行变色效果
dataType: "json", // 服务器返回的数据类型
pagination: true, // 设置为true会在底部显示分页条
// queryParamsType : "limit",
// //设置为limit则会发送符合RESTFull格式的参数
singleSelect: false, // 设置为true将禁止多选
// contentType : "application/x-www-form-urlencoded",
// //发送到服务器的数据编码类型
pageSize: 10, // 如果设置了分页,每页数据条数
pageNumber: 1, // 如果设置了分布,首页页码
//search : true, // 是否显示搜索框
showColumns: false, // 是否显示内容下拉框(选择显示的列)
sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
queryParams: function (params) {
//说明传入后台的参数包括offset开始索引limit步长sort排序列orderdesc或者,以及所有列的键值对
var queryParams = getFormJson("searchForm");
queryParams.limit = params.limit;
queryParams.offset = params.offset;
return queryParams;
},
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
// queryParamsType = 'limit' ,返回参数必须包含
// limit, offset, search, sort, order 否则, 需要包含:
// pageSize, pageNumber, searchText, sortName,
// sortOrder.
// 返回false将会终止请求
responseHandler: function (rs) {
if (rs.code == 0) {
return rs.data;
} else {
parent.layer.alert(rs.msg)
return {total: 0, rows: []};
}
},
columns: [
{
checkbox: true
},
{
title: '序号',
formatter: function () {
return arguments[2] + 1;
}
},
#foreach($column in $columns)
#if($column.pageType == 2)
{
field: '${column.attrname}',
title: '${column.columnLabel}',
formatter: function (value, row, index) {
return formatDict("${column.dictType}", value);
}
},
#elseif($column.pageType == 7)
{
field: '${column.attrname}',
title: '${column.columnLabel}',
formatter: function (value, row, index) {
return "<img width='100' height='100' src='" + value + "'>";
}
},
#else
{
field: '${column.attrname}',
title: '${column.columnLabel}'
},
#end
#end
{
title: '操作',
field: 'id',
align: 'center',
formatter: function (value, row, index) {
var d = '<a class="btn btn-primary btn-sm ' + s_detail_h + '" href="#" mce_href="#" title="详情" onclick="detail(\''
+ row.${pk.attrname}
+ '\')"><i class="fa fa-file"></i></a> ';
var e = '<a class="btn btn-primary btn-sm ' + s_edit_h + '" href="#" mce_href="#" title="编辑" onclick="edit(\''
+ row.${pk.attrname}
+ '\')"><i class="fa fa-edit"></i></a> ';
var r = '<a class="btn btn-warning btn-sm ' + s_remove_h + '" href="#" title="删除" mce_href="#" onclick="remove(\''
+ row.${pk.attrname}
+ '\')"><i class="fa fa-remove"></i></a> ';
return d + e + r;
}
}]
});
}
function reLoad() {
$('#exampleTable').bootstrapTable('refresh');
}
function add() {
layer.open({
type: 2,
title: '增加',
maxmin: true,
shadeClose: false, // 点击遮罩关闭层
area: ['800px', '520px'],
content: prefix + '/add' // iframe的url
});
}
function detail(id) {
layer.open({
type: 2,
title: '详情',
maxmin: true,
shadeClose: false, // 点击遮罩关闭层
area: ['800px', '520px'],
content: prefix + '/detail/' + id // iframe的url
});
}
function edit(id) {
layer.open({
type: 2,
title: '编辑',
maxmin: true,
shadeClose: false, // 点击遮罩关闭层
area: ['800px', '520px'],
content: prefix + '/edit/' + id // iframe的url
});
}
function remove(id) {
layer.confirm('确定要删除选中的记录?', {
btn: ['确定', '取消']
}, function () {
$.ajax({
url: prefix + "/remove",
type: "post",
data: {
'${pk.attrname}': id
},
success: function (r) {
if (r.code == 0) {
layer.msg(r.msg);
reLoad();
} else {
layer.msg(r.msg);
}
}
});
})
}
function resetPwd(id) {
}
function batchRemove() {
var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组
if (rows.length == 0) {
layer.msg("请选择要删除的数据");
return;
}
layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", {
btn: ['确定', '取消']
// 按钮
}, function () {
var ids = new Array();
// 遍历所有选择的行数据取每条数据对应的ID
$.each(rows, function (i, row) {
ids[i] = row['${pk.attrname}'];
});
$.ajax({
type: 'POST',
data: {
"ids": ids
},
url: prefix + '/batchRemove',
success: function (r) {
if (r.code == 0) {
layer.msg(r.msg);
reLoad();
} else {
layer.msg(r.msg);
}
}
});
}, function () {
});
}

View File

@ -0,0 +1,18 @@
-- 菜单SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
VALUES ('1', '${comments}', '${pathName}/${classname}', '${pathName}:${classname}:${classname}', '1', 'fa', '6');
-- 按钮父菜单ID
set @parentId = @@identity;
-- 菜单对应按钮SQL
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '查看', null, '${pathName}:${classname}:detail', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '新增', null, '${pathName}:${classname}:add', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '修改', null, '${pathName}:${classname}:edit', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '删除', null, '${pathName}:${classname}:remove', '2', null, '6';
INSERT INTO `sys_menu` (`parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`)
SELECT @parentId, '批量删除', null, '${pathName}:${classname}:batchRemove', '2', null, '6';

View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<div class="fixed-table-toolbar">
<div class="columns pull-left">
<button type="button" class="btn btn-danger"
onclick="batchRemove()">
<i class="fa fa-trash" aria-hidden="true"></i>删除
</button>
</div>
<div class="columns pull-right" role="group">
<button class="btn btn-success" onclick="reLoad()">
<i class="fa fa-search" aria-hidden="true"></i>查询
</button>
</div>
<div class="pull-right search col-md-2">
<input id="searchOperation" type="text" class="form-control"
placeholder="操作">
</div>
<div class="pull-right search col-md-2">
<input id="searchUsername" type="text" class="form-control"
placeholder="用户">
</div>
</div>
<table id="exampleTable" data-mobile-responsive="true">
</table>
</div>
</div>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/appjs/common/log/log.js"></script>
</body>
</html>