package models import "github.com/beego/beego/v2/client/orm" type UserChartPermissionMapping struct { UserChartPermissionMappingId int `orm:"pk" description:"id"` UserId int `description:"用户id"` ChartPermissionId int `description:"品种id"` } func GetChartPermissionIdByUserId(UserId int) (items []int, err error) { o := orm.NewOrm() sql := `SELECT chart_permission_id FROM user_chart_permission_mapping WHERE user_id=?` _, err = o.Raw(sql, UserId).QueryRows(&items) return }