ziwen 1 year ago
parent
commit
db6b0b9f29
3 changed files with 26 additions and 1 deletions
  1. 17 0
      controllers/help_doc/classify.go
  2. 2 1
      models/help_doc/classify.go
  3. 7 0
      models/help_doc/help_doc.go

+ 17 - 0
controllers/help_doc/classify.go

@@ -38,12 +38,29 @@ func (this *HelpDocClassifyController) ListClassify() {
 		return
 	}
 
+	docAll, err := help_doc.GetAllHelpDoc()
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+
+	classifyMap := make(map[int]int,0)
+	for _, v := range docAll {
+		classifyMap[v.ClassifyId] = 1
+	}
+
 	classifyAll, err := help_doc.GetHelpDocClassifyAll(keyWord)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
+	for k := range classifyAll {
+		_,ok := classifyMap[classifyAll[k].ClassifyId]
+		classifyAll[k].Disabled = ok
+	}
+
 	rootListAll := make([]help_doc.HelpDocClassifyItems, 0)
 	rootListAll = rootList
 	nodeAll := make([]*help_doc.HelpDocClassifyItems, 0)

+ 2 - 1
models/help_doc/classify.go

@@ -98,6 +98,7 @@ type HelpDocClassifyItems struct {
 	SysUserId          int    `description:"创建人id"`
 	SysUserRealName    string `description:"创建人姓名"`
 	VisibleBusinessIds string
+	Disabled           bool `description:"是否能选 true不能 false可以"`
 	Children           []*HelpDocClassifyItems
 }
 
@@ -237,4 +238,4 @@ func GetAllHelpDocClassify() (items []*HelpDocClassifyItems, err error) {
 	sql := `SELECT * FROM help_doc_classify `
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
-}
+}

+ 7 - 0
models/help_doc/help_doc.go

@@ -183,3 +183,10 @@ func DeleteHelpDoc(reportIds int) (err error) {
 	_, err = o.Raw(sql, reportIds).Exec()
 	return
 }
+
+func GetAllHelpDoc() (items []*HelpDocItem, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM help_doc `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}