互动
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.

35 lines
1.2 KiB

package activity_service
import (
"hudongzhuanjia/models"
"github.com/ouxuanserver/osmanthuswine/src/core"
)
//func GetModuleService(moduleName string, activityId int) (*models.ActivityModuleService, bool, error) {
// hids := make([]int, 0)
// err := core.GetXormAuto().Table(new(models.ModuleServiceHistory)).Select("id").
// Where("is_delete=0 and name=?", moduleName).Find(&hids)
// if err != nil {
// return nil, false, err
// }
// moduleService := new(models.ActivityModuleService)
// exist, err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId).
// In("service_module_history_id", hids).Get(moduleService)
// return moduleService, exist, err
//}
//type ModuleService struct {
// models.ActivityModuleService `xorm:"extends"`
// History models.ModuleServiceHistory `xorm:"extends"`
//}
func GetModuleService(moduleName, activityId interface{}) (*models.ActivityModuleService, bool, error) {
module := &models.ActivityModuleService{}
exist, err := core.GetXormAuto().Table(module).Alias("s").
Join("LEFT", (&models.ModuleServiceHistory{}).Alias("h"),
"s.service_module_history_id=h.id").
Where("s.activity_id=? and s.is_delete=0 and h.name=?", activityId, moduleName).
Get(module)
return module, exist, err
}