32 lines
874 B
Go
32 lines
874 B
Go
package mysql
|
|
|
|
import (
|
|
"context"
|
|
"finclip-app-manager/domain/repository"
|
|
)
|
|
|
|
var _ repository.IAppOperConfigRepo = new(AppOperConfigRepo)
|
|
|
|
type AppOperConfigRepo struct {
|
|
}
|
|
|
|
func (a *AppOperConfigRepo) Insert(ctx context.Context, item repository.AppOperConfig) error {
|
|
err := DB.Model(&repository.AppOperConfig{}).Create(&item).Error
|
|
return err
|
|
}
|
|
|
|
func (a *AppOperConfigRepo) Update(ctx context.Context, item repository.AppOperConfig) error {
|
|
data := make(map[string]interface{})
|
|
data["auto_review_app"] = item.AutoReviewApp
|
|
data["update_time"] = item.UpdateTime
|
|
|
|
return DB.Model(&repository.AppOperConfig{}).Where("id=?", item.Id).Updates(data).Error
|
|
}
|
|
|
|
func (a *AppOperConfigRepo) Find(ctx context.Context) (repository.AppOperConfig, error) {
|
|
var item repository.AppOperConfig
|
|
err := DB.Model(&repository.AppOperConfig{}).First(&item).Error
|
|
|
|
return item, err
|
|
}
|