|
@@ -163,6 +163,8 @@ func (this *PptV2Controller) ReportList() {
|
|
|
currentIndex = 1
|
|
|
}
|
|
|
startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
+ resp := new(models.PptPageReportResp)
|
|
|
+ resp.List = make([]*models.PptReportItem, 0)
|
|
|
|
|
|
|
|
|
pptList := make([]*models.PptV2, 0)
|
|
@@ -181,8 +183,32 @@ func (this *PptV2Controller) ReportList() {
|
|
|
pars = append(pars, utils.ReportSourceOuter)
|
|
|
}
|
|
|
if classifyId > 0 {
|
|
|
- cond += ` AND classify_id = ?`
|
|
|
- pars = append(pars, classifyId)
|
|
|
+
|
|
|
+ classifyOb := new(models.Classify)
|
|
|
+ childCond := ` AND FIND_IN_SET(?, level_path)`
|
|
|
+ childPars := make([]interface{}, 0)
|
|
|
+ childPars = append(childPars, classifyId)
|
|
|
+ children, e := classifyOb.GetItemsByCondition(childCond, childPars, []string{"id"}, "")
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = fmt.Sprintf("获取分类及子分类失败, %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var childIds []int
|
|
|
+ for _, v := range children {
|
|
|
+ childIds = append(childIds, v.Id)
|
|
|
+ }
|
|
|
+ if len(childIds) == 0 {
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, 0)
|
|
|
+ resp.Paging = page
|
|
|
+ br.Data = resp
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ cond += ` AND classify_id IN (?)`
|
|
|
+ pars = append(pars, childIds)
|
|
|
}
|
|
|
keyword = strings.TrimSpace(keyword)
|
|
|
if keyword != "" {
|
|
@@ -206,8 +232,6 @@ func (this *PptV2Controller) ReportList() {
|
|
|
}
|
|
|
pptList = list
|
|
|
|
|
|
- resp := new(models.PptPageReportResp)
|
|
|
- resp.List = make([]*models.PptReportItem, 0)
|
|
|
for _, v := range pptList {
|
|
|
|
|
|
t := v.Format2ReportItem(v)
|