|
@@ -337,17 +337,22 @@ func getAddChapter(reportInfo *models.Report, minClassifyId, inheritReportId int
|
|
|
err = fmt.Errorf("获取章节类型权限列表失败, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
+ hasPermissionMap := make(map[string]bool)
|
|
|
for _, v := range mappingList {
|
|
|
tmpChapterTypePermissionList, ok := currChapterTypePermissionListMap[v.ReportChapterTypeId]
|
|
|
if !ok {
|
|
|
tmpChapterTypePermissionList = make([]*report.ReportChapterPermissionMapping, 0)
|
|
|
}
|
|
|
- currChapterTypePermissionListMap[v.ReportChapterTypeId] = append(tmpChapterTypePermissionList, &report.ReportChapterPermissionMapping{
|
|
|
- ReportChapterPermissionMappingId: 0,
|
|
|
- ReportChapterId: 0,
|
|
|
- ChartPermissionId: v.ChartPermissionId,
|
|
|
- CreateTime: time.Now(),
|
|
|
- })
|
|
|
+ key := fmt.Sprint(v.ReportChapterTypeId, "-", v.ChartPermissionId)
|
|
|
+ if _, has := hasPermissionMap[key]; !has {
|
|
|
+ hasPermissionMap[key] = true
|
|
|
+ currChapterTypePermissionListMap[v.ReportChapterTypeId] = append(tmpChapterTypePermissionList, &report.ReportChapterPermissionMapping{
|
|
|
+ ReportChapterPermissionMappingId: 0,
|
|
|
+ ReportChapterId: 0,
|
|
|
+ ChartPermissionId: v.ChartPermissionId,
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -534,7 +539,7 @@ func getAddChapter(reportInfo *models.Report, minClassifyId, inheritReportId int
|
|
|
chapterItem.ReportCreateTime = time.Now()
|
|
|
|
|
|
// 默认配置:从当前分类下配置的章节类型id所关联的品种列表
|
|
|
- tmpChapterPermissionList, ok = currChapterTypePermissionListMap[v.TypeId]
|
|
|
+ tmpChapterPermissionList, ok = currChapterTypePermissionListMap[typeItem.ReportChapterTypeId]
|
|
|
if !ok {
|
|
|
tmpChapterPermissionList = make([]*report.ReportChapterPermissionMapping, 0)
|
|
|
}
|