|
@@ -9,6 +9,7 @@ import (
|
|
|
"github.com/beego/beego/v2/core/logs"
|
|
|
"github.com/google/uuid"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
+ "strconv"
|
|
|
)
|
|
|
|
|
|
func DocumentClassifyList() ([]models.ClassifyVO, error) {
|
|
@@ -123,6 +124,14 @@ func DocumentReportList(documentType int, chartPermissionIdList []string, classi
|
|
|
condition = ` and t1.source!=3`
|
|
|
}
|
|
|
if len(classifyIdList) > 0 {
|
|
|
+ // 递归查询子分类
|
|
|
+ for classifyId := range classifyIdList {
|
|
|
+ childenClassifyIdList, err := GetAllClassifyIdsByParentId(classifyId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ classifyIdList = append(classifyIdList, childenClassifyIdList...)
|
|
|
+ }
|
|
|
condition += ` and t1.classify_id in (` + utils.GetOrmInReplace(len(classifyIdList)) + `)`
|
|
|
for _, classifyId := range classifyIdList {
|
|
|
pars = append(pars, classifyId)
|
|
@@ -167,6 +176,30 @@ func DocumentReportList(documentType int, chartPermissionIdList []string, classi
|
|
|
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 int, keyword string, orderField, orderType string, startSize, pageSize int) (*models.ReportListResp, error) {
|
|
|
logs.Info("RuiSiReportList")
|
|
|
|