|
|
@ -49,6 +49,7 @@ func (l *{{.logic}}) {{.function}}({{.request}}) {{.responseType}} { |
|
|
|
// var {{.pkgName}} []model.XXX // 定义一个结构体,用于存储查询结果 |
|
|
|
// gormRes := l.svcCtx.GormDb.Where("name = ?",req.Name).Find(&{{.pkgName}}) // 调用Gorm的Find方法,查询多条记录 |
|
|
|
|
|
|
|
// // 判断是否发生错误 |
|
|
|
// if gormRes.Error != nil || gormRes.RowsAffected == 0 { // 如果操作数据发生错误,或为找到数据,则返回错误信息 |
|
|
|
// return &types.Response{ |
|
|
|
// Success: false, |
|
|
@ -58,7 +59,7 @@ func (l *{{.logic}}) {{.function}}({{.request}}) {{.responseType}} { |
|
|
|
// },nil |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// 返回正确信息 |
|
|
|
return &types.Response{ |
|
|
|
Success: true, |
|
|
|
Code : 200, |
|
|
|