Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FLIPPED-AURORA
gin-vue-admin
提交
f77d6b92
G
gin-vue-admin
项目概览
FLIPPED-AURORA
/
gin-vue-admin
大约 1 年 前同步成功
通知
333
Star
18155
Fork
5506
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f77d6b92
编写于
7月 02, 2021
作者:
S
SliverHorn
提交者:
GitHub
7月 02, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update service.go.tpl
回参与入参,我觉得可以去掉,基本调用的时候都知道是什么类型,就没必要写了
上级
dfe51319
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
31 deletion
+7
-31
server/resource/template/server/service.go.tpl
server/resource/template/server/service.go.tpl
+7
-31
未找到文件。
server/resource/template/server/service.go.tpl
浏览文件 @
f77d6b92
...
...
@@ -7,66 +7,42 @@ import (
)
// Create{{.StructName}} 创建{{.StructName}}记录
// @author: [piexlmax](https://github.com/piexlmax)
// @function: Create{{.StructName}}
// @description: 创建{{.StructName}}记录
// @param: {{.Abbreviation}} model.{{.StructName}}
// @return: err error
// Author [piexlmax](https://github.com/piexlmax)
func Create{{.StructName}}({{.Abbreviation}} model.{{.StructName}}) (err error) {
err = global.GVA_DB.Create(
&
{{.Abbreviation}}).Error
return err
}
// Delete{{.StructName}} 删除{{.StructName}}记录
// @author: [piexlmax](https://github.com/piexlmax)
// @function: Delete{{.StructName}}
// @description: 删除{{.StructName}}记录
// @param: {{.Abbreviation}} model.{{.StructName}}
// @return: err error
// Author [piexlmax](https://github.com/piexlmax)
func Delete{{.StructName}}({{.Abbreviation}} model.{{.StructName}}) (err error) {
err = global.GVA_DB.Delete(
&
{{.Abbreviation}}).Error
return err
}
// Delete{{.StructName}}ByIds 批量删除{{.StructName}}记录
// @author: [piexlmax](https://github.com/piexlmax)
// @function: Delete{{.StructName}}ByIds
// @description: 批量删除{{.StructName}}记录
// @param: ids request.IdsReq
// @return: err error
// Author [piexlmax](https://github.com/piexlmax)
func Delete{{.StructName}}ByIds(ids request.IdsReq) (err error) {
err = global.GVA_DB.Delete(
&
[]model.{{.StructName}}{},"id in ?",ids.Ids).Error
return err
}
// Update{{.StructName}} 更新{{.StructName}}记录
// @author: [piexlmax](https://github.com/piexlmax)
// @function: Update{{.StructName}}
// @description: 更新{{.StructName}}记录
// @param: {{.Abbreviation}} *model.{{.StructName}}
// @return: err error
// Author [piexlmax](https://github.com/piexlmax)
func Update{{.StructName}}({{.Abbreviation}} model.{{.StructName}}) (err error) {
err = global.GVA_DB.Save(
&
{{.Abbreviation}}).Error
return err
}
// Get{{.StructName}} 根据id获取{{.StructName}}记录
// @author: [piexlmax](https://github.com/piexlmax)
// @function: Get{{.StructName}}
// @description: 根据id获取{{.StructName}}记录
// @param: id uint
// @return: err error, {{.Abbreviation}} model.{{.StructName}}
// Author [piexlmax](https://github.com/piexlmax)
func Get{{.StructName}}(id uint) (err error, {{.Abbreviation}} model.{{.StructName}}) {
err = global.GVA_DB.Where("id = ?", id).First(
&
{{.Abbreviation}}).Error
return
}
// Get{{.StructName}}InfoList 分页获取{{.StructName}}记录
// @author: [piexlmax](https://github.com/piexlmax)
// @function: Get{{.StructName}}InfoList
// @description: 分页获取{{.StructName}}记录
// @param: info request.{{.StructName}}Search
// @return: err error, list interface{}, total int64
// Author [piexlmax](https://github.com/piexlmax)
func Get{{.StructName}}InfoList(info request.{{.StructName}}Search) (err error, list interface{}, total int64) {
limit := info.PageSize
offset := info.PageSize * (info.Page - 1)
...
...
@@ -102,4 +78,4 @@ func Get{{.StructName}}InfoList(info request.{{.StructName}}Search) (err error,
err = db.Count(
&
total).Error
err = db.Limit(limit).Offset(offset).Find(
&
{{.Abbreviation}}s).Error
return err, {{.Abbreviation}}s, total
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录