Zeus/service/category.go

22 lines
518 B
Go
Raw Permalink Normal View History

2021-12-13 21:39:15 +08:00
package service
import (
2021-12-14 19:45:25 +08:00
bgm "bgm/helper"
2021-12-13 21:39:15 +08:00
"bgm/model"
ctxLogger "github.com/luizsuper/ctxLoggers"
"go.uber.org/zap"
"gorm.io/gorm"
)
2021-12-14 19:45:25 +08:00
func CreatCategory(category *model.Category, db *gorm.DB) error {
2021-12-13 21:39:15 +08:00
if err := db.Create(category).Error; err != nil {
ctxLogger.Info(nil, "createService err", zap.String("err info", err.Error()))
return err
}
return nil
}
2021-12-14 19:45:25 +08:00
func GetCategoryDto(page, size int, query bgm.QueryMap, db *gorm.DB) (*[]model.Category, error) {
return model.GetCategoryM(page, size, query, db)
}