package models

import (
	"github.com/beego/beego/v2/client/orm"
	"time"
)

type ReportChapterTypePermission struct {
	Id                    int       `orm:"column(id);pk" description:"主键ID"`
	ReportChapterTypeId   int       `description:"报告章节类型ID"`
	ReportChapterTypeName string    `description:"章节名称"`
	ChartPermissionId     int       `description:"大分类ID"`
	PermissionName        string    `description:"权限名称"`
	ResearchType          string    `description:"研报类型"`
	CreatedTime           time.Time `description:"创建时间"`
}

// GetChapterTypePermissionByTypeIdAndResearchType 根据章节类型ID及研报类型获取章节类型权限列表
func GetChapterTypePermissionByTypeIdAndResearchType(typeId int, researchType string) (list []*ReportChapterTypePermission, err error) {
	o := orm.NewOrm()
	sql := ` SELECT * FROM report_chapter_type_permission WHERE report_chapter_type_id = ? AND research_type = ? ORDER BY chart_permission_id ASC `
	_, err = o.Raw(sql, typeId, researchType).QueryRows(&list)
	return
}
