This commit is contained in:
parent
8bdf414948
commit
3b4192b848
|
|
@ -55,7 +55,8 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['test:stu:add']"
|
v-hasPermi="['test:stu:add']"
|
||||||
>新增</el-button>
|
>新增
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -66,7 +67,8 @@
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['test:stu:edit']"
|
v-hasPermi="['test:stu:edit']"
|
||||||
>修改</el-button>
|
>修改
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -77,7 +79,8 @@
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['test:stu:remove']"
|
v-hasPermi="['test:stu:remove']"
|
||||||
>删除</el-button>
|
>删除
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -87,17 +90,18 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['test:stu:export']"
|
v-hasPermi="['test:stu:export']"
|
||||||
>导出</el-button>
|
>导出
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="stuList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="stuList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center"/>
|
||||||
<el-table-column label="id" align="center" prop="id" />
|
<el-table-column label="id" align="center" prop="id"/>
|
||||||
<el-table-column label="学生姓名" align="center" prop="name" />
|
<el-table-column label="学生姓名" align="center" prop="name"/>
|
||||||
<el-table-column label="电话" align="center" prop="tel" />
|
<el-table-column label="电话" align="center" prop="tel"/>
|
||||||
<el-table-column label="电子邮件" align="center" prop="email" />
|
<el-table-column label="电子邮件" align="center" prop="email"/>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -106,14 +110,16 @@
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['test:stu:edit']"
|
v-hasPermi="['test:stu:edit']"
|
||||||
>修改</el-button>
|
>修改
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['test:stu:remove']"
|
v-hasPermi="['test:stu:remove']"
|
||||||
>删除</el-button>
|
>删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -130,13 +136,13 @@
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="学生姓名" prop="name">
|
<el-form-item label="学生姓名" prop="name">
|
||||||
<el-input v-model="form.name" placeholder="请输入学生姓名" />
|
<el-input v-model="form.name" placeholder="请输入学生姓名"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="电话" prop="tel">
|
<el-form-item label="电话" prop="tel">
|
||||||
<el-input v-model="form.tel" placeholder="请输入电话" />
|
<el-input v-model="form.tel" placeholder="请输入电话"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="电子邮件" prop="email">
|
<el-form-item label="电子邮件" prop="email">
|
||||||
<el-input v-model="form.email" placeholder="请输入电子邮件" />
|
<el-input v-model="form.email" placeholder="请输入电子邮件"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
|
|
@ -148,12 +154,11 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listStu, getStu, delStu, addStu, updateStu, exportStu } from "@/api/test/stu";
|
import {listStu, getStu, delStu, addStu, updateStu, exportStu} from "@/api/test/stu";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Stu",
|
name: "Stu",
|
||||||
components: {
|
components: {},
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -189,6 +194,21 @@ export default {
|
||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
|
name: [
|
||||||
|
{required: true, message: "学生姓名不能为空}", trigger: "blur"},
|
||||||
|
],
|
||||||
|
tel: [
|
||||||
|
{required: true, message: "电话不能为空}", trigger: "blur"},
|
||||||
|
{pattern: /^1[0-9]{10}$/, message: '电话格式有误', trigger: "blur"},
|
||||||
|
],
|
||||||
|
email: [
|
||||||
|
{required: true, message: "电子邮件不能为空}", trigger: "blur"},
|
||||||
|
{
|
||||||
|
pattern: /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
|
||||||
|
message: '电子邮件格式有误',
|
||||||
|
trigger: "blur"
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
@ -199,12 +219,7 @@ export default {
|
||||||
/** 查询学生列表 */
|
/** 查询学生列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
// this.queryParams.params = {};
|
listStu(this.addCreateDateRange(this.queryParams, this.daterangeCreateTime)).then(response => {
|
||||||
// if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
|
|
||||||
// this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
|
|
||||||
// this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
|
|
||||||
// }
|
|
||||||
listStu(this.addCreateDateRange(this.queryParams,this.daterangeCreateTime)).then(response => {
|
|
||||||
this.stuList = response.rows;
|
this.stuList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
|
@ -240,7 +255,7 @@ export default {
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.id)
|
this.ids = selection.map(item => item.id)
|
||||||
this.single = selection.length!==1
|
this.single = selection.length !== 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
|
|
@ -286,7 +301,7 @@ export default {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning"
|
||||||
}).then(function() {
|
}).then(function () {
|
||||||
return delStu(ids);
|
return delStu(ids);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
|
|
@ -300,12 +315,12 @@ export default {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning"
|
||||||
}).then(function() {
|
}).then(function () {
|
||||||
return exportStu(queryParams);
|
return exportStu(queryParams);
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -192,9 +192,6 @@ public class GenTableServiceImpl implements IGenTableService {
|
||||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||||
for (String template : templates) {
|
for (String template : templates) {
|
||||||
// 渲染模板
|
// 渲染模板
|
||||||
if (template.equals("")){
|
|
||||||
|
|
||||||
}
|
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
||||||
tpl.merge(context, sw);
|
tpl.merge(context, sw);
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,11 @@ public class ${ClassName}Controller extends HcyBaseController {
|
||||||
return AjaxResult.error("${column.columnComment}不能为空!");
|
return AjaxResult.error("${column.columnComment}不能为空!");
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
#if($column.isRegular != 1)
|
||||||
|
if (!Pattern.matches("${column.regular}",${className}.get${AttrName}())){
|
||||||
|
return AjaxResult.error("${column.columnComment}格式错误!");
|
||||||
|
}
|
||||||
|
#end
|
||||||
#end
|
#end
|
||||||
try {
|
try {
|
||||||
ServerResult<Integer> serverResult = ${className}Service.insert${ClassName}(${className});
|
ServerResult<Integer> serverResult = ${className}Service.insert${ClassName}(${className});
|
||||||
|
|
@ -173,6 +178,11 @@ public class ${ClassName}Controller extends HcyBaseController {
|
||||||
return AjaxResult.error("${column.columnComment}不能为空!");
|
return AjaxResult.error("${column.columnComment}不能为空!");
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
#if($column.isRegular != 1)
|
||||||
|
if (!Pattern.matches("${column.regular}",${className}.get${AttrName}())){
|
||||||
|
return AjaxResult.error("${column.columnComment}格式错误!");
|
||||||
|
}
|
||||||
|
#end
|
||||||
#end
|
#end
|
||||||
ServerResult<Integer> serverResult = ${className}Service.update${ClassName}(${className});
|
ServerResult<Integer> serverResult = ${className}Service.update${ClassName}(${className});
|
||||||
if (serverResult.isStart()) {
|
if (serverResult.isStart()) {
|
||||||
|
|
@ -194,6 +204,9 @@ public class ${ClassName}Controller extends HcyBaseController {
|
||||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||||
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) {
|
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) {
|
||||||
try {
|
try {
|
||||||
|
if (${pkColumn.javaField}s.length<0){
|
||||||
|
return AjaxResult.error("id不能为空!");
|
||||||
|
}
|
||||||
ServerResult<Integer> serverResult = ${className}Service.delete${ClassName}ByIds(${pkColumn.javaField}s);
|
ServerResult<Integer> serverResult = ${className}Service.delete${ClassName}ByIds(${pkColumn.javaField}s);
|
||||||
if (serverResult.isStart()) {
|
if (serverResult.isStart()) {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,10 @@ export default {
|
||||||
#set($comment=$column.columnComment)
|
#set($comment=$column.columnComment)
|
||||||
#end
|
#end
|
||||||
$column.javaField: [
|
$column.javaField: [
|
||||||
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }
|
{ required: true, message: "${comment}不能为空}", trigger: #if($column.htmlType == "select")"change"#else"blur"#end },
|
||||||
|
#if($column.isRegular != 1)
|
||||||
|
{ pattern: /${column.regular}/, message: '${column.columnComment}格式有误', trigger:"blur"},
|
||||||
|
#end
|
||||||
]#if($velocityCount != $columns.size()),#end
|
]#if($velocityCount != $columns.size()),#end
|
||||||
|
|
||||||
#end
|
#end
|
||||||
|
|
@ -442,20 +445,21 @@ export default {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
this.queryParams.params = {};
|
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($VariableName= "daterange"+$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) {
|
#set($variable = true)
|
||||||
this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0];
|
#break
|
||||||
this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1];
|
|
||||||
}
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
#if($variable)
|
||||||
|
list${BusinessName}(this.addCreateDateRange(this.queryParams,this.$VariableName)).then(response =>{
|
||||||
|
#else
|
||||||
list${BusinessName}(this.queryParams).then(response => {
|
list${BusinessName}(this.queryParams).then(response => {
|
||||||
|
#end
|
||||||
this.${businessName}List = response.rows;
|
this.${businessName}List = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
|
|
||||||
|
|
@ -115,9 +115,15 @@ public class StuController extends HcyBaseController {
|
||||||
if (stu.getTel() == null || stu.getTel()<0) {
|
if (stu.getTel() == null || stu.getTel()<0) {
|
||||||
return AjaxResult.error("电话不能为空!");
|
return AjaxResult.error("电话不能为空!");
|
||||||
}
|
}
|
||||||
|
if (!Pattern.matches("^1[0-9]{10}$",String.valueOf(stu.getTel()))){
|
||||||
|
return AjaxResult.error("电话格式错误!");
|
||||||
|
}
|
||||||
if (stu.getEmail() == null || stu.getEmail().equals("")) {
|
if (stu.getEmail() == null || stu.getEmail().equals("")) {
|
||||||
return AjaxResult.error("电子邮件不能为空!");
|
return AjaxResult.error("电子邮件不能为空!");
|
||||||
}
|
}
|
||||||
|
if (!Pattern.matches("^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$",stu.getEmail())){
|
||||||
|
return AjaxResult.error("电子邮件格式错误!");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
ServerResult<Integer> serverResult = stuService.insertStu(stu);
|
ServerResult<Integer> serverResult = stuService.insertStu(stu);
|
||||||
if (serverResult.isStart()) {
|
if (serverResult.isStart()) {
|
||||||
|
|
@ -146,9 +152,15 @@ public class StuController extends HcyBaseController {
|
||||||
if (stu.getTel() == null || stu.getTel()<0) {
|
if (stu.getTel() == null || stu.getTel()<0) {
|
||||||
return AjaxResult.error("电话不能为空!");
|
return AjaxResult.error("电话不能为空!");
|
||||||
}
|
}
|
||||||
|
if (!Pattern.matches("^1[0-9]{10}$",String.valueOf(stu.getTel()))){
|
||||||
|
return AjaxResult.error("电话格式错误!");
|
||||||
|
}
|
||||||
if (stu.getEmail() == null || stu.getEmail().equals("")) {
|
if (stu.getEmail() == null || stu.getEmail().equals("")) {
|
||||||
return AjaxResult.error("电子邮件不能为空!");
|
return AjaxResult.error("电子邮件不能为空!");
|
||||||
}
|
}
|
||||||
|
if (!Pattern.matches("^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$",stu.getEmail())){
|
||||||
|
return AjaxResult.error("电子邮件格式错误!");
|
||||||
|
}
|
||||||
ServerResult<Integer> serverResult = stuService.updateStu(stu);
|
ServerResult<Integer> serverResult = stuService.updateStu(stu);
|
||||||
if (serverResult.isStart()) {
|
if (serverResult.isStart()) {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
|
@ -169,6 +181,9 @@ public class StuController extends HcyBaseController {
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
try {
|
try {
|
||||||
|
if (ids.length<0){
|
||||||
|
return AjaxResult.error("id不能为空!");
|
||||||
|
}
|
||||||
ServerResult<Integer> serverResult = stuService.deleteStuByIds(ids);
|
ServerResult<Integer> serverResult = stuService.deleteStuByIds(ids);
|
||||||
if (serverResult.isStart()) {
|
if (serverResult.isStart()) {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue