基于maven搭建的SSM项目文件配置
一. CMS
内容管理系统(Content Management System:内容管理系统,简称CMS)是一种位于WEB 前端(Web 服务器)和后端办公系统或流程(内容创作、编辑)之间的软件系统。内容的创作人员、编辑人员、发布人员使用内容管理系统来提交、修改、审批、发布内容。这里指的“内容”可能包括文件、表格、图片、数据库中的数据甚至视频等一切你想要发布到Internet、Intranet以及Extranet网站的信息。
二. CRM
客户关系管理系统(Customer Relationship Management),是指利用软件、硬件和[网络技术,为企业建立一个客户信息收集、管理、分析和利用的信息系统。以客户数据的管理为核心,记录企业在市场营销和销售过程中和客户发生的各种交互行为,以及各类有关活动的状态,提供各类数据模型,为后期的分析和决策提供支持。
三. GridManager—————快速、灵活的对Table标签进行实例化,让Table标签充满活力。
使用步骤:
引入css和js
1
2
3
4<!-- 引入girdmanager的css -->
<link rel="stylesheet" href="/static/system/gridmanager/css/gm.css">
<!-- 引入gridmanager的js -->
<script type="text/javascript" src="/static/system/gridmanager/js/gm.js"></script>html页面加上相应的table
1
<table id="table-demo-baseCode"></table>
js中配置查询
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137$(function () {
document.querySelector('#table-demo-ajaxPageCode').GM({
//唯一组件标示
gridManagerName: 'demo-ajaxPageCode',
//ajax请求
ajaxData: '/system/article/list', ajaxType: 'POST',
//开启分页
supportAjaxPage: true, supportAdjust: false, supportDrag: false,
//表格数据
height: '100%',
currentPageKey: 'currentPage',
pageSizeKey: 'pageSize',
sizeData: [5, 10, 20, 50, 100, 150], //配置每页显示条数的下拉项,数组元素仅允许为正整数。
pageSize: 10, //初次进行页面的每页条数(不写默认20)
columnData: [{
key: 'title', text: '文章标题', align: 'center', remind: 'the title'
}, {
key: 'url', text: '文章链接', align: 'center', remind: 'the link'
}, {
key: 'clickCount', text: '点击量', align: 'center', remind: 'the click'
}, {
key: 'articleType', text: '文章类型', align: 'center', remind: 'the type',
template: function (cell, row, index, key) {
return cell.name
}
}, {
key: 'enable', text: '状态', align: 'center', remind: 'the status',
//模板方法 自定义返回内容
//cell:查询到的值,row:整行内容,index:索引,key:当前的key=enable
template: function (cell, row, index, key) {
return cell === true ? "<span style='color: green'>启用</span>" : "<span style='color: red'>禁用</span>"
}
}, {
key: 'createDate', text: '发布时间', align: 'center', remind: 'the date'
}, {
key: 'id', text: '操作', align: 'center', remind: 'the action',
template: function (cell, row, index, key) {
return "<button type='button' class='btn btn-warning btn-sm edit' data-article='" + JSON.stringify(row) + "'><span class='glyphicon glyphicon-pencil'></span>修改</button> " +
"<button type='button' class='btn btn-danger btn-sm del' data-id='" + row.id + "'><span class='glyphicon glyphicon-trash'></span>删除</button>";
}
},
]
});
// 查询条件事件
$('#queryButton').click(function () {
//返回表单的json对象
var query = $('#queryForm').serializeObject();
//表格插件复用
/*
* 更改在生成组件时所配置的参数query,执行后将会自动刷新表格数据。
注意事项:
1. 当query的key与分页及排序等字段冲突时将会被忽略
2. query中的key与columnData.key相同时,该值将会替换columnData.filter.selected的值
3. setQuery() 执行后会立即触发刷新操作
4. 在此配置的query在分页事件触发时, 会以参数形式传递至pagingAfter(query)事件内
5. setQuery方法中对query字段执行的操作是覆盖而不是合并, query参数位传递的任意值都会将原来的值覆盖.
6. setQuery() 执行后不会清除已选中的数据,如需清除可以在callback中执行setCheckedData(table, [])
GridManager.setQuery(table,{'userName':'baukh','sex':'男'}, gotoPage, callback);
*/
GridManager.setQuery('demo-ajaxPageCode', query)
});
//删除事件
$('#table-demo-ajaxPageCode').on('click', '.del', function () {
//获取需要删除的id值
var id = $(this).data('id');
console.log(id)
//打开删除模态框
$('#del-dialog').modal('show');
//取消绑定事件
$('#confirm-del-btn').off('click');
//确认删除请求
$('#confirm-del-btn').click(function () {
//隐藏模态框
$('#del-dialog').modal('hide');
$.get('/system/article/delete', {'id': id}, function (res) {
if (res.success) {
//刷新数据
GridManager.refreshGrid('demo-ajaxPageCode', true);
} else {
alert('删除失败' + res.msg);
}
}, 'json');
})
});
// 添加按钮事件
$('#addButton').click(function () {
//开启新增模态框
$('#save-dialog').modal('show');
//清除隐藏的id值
$('#id').val('');
//清空表单内容
$('#save-form').resetForm();
//给单选框设置默认选中 禁用
$('#disable').prop('checked', true)
});
//确认添加
$('#confirm-save-btn').click(function () {
// 获取form表单的值 自动转换为json对象
var saveData = $('#save-form').serializeObject();
console.log(saveData);
//发送Ajax请求
$.ajax({
url: '/system/article/save',
data: saveData,
type: 'POST',
success: function (res) {
if (res.success) {
//隐藏模态框
$('#save-dialog').modal('hide');
//刷新数据
GridManager.refreshGrid('demo-ajaxPageCode', true);
// alert('添加数据成功哦······');
} else {
alert('添加数据失败······' + res.msg);
}
},
dataType: 'json',
async: true
})
});
// 修改文章按钮 事件委托
$('#table-demo-ajaxPageCode').on('click', '.edit', function () {
//获取当前行数据
var article = $(this).data('article');
console.log(article);
//为表单赋值
$('#save-form').setForm(article);
//开启模态框
$('#save-dialog').modal('show')
});
});
四.代码
1. 分页参数
1 | package com.lqs.vo; |
2. 统一Ajax返回结果
1 | package com.lqs.vo; |
3. 封装查询结果
1 | package com.lqs.vo; |
4. 查询文章参数
1 | package com.lqs.vo; |
5. SQL
1 | <sql id="articleQuery"> |
6. pom
1 |
|
评论