|
@@ -178,6 +178,23 @@ func DocumentReportList(userId, documentType int, chartPermissionIdList []string
|
|
|
condition = ` and t1.source!=3`
|
|
|
}
|
|
|
if len(classifyIdList) > 0 {
|
|
|
+ // 递归查询子分类
|
|
|
+ for _, classifyId := range classifyIdList {
|
|
|
+ id, err := strconv.Atoi(classifyId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ if id == 0 {
|
|
|
+ classifyIdList = append(classifyIdList, classifyId)
|
|
|
+ } else {
|
|
|
+ childrenClassifyIdList, err := GetAllClassifyIdsByParentId(id)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ classifyIdList = append(classifyIdList, childrenClassifyIdList...)
|
|
|
+ }
|
|
|
+ }
|
|
|
condition += ` and t1.classify_id in (` + utils.GetOrmInReplace(len(classifyIdList)) + `)`
|
|
|
for _, classifyId := range classifyIdList {
|
|
|
pars = append(pars, classifyId)
|
|
@@ -190,7 +207,7 @@ func DocumentReportList(userId, documentType int, chartPermissionIdList []string
|
|
|
}
|
|
|
}
|
|
|
if keyword != "" {
|
|
|
- condition += ` and (t1.title like ? or t1.sys_user_name like ? )`
|
|
|
+ condition += ` and (t1.title like ? or t1.sys_user_name like ?) `
|
|
|
pars = append(pars, "%"+keyword+"%", "%"+keyword+"%")
|
|
|
}
|
|
|
|
|
@@ -207,9 +224,9 @@ func DocumentReportList(userId, documentType int, chartPermissionIdList []string
|
|
|
}
|
|
|
|
|
|
if orderField != "" && orderType != "" {
|
|
|
- condition += ` group by t1.outside_report_id order by t1.` + orderField + ` ` + orderType
|
|
|
+ condition += ` order by t1.` + orderField + ` ` + orderType
|
|
|
} else {
|
|
|
- condition += ` group by t1.outside_report_id order by t1.report_update_time desc`
|
|
|
+ condition += ` order by t1.report_update_time desc`
|
|
|
}
|
|
|
|
|
|
outsideReportList, err := document_manage_model.GetOutsideReportListByCondition(condition, pars, startSize, pageSize)
|
|
@@ -240,6 +257,30 @@ func DocumentReportList(userId, documentType int, chartPermissionIdList []string
|
|
|
return &reportPage, nil
|
|
|
}
|
|
|
|
|
|
+// GetAllClassifyIdsByParentId 递归查询子分类
|
|
|
+func GetAllClassifyIdsByParentId(parentId int) ([]string, error) {
|
|
|
+ var classifyIdList []string
|
|
|
+
|
|
|
+ // 获取子分类
|
|
|
+ classifyList, err := models.GetClassifyListByParentId(parentId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ // 遍历子分类
|
|
|
+ for _, classify := range classifyList {
|
|
|
+ classifyIdList = append(classifyIdList, strconv.Itoa(classify.Id))
|
|
|
+ // 递归调用
|
|
|
+ subClassifyIds, err := GetAllClassifyIdsByParentId(classify.Id)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ classifyIdList = append(classifyIdList, subClassifyIds...)
|
|
|
+ }
|
|
|
+
|
|
|
+ return classifyIdList, nil
|
|
|
+}
|
|
|
+
|
|
|
func RuiSiReportList(classifyIdFirst, classifyIdSecond, classifyIdThird []string, keyword, orderField, orderType string, startSize, pageSize int) (*models.ReportListResp, error) {
|
|
|
logs.Info("RuiSiReportList")
|
|
|
|