You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
2.0 KiB
64 lines
2.0 KiB
package app
|
|
|
|
import (
|
|
"ln/nft/global"
|
|
"ln/nft/model/app"
|
|
"ln/nft/model/common/request"
|
|
appReq "ln/nft/model/app/request"
|
|
)
|
|
|
|
type AppHerbsNService struct {
|
|
}
|
|
|
|
// CreateAppHerbsN 创建AppHerbsN记录
|
|
// Author [piexlmax](https://github.com/piexlmax)
|
|
func (appHerbsSService *AppHerbsNService) CreateAppHerbsN(appHerbsS app.AppHerbsN) (err error) {
|
|
err = global.GVA_DB.Create(&appHerbsS).Error
|
|
return err
|
|
}
|
|
|
|
// DeleteAppHerbsN 删除AppHerbsN记录
|
|
// Author [piexlmax](https://github.com/piexlmax)
|
|
func (appHerbsSService *AppHerbsNService)DeleteAppHerbsN(appHerbsS app.AppHerbsN) (err error) {
|
|
err = global.GVA_DB.Delete(&appHerbsS).Error
|
|
return err
|
|
}
|
|
|
|
// DeleteAppHerbsNByIds 批量删除AppHerbsN记录
|
|
// Author [piexlmax](https://github.com/piexlmax)
|
|
func (appHerbsSService *AppHerbsNService)DeleteAppHerbsNByIds(ids request.IdsReq) (err error) {
|
|
err = global.GVA_DB.Delete(&[]app.AppHerbsN{},"id in ?",ids.Ids).Error
|
|
return err
|
|
}
|
|
|
|
// UpdateAppHerbsN 更新AppHerbsN记录
|
|
// Author [piexlmax](https://github.com/piexlmax)
|
|
func (appHerbsSService *AppHerbsNService)UpdateAppHerbsN(appHerbsS app.AppHerbsN) (err error) {
|
|
err = global.GVA_DB.Save(&appHerbsS).Error
|
|
return err
|
|
}
|
|
|
|
// GetAppHerbsN 根据id获取AppHerbsN记录
|
|
// Author [piexlmax](https://github.com/piexlmax)
|
|
func (appHerbsSService *AppHerbsNService)GetAppHerbsN(id uint) (appHerbsS app.AppHerbsN, err error) {
|
|
err = global.GVA_DB.Where("id = ?", id).First(&appHerbsS).Error
|
|
return
|
|
}
|
|
|
|
// GetAppHerbsNInfoList 分页获取AppHerbsN记录
|
|
// Author [piexlmax](https://github.com/piexlmax)
|
|
func (appHerbsSService *AppHerbsNService)GetAppHerbsNInfoList(info appReq.AppHerbsNSearch) (list interface{}, total int64, err error) {
|
|
limit := info.PageSize
|
|
offset := info.PageSize * (info.Page - 1)
|
|
// 创建db
|
|
db := global.GVA_DB.Model(&app.AppHerbsN{})
|
|
var appHerbsSs []app.AppHerbsN
|
|
// 如果有条件搜索 下方会自动创建搜索语句
|
|
err = db.Count(&total).Error
|
|
if err!=nil {
|
|
return
|
|
}
|
|
err = db.Limit(limit).Offset(offset).Find(&appHerbsSs).Error
|
|
return appHerbsSs, total, err
|
|
}
|