Sfoglia il codice sorgente

Merge branch 'feature/eta_forum3_chart_classify' into debug

xyxie 2 mesi fa
parent
commit
c4e4f0896d
1 ha cambiato i file con 3 aggiunte e 11 eliminazioni
  1. 3 11
      models/data_manage/chart_classify.go

+ 3 - 11
models/data_manage/chart_classify.go

@@ -604,10 +604,6 @@ func GetChartClassifyIdListByAdminId(adminId, source int) (chartClassifyIdList [
 
 // GetChartClassifyAndInfoByParentId
 func GetChartClassifyAndInfoByParentId(parentId int, isSelected int) (items []*ChartClassifyItems, err error) {
-	where := ""
-	if isSelected == utils.ChartClassifyIsSelected {
-		where = " AND is_selected = 1"
-	}
 	sql := ` SELECT
 	0 AS chart_info_id,
 	chart_classify_id,
@@ -634,7 +630,7 @@ func GetChartClassifyAndInfoByParentId(parentId int, isSelected int) (items []*C
 FROM
 	chart_classify 
 WHERE
-	parent_id = ? and source = 1` + where + ` UNION ALL
+	parent_id = ? and source = 1 AND is_selected = ?  UNION ALL
 SELECT
 	chart_info_id,
 	chart_classify_id,
@@ -665,16 +661,12 @@ WHERE
 ORDER BY
 	sort ASC,
 	chart_classify_id ASC`
-	err = global.DbMap[utils.DbNameIndex].Raw(sql, parentId, parentId).Find(&items).Error
+	err = global.DbMap[utils.DbNameIndex].Raw(sql, parentId, parentId, isSelected).Find(&items).Error
 	return
 }
 
 // GetChartClassifyAndInfoByParentId
 func GetChartClassifyAndInfoByParentIdForMe(parentId, adminId, isSelected int) (items []*ChartClassifyItems, err error) {
-	where := ""
-	if isSelected == utils.ChartClassifyIsSelected {
-		where = " AND is_selected = 1"
-	}
 	sql := ` SELECT
 	0 AS chart_info_id,
 	chart_classify_id,
@@ -693,7 +685,7 @@ func GetChartClassifyAndInfoByParentIdForMe(parentId, adminId, isSelected int) (
 FROM
 	chart_classify 
 WHERE
-	parent_id = ? and source = 1` + where + ` UNION ALL
+	parent_id = ? and source = 1 AND is_selected = ? UNION ALL
 SELECT
 	chart_info_id,
 	chart_classify_id,