diff --git a/template/vm/go/crud/model.template b/template/vm/go/crud/model.template index 9e4bcd6..3e8dc14 100644 --- a/template/vm/go/crud/model.template +++ b/template/vm/go/crud/model.template @@ -108,13 +108,13 @@ func SelectListByPage(req *SelectPageReq) (total int, page int64, list []*Entity {{range $index, $column := .table.Columns}} {{if eq $column.IsQuery "1"}} {{if eq $column.QueryType "LIKE"}} if req.{{$column.GoField}} != "" { - model.Where("{{$column.ColumnName}} like ?", "%"+req.{{$column.GoField}}+"%") + model = model.Where("{{$column.ColumnName}} like ?", "%"+req.{{$column.GoField}}+"%") } {{else if eq $column.QueryType "EQ"}} {{if eq $column.GoType "string"}} if req.{{$column.GoField}} != "" { - model.Where("{{$column.ColumnName}} = ?", req.{{$column.GoField}}) + model = model.Where("{{$column.ColumnName}} = ?", req.{{$column.GoField}}) } {{else if eq $column.GoType "int" "int64"}} if req.{{$column.GoField}} != 0 { - model.Where("{{$column.ColumnName}} = ?", req.{{$column.GoField}}) + model = model.Where("{{$column.ColumnName}} = ?", req.{{$column.GoField}}) } {{end}} {{end}} {{end}} {{end}} } diff --git a/template/vm/html/vue_crud.template b/template/vm/html/vue_crud.template index 56b7f60..16b0b4c 100644 --- a/template/vm/html/vue_crud.template +++ b/template/vm/html/vue_crud.template @@ -383,7 +383,7 @@ export default { {{end}} if (this.form.{{$pkColumnName}} != null) { update{{.table.BusinessName|UcFirst}}(this.form).then(response => { - if (response.code === 200) { + if (response.code === 0) { this.msgSuccess("修改成功"); this.open = false; this.getList(); @@ -391,7 +391,7 @@ export default { }); } else { add{{.table.BusinessName|UcFirst}}(this.form).then(response => { - if (response.code === 200) { + if (response.code === 0) { this.msgSuccess("新增成功"); this.open = false; this.getList(); diff --git a/template/vm/html/vue_tree.template b/template/vm/html/vue_tree.template index 721ef30..85ad089 100644 --- a/template/vm/html/vue_tree.template +++ b/template/vm/html/vue_tree.template @@ -383,7 +383,7 @@ export default { {{end}} if (this.form.{{$pkColumnName}} != null) { update{{.table.BusinessName|UcFirst}}(this.form).then(response => { - if (response.code === 200) { + if (response.code === 0) { this.msgSuccess("修改成功"); this.open = false; this.getList(); @@ -391,7 +391,7 @@ export default { }); } else { add{{.table.BusinessName|UcFirst}}(this.form).then(response => { - if (response.code === 200) { + if (response.code === 0) { this.msgSuccess("新增成功"); this.open = false; this.getList();