package models import "github.com/beego/beego/v2/client/orm" type ChartPermissionChapterMappingItem struct { Id int `description:"id"` ChartPermissionId int `description:"品种id"` ChartPermissionName string `description:"品种名称"` ReportChapterTypeId int `description:"报告id"` ResearchType string `description:"id"` } func GetChartPermissionChapterMappingByReportId(reportId int) (items []*ChartPermissionChapterMappingItem, err error) { o := orm.NewOrmUsingDB("rddp") sql := `SELECT cpcm.*, cp.chart_permission_name FROM chart_permission_chapter_mapping AS cpcm LEFT JOIN chart_permission AS cp ON cpcm.chart_permission_id = cp.chart_permission_id WHERE report_chapter_type_id=?` _, err = o.Raw(sql, reportId).QueryRows(&items) return }