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

34 lines
1.3 KiB

package activity_service
import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/models"
)
//func GetModuleService(moduleName string, activityId int64) (*models.ActivityModuleService, bool, error) {
// hids := make([]int64, 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 := new(models.ActivityModuleService)
exist, err := core.GetXormAuto().Table(module).Alias("s").
Join("LEFT", new(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
}