@@ -7,66 +7,42 @@ import (
77)
88
99// Create{ {.StructName} } 创建{ {.StructName} }记录
10- // @author: [piexlmax](https://github.com/piexlmax)
11- // @function: Create{ {.StructName} }
12- // @description: 创建{ {.StructName} }记录
13- // @param: { {.Abbreviation} } model.{ {.StructName} }
14- // @return: err error
10+ // Author [piexlmax](https://github.com/piexlmax)
1511func Create{ {.StructName} }({ {.Abbreviation} } model.{ {.StructName} }) (err error) {
1612 err = global.GVA_DB.Create(&{{.Abbreviation} }).Error
1713 return err
1814}
1915
2016// Delete{ {.StructName} } 删除{ {.StructName} }记录
21- // @author: [piexlmax](https://github.com/piexlmax)
22- // @function: Delete{ {.StructName} }
23- // @description: 删除{ {.StructName} }记录
24- // @param: { {.Abbreviation} } model.{ {.StructName} }
25- // @return: err error
17+ // Author [piexlmax](https://github.com/piexlmax)
2618func Delete{ {.StructName} }({ {.Abbreviation} } model.{ {.StructName} }) (err error) {
2719 err = global.GVA_DB.Delete(&{{.Abbreviation} }).Error
2820 return err
2921}
3022
3123// Delete{ {.StructName} }ByIds 批量删除{ {.StructName} }记录
32- // @author: [piexlmax](https://github.com/piexlmax)
33- // @function: Delete{ {.StructName} }ByIds
34- // @description: 批量删除{ {.StructName} }记录
35- // @param: ids request.IdsReq
36- // @return: err error
24+ // Author [piexlmax](https://github.com/piexlmax)
3725func Delete{ {.StructName} }ByIds(ids request.IdsReq) (err error) {
3826 err = global.GVA_DB.Delete(&[]model.{{.StructName} }{ } ,"id in ?",ids.Ids).Error
3927 return err
4028}
4129
4230// Update{ {.StructName} } 更新{ {.StructName} }记录
43- // @author: [piexlmax](https://github.com/piexlmax)
44- // @function: Update{ {.StructName} }
45- // @description: 更新{ {.StructName} }记录
46- // @param: { {.Abbreviation} } *model.{ {.StructName} }
47- // @return: err error
31+ // Author [piexlmax](https://github.com/piexlmax)
4832func Update{ {.StructName} }({ {.Abbreviation} } model.{ {.StructName} }) (err error) {
4933 err = global.GVA_DB.Save(&{{.Abbreviation} }).Error
5034 return err
5135}
5236
5337// Get{ {.StructName} } 根据id获取{ {.StructName} }记录
54- // @author: [piexlmax](https://github.com/piexlmax)
55- // @function: Get{ {.StructName} }
56- // @description: 根据id获取{ {.StructName} }记录
57- // @param: id uint
58- // @return: err error, { {.Abbreviation} } model.{ {.StructName} }
38+ // Author [piexlmax](https://github.com/piexlmax)
5939func Get{ {.StructName} }(id uint) (err error, { {.Abbreviation} } model.{ {.StructName} }) {
6040 err = global.GVA_DB.Where(" id = ?" , id).First(&{{.Abbreviation} }).Error
6141 return
6242}
6343
6444// Get{ {.StructName} }InfoList 分页获取{ {.StructName} }记录
65- // @author: [piexlmax](https://github.com/piexlmax)
66- // @function: Get{ {.StructName} }InfoList
67- // @description: 分页获取{ {.StructName} }记录
68- // @param: info request.{ {.StructName} }Search
69- // @return: err error, list interface{ } , total int64
45+ // Author [piexlmax](https://github.com/piexlmax)
7046func Get{ {.StructName} }InfoList(info request.{ {.StructName} }Search) (err error, list interface{ } , total int64) {
7147 limit := info.PageSize
7248 offset := info.PageSize * (info.Page - 1)
@@ -102,4 +78,4 @@ func Get{{.StructName}}InfoList(info request.{{.StructName}}Search) (err error,
10278 err = db.Count(&total).Error
10379 err = db.Limit(limit).Offset(offset).Find(& { {.Abbreviation} }s).Error
10480 return err, { {.Abbreviation} }s, total
105- }
81+ }
0 commit comments