package crm import "hongze/hz_crm_eta/global" type ChartPermissionChapterMapping struct { Id int `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"` ChartPermissionId int `gorm:"column:chart_permission_id;default:0"` ReportChapterTypeId int `gorm:"column:report_chapter_type_id;default:0;comment:'report_chapter_type表主键id或research_report表主键id或tactic表主键id'"` ResearchType string `gorm:"column:research_type;default:"` } func (c *ChartPermissionChapterMapping) TableName() string { return "chart_permission_chapter_mapping" } type PermissionReportReq struct { ReportId int64 `description:"报告id"` //ClassifyNameSecond string `description:"二级分类名称"` ClassifyIdSecond int `description:"二级分类ID"` } func RemoveChartPermissionChapterMapping(reportId int64) (err error) { // 先删除 sql := `DELETE FROM chart_permission_chapter_mapping WHERE research_type=? AND report_chapter_type_id=? ` err = global.MYSQL["hz_crm"].Exec(sql, "rddp", reportId).Error return } func AddChartPermissionChapterMapping(chartPermissionId int, reportId int64) (err error) { sql := `INSERT INTO chart_permission_chapter_mapping (chart_permission_id, report_chapter_type_id,research_type) VALUES(?,?,?)` err = global.MYSQL["hz_crm"].Exec(sql, chartPermissionId, reportId, "rddp").Error return }