This commit is contained in:
parent
8bdf414948
commit
3b4192b848
|
|
@ -55,7 +55,8 @@
|
|||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['test:stu:add']"
|
||||
>新增</el-button>
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
|
|
@ -66,7 +67,8 @@
|
|||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['test:stu:edit']"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
|
|
@ -77,7 +79,8 @@
|
|||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['test:stu:remove']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
|
|
@ -87,7 +90,8 @@
|
|||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['test:stu:export']"
|
||||
>导出</el-button>
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
|
@ -106,14 +110,16 @@
|
|||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['test:stu:edit']"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['test:stu:remove']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -152,8 +158,7 @@ import { listStu, getStu, delStu, addStu, updateStu, exportStu } from "@/api/tes
|
|||
|
||||
export default {
|
||||
name: "Stu",
|
||||
components: {
|
||||
},
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
|
|
@ -189,6 +194,21 @@ export default {
|
|||
form: {},
|
||||
// 表单校验
|
||||
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,11 +219,6 @@ export default {
|
|||
/** 查询学生列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// this.queryParams.params = {};
|
||||
// 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.total = response.total;
|
||||
|
|
|
|||
|
|
@ -192,9 +192,6 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||
for (String template : templates) {
|
||||
// 渲染模板
|
||||
if (template.equals("")){
|
||||
|
||||
}
|
||||
StringWriter sw = new StringWriter();
|
||||
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
||||
tpl.merge(context, sw);
|
||||
|
|
|
|||
|
|
@ -135,6 +135,11 @@ public class ${ClassName}Controller extends HcyBaseController {
|
|||
return AjaxResult.error("${column.columnComment}不能为空!");
|
||||
}
|
||||
#end
|
||||
#if($column.isRegular != 1)
|
||||
if (!Pattern.matches("${column.regular}",${className}.get${AttrName}())){
|
||||
return AjaxResult.error("${column.columnComment}格式错误!");
|
||||
}
|
||||
#end
|
||||
#end
|
||||
try {
|
||||
ServerResult<Integer> serverResult = ${className}Service.insert${ClassName}(${className});
|
||||
|
|
@ -173,6 +178,11 @@ public class ${ClassName}Controller extends HcyBaseController {
|
|||
return AjaxResult.error("${column.columnComment}不能为空!");
|
||||
}
|
||||
#end
|
||||
#if($column.isRegular != 1)
|
||||
if (!Pattern.matches("${column.regular}",${className}.get${AttrName}())){
|
||||
return AjaxResult.error("${column.columnComment}格式错误!");
|
||||
}
|
||||
#end
|
||||
#end
|
||||
ServerResult<Integer> serverResult = ${className}Service.update${ClassName}(${className});
|
||||
if (serverResult.isStart()) {
|
||||
|
|
@ -194,6 +204,9 @@ public class ${ClassName}Controller extends HcyBaseController {
|
|||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) {
|
||||
try {
|
||||
if (${pkColumn.javaField}s.length<0){
|
||||
return AjaxResult.error("id不能为空!");
|
||||
}
|
||||
ServerResult<Integer> serverResult = ${className}Service.delete${ClassName}ByIds(${pkColumn.javaField}s);
|
||||
if (serverResult.isStart()) {
|
||||
return AjaxResult.success();
|
||||
|
|
|
|||
|
|
@ -418,7 +418,10 @@ export default {
|
|||
#set($comment=$column.columnComment)
|
||||
#end
|
||||
$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
|
||||
|
||||
#end
|
||||
|
|
@ -442,20 +445,21 @@ export default {
|
|||
this.loading = true;
|
||||
#foreach ($column in $columns)
|
||||
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||
this.queryParams.params = {};
|
||||
#break
|
||||
#end
|
||||
#end
|
||||
#foreach ($column in $columns)
|
||||
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) {
|
||||
this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0];
|
||||
this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1];
|
||||
}
|
||||
#set($VariableName= "daterange"+$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
#set($variable = true)
|
||||
#break
|
||||
#end
|
||||
#end
|
||||
#if($variable)
|
||||
list${BusinessName}(this.addCreateDateRange(this.queryParams,this.$VariableName)).then(response =>{
|
||||
#else
|
||||
list${BusinessName}(this.queryParams).then(response => {
|
||||
#end
|
||||
this.${businessName}List = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
|
|
|
|||
|
|
@ -115,9 +115,15 @@ public class StuController extends HcyBaseController {
|
|||
if (stu.getTel() == null || stu.getTel()<0) {
|
||||
return AjaxResult.error("电话不能为空!");
|
||||
}
|
||||
if (!Pattern.matches("^1[0-9]{10}$",String.valueOf(stu.getTel()))){
|
||||
return AjaxResult.error("电话格式错误!");
|
||||
}
|
||||
if (stu.getEmail() == null || stu.getEmail().equals("")) {
|
||||
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 {
|
||||
ServerResult<Integer> serverResult = stuService.insertStu(stu);
|
||||
if (serverResult.isStart()) {
|
||||
|
|
@ -146,9 +152,15 @@ public class StuController extends HcyBaseController {
|
|||
if (stu.getTel() == null || stu.getTel()<0) {
|
||||
return AjaxResult.error("电话不能为空!");
|
||||
}
|
||||
if (!Pattern.matches("^1[0-9]{10}$",String.valueOf(stu.getTel()))){
|
||||
return AjaxResult.error("电话格式错误!");
|
||||
}
|
||||
if (stu.getEmail() == null || stu.getEmail().equals("")) {
|
||||
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);
|
||||
if (serverResult.isStart()) {
|
||||
return AjaxResult.success();
|
||||
|
|
@ -169,6 +181,9 @@ public class StuController extends HcyBaseController {
|
|||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
try {
|
||||
if (ids.length<0){
|
||||
return AjaxResult.error("id不能为空!");
|
||||
}
|
||||
ServerResult<Integer> serverResult = stuService.deleteStuByIds(ids);
|
||||
if (serverResult.isStart()) {
|
||||
return AjaxResult.success();
|
||||
|
|
|
|||
Loading…
Reference in New Issue