chance.go 2.0 KB
package repository

import "opp/models"

type IChanceRepository interface {
	GetChanceById(id int64) (v *models.Chance, err error)
}

var _ IChanceRepository = (*ChanceRepository)(nil)

type ChanceRepository struct{}

func (r *ChanceRepository) GetChanceById(id int64) (v *models.Chance, err error) {
	return models.GetChanceById(id)
}

type IChanceFavoriteRepository interface {
	GetChanceFavorites(userId, companyId int64, objectType, chanceType int, lastId int64, pageSize int) (v []*models.ChanceFavorite, total int, err error)
	ExitsChanceFavorite(userId, companyId int64, sourceId int64, objectType int) (exits bool, err error)
	AddChanceFavorite(m *models.ChanceFavorite) (id int64, err error)
	UpdateChanceFavorite(userId, companyId int64,sourceId int64,objectType int)error
	GetChanceFavorite(userId, companyId int64,sourceId int64,sourceType int)(v *models.ChanceFavorite,err error)
}

var _ IChanceFavoriteRepository = (*ChanceFavoriteRepository)(nil)

type ChanceFavoriteRepository struct{}

func (r *ChanceFavoriteRepository) GetChanceFavorites(userId, companyId int64, objectType, chanceType int, lastId int64, pageSize int) (v []*models.ChanceFavorite, total int, err error) {
	return models.GetChanceFavorites(userId, companyId, objectType, chanceType, lastId, pageSize)
}
func (r *ChanceFavoriteRepository) ExitsChanceFavorite(userId, companyId int64, sourceId int64, objectType int) (exits bool, err error) {
	return models.ExitsChanceFavorite(userId, companyId, sourceId, objectType)
}
func (r *ChanceFavoriteRepository) AddChanceFavorite(m *models.ChanceFavorite) (id int64, err error) {
	return models.AddChanceFavorite(m)
}

func (r *ChanceFavoriteRepository) UpdateChanceFavorite(userId, companyId int64,sourceId int64,objectType int) error{
	return models.UpdateChanceFavorite(userId,companyId,sourceId,objectType)
}


func (r *ChanceFavoriteRepository) GetChanceFavorite(userId, companyId int64,sourceId int64,sourceType int)(v *models.ChanceFavorite,err error){
	return models.GetChanceFavorite(userId,companyId,sourceId,sourceType)
}