提交 d007429d 编写于 作者: shuzheng5201314's avatar shuzheng5201314

标签接入zheng-admin

上级 598ac38b
......@@ -21,35 +21,6 @@
<a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-close"></i> 删除用户</a>
</div>
<table id="table"></table>
<!--
<table data-toggle="table"
data-url="data/data1.json"
data-classes="table table-hover table-condensed"
data-striped="true"
data-search="true"
data-show-refresh="true"
data-show-toggle="true"
data-show-columns="true"
data-click-to-select="true"
data-toolbar="#toolbar">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="id" data-sortable="true">编号</th>
<th data-field="username" data-sortable="true">账号</th>
<th data-field="password" data-sortable="true">密码</th>
<th data-field="name" data-sortable="true">姓名</th>
<th data-field="sex" data-sortable="true">性别</th>
<th data-field="age" data-sortable="true">年龄</th>
<th data-field="phone" data-sortable="true">电话</th>
<th data-field="email" data-sortable="true">邮箱</th>
<th data-field="address" data-sortable="true">地址</th>
<th data-field="remark" data-sortable="true">备注</th>
<th data-field="action" data-formatter="actionFormatter" data-events="actionEvents">操作</th>
</tr>
</thead>
</table>
-->
</div>
<script src="plugins/jquery.1.12.4.min.js"></script>
<script src="plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>
......@@ -62,7 +33,6 @@
$(function() {
// bootstrap table初始化
$('#table').bootstrapTable({
idField: 'id',
url: 'data/data1.json',
height: getHeight(),
striped: true,
......
......@@ -18,7 +18,7 @@ public class ManageInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
_log.info("ManageInterceptor==>preHandle");
return true;
}
......
......@@ -10,10 +10,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
......@@ -31,36 +28,37 @@ public class CmsTagController extends BaseController {
@Autowired
private CmsTagService cmsTagService;
@RequestMapping("/index")
public String index() {
return "/manage/tag/index";
}
/**
* 列表
* @param page 当前页码
* @param rows 每页条数
* @param desc 降序排序
* @param request
* @param modelMap
* @param offset
* @param limit
* @param sort
* @param order
* @return
*/
@RequestMapping("/list")
public String list(
@RequestParam(required = false, defaultValue = "1", value = "page") int page,
@RequestParam(required = false, defaultValue = "20", value = "rows") int rows,
@RequestParam(required = false, defaultValue = "false", value = "desc") boolean desc,
HttpServletRequest request, ModelMap modelMap) {
@ResponseBody
public Object list(
@RequestParam(required = false, defaultValue = "0", value = "offset") int offset,
@RequestParam(required = false, defaultValue = "10", value = "limit") int limit,
@RequestParam(required = false, value = "sort") String sort,
@RequestParam(required = false, value = "order") String order) {
// 数据列表
CmsTagExample cmsTagExample = new CmsTagExample();
cmsTagExample.setOffset((page - 1) * rows);
cmsTagExample.setLimit(rows);
cmsTagExample.setOrderByClause(desc ? "orders desc" : "orders asc");
cmsTagExample.setOffset(offset);
cmsTagExample.setLimit(limit);
cmsTagExample.setOrderByClause(sort + " " + order);
List<CmsTag> tags = cmsTagService.selectByExample(cmsTagExample);
// 分页对象
long total = cmsTagService.countByExample(cmsTagExample);
Paginator paginator = new Paginator(total, page, rows, request);
// long total = cmsTagService.countByExample(cmsTagExample);
modelMap.put("tags", tags);
modelMap.put("paginator", paginator);
return "/manage/tag/list";
return tags;
}
/**
......
......@@ -11,7 +11,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>通用增删改查</title>
<title>标签列表</title>
<link href="${basePath}/resources/zheng-admin/plugins/bootstrap-3.3.0/css/bootstrap.min.css" rel="stylesheet"/>
<link href="${basePath}/resources/zheng-admin/plugins/material-design-iconic-font-2.2.0/css/material-design-iconic-font.min.css" rel="stylesheet"/>
......@@ -23,9 +23,9 @@
<body>
<div id="main">
<div id="toolbar">
<a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-plus"></i> 新增用户</a>
<a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-edit"></i> 编辑用户</a>
<a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-close"></i> 删除用户</a>
<a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-plus"></i> 新增标签</a>
<a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-edit"></i> 编辑标签</a>
<a class="waves-effect waves-button" href="javascript:;"><i class="zmdi zmdi-close"></i> 删除标签</a>
</div>
<table id="table"></table>
</div>
......@@ -40,8 +40,7 @@
$(function() {
// bootstrap table初始化
$('#table').bootstrapTable({
idField: 'id',
url: '${basePath}/resources/zheng-admin/data/data1.json',
url: '${basePath}/manage/tag/list',
height: getHeight(),
striped: true,
search: true,
......@@ -57,23 +56,20 @@
pagination: true,
paginationLoop: false,
classes: 'table table-hover table-no-bordered',
//sidePagination: 'server',
idField: 'id',
sortName: 'id',
sidePagination: 'server',
idField: 'tag_id',
sortName: 'tag_id',
sortOrder: 'desc',
toolbar: '#toolbar',
columns: [
{field: 'state', checkbox: true},
{field: 'id', title: '编号', sortable: true, halign: 'center'},
{field: 'username', title: '账号', sortable: true, halign: 'center'},
{field: 'password', title: '密码', sortable: true, halign: 'center'},
{field: 'name', title: '姓名', sortable: true, halign: 'center'},
{field: 'sex', title: '性别', sortable: true, halign: 'center'},
{field: 'age', title: '年龄', sortable: true, halign: 'center'},
{field: 'phone', title: '年龄', sortable: true, halign: 'center'},
{field: 'email', title: '邮箱', sortable: true, halign: 'center'},
{field: 'address', title: '地址', sortable: true, halign: 'center'},
{field: 'remark', title: '备注', sortable: true, halign: 'center'},
{field: 'tagId', title: '编号', sortable: true, halign: 'center'},
{field: 'name', title: '标签名称', sortable: true, halign: 'center'},
{field: 'description', title: '标签描述', sortable: true, halign: 'center'},
{field: 'icon', title: '图标', sortable: true, halign: 'center'},
{field: 'type', title: '类型', sortable: true, halign: 'center'},
{field: 'alias', title: '别名', sortable: true, halign: 'center'},
{field: 'ctime', title: '创建时间', sortable: true, halign: 'center'},
{field: 'action', title: '操作', halign: 'center', align: 'center', formatter: 'actionFormatter', events: 'actionEvents'}
]
}).on('all.bs.table', function (e, name, args) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册