|
@@ -6,9 +6,15 @@ import (
|
|
|
)
|
|
|
|
|
|
// GetTypeIdsByChartPermissionId 根据权限查询对应的章节
|
|
|
-func GetTypeIdsByChartPermissionId(chartPermissionId int) (typeIds []int, err error) {
|
|
|
+func GetTypeIdsByChartPermissionId(chartPermissionId int) (typeIds []int, err error) {
|
|
|
var list []*ReportChapterTypePermission
|
|
|
- err = global.DEFAULT_MYSQL.Model(ReportChapterTypePermission{}).Where("chart_permission_id = ?", chartPermissionId).Scan(&list).Error
|
|
|
+ query := global.DEFAULT_MYSQL.
|
|
|
+ Table("report_chapter_type_permission AS a").
|
|
|
+ Select("a.*").
|
|
|
+ Joins("JOIN report_chapter_type AS b ON a.report_chapter_type_id = b.report_chapter_type_id").
|
|
|
+ Where("b.is_show = 1 AND b.enabled = 1 AND a.chart_permission_id = ?", chartPermissionId)
|
|
|
+ err = query.Scan(&list).Error
|
|
|
+ //err = global.DEFAULT_MYSQL.Model(ReportChapterTypePermission{}).Where("chart_permission_id = ?", chartPermissionId).Scan(&list).Error
|
|
|
if err == utils.ErrNoRow {
|
|
|
err = nil
|
|
|
}
|