qixiaoning
2025-08-08 ef51da5404827e826e979ad614950a9e0192f4c6
system-service/controllers/dictionary.go
@@ -8,7 +8,7 @@
   "basic.com/valib/bhomeclient.git"
   "basic.com/valib/bhomedbapi.git"
   "basic.com/valib/logger.git"
   "github.com/satori/go.uuid"
   uuid "github.com/satori/go.uuid"
)
type DictionaryController struct {
@@ -25,6 +25,7 @@
}
type DicList []DicWithChildren
func (dl DicList) Len()int {
   return len(dl)
}
@@ -70,7 +71,7 @@
   resMap := make(map[string]DicList, 0)
   wg := &sync.WaitGroup{}
   wg.Add(4)
   wg.Add(2)
   go func() {
      defer wg.Done()
      for _, dic := range allDics {
@@ -102,47 +103,47 @@
         }
      }
   }()
   //人员底库
   personTableList := make(DicList, 0)
   var tableApi bhomedbapi.DbTableApi
   go func() {
      defer wg.Done()
      personTables, dtErr := tableApi.FindAllDbTablesByType("0", "person")
      if dtErr == nil && personTables != nil {
         for idx, t := range personTables {
            dwc := DicWithChildren{}
            dwc.Dictionary = models.Dictionary{
               Value: t.Id,
               Name:  t.TableName,
               Sort:  idx + 1,
            }
            personTableList = append(personTableList, dwc)
         }
      }
   }()
   // 车辆底库
   carTableList := make(DicList, 0)
   go func() {
      defer wg.Done()
      carTables, _ := tableApi.FindAllDbTablesByType("0", "car")
      if carTables != nil {
         for idx, t := range carTables {
            dwc := DicWithChildren{}
            dwc.Dictionary = models.Dictionary{
               Value: t.Id,
               Name:  t.TableName,
               Sort:  idx + 1,
            }
            carTableList = append(carTableList, dwc)
         }
      }
   }()
   // //人员底库
   // personTableList := make(DicList, 0)
   // var tableApi bhomedbapi.DbTableApi
   // go func() {
   //    defer wg.Done()
   //    personTables, dtErr := tableApi.FindAllDbTablesByType("0", "person")
   //    if dtErr == nil && personTables != nil {
   //       for idx, t := range personTables {
   //          dwc := DicWithChildren{}
   //          dwc.Dictionary = models.Dictionary{
   //             Value: t.Id,
   //             Name:  t.TableName,
   //             Sort:  idx + 1,
   //          }
   //          personTableList = append(personTableList, dwc)
   //       }
   //    }
   // }()
   // // 车辆底库
   // carTableList := make(DicList, 0)
   // go func() {
   //    defer wg.Done()
   //    carTables, _ := tableApi.FindAllDbTablesByType("0", "car")
   //    if carTables != nil {
   //       for idx, t := range carTables {
   //          dwc := DicWithChildren{}
   //          dwc.Dictionary = models.Dictionary{
   //             Value: t.Id,
   //             Name:  t.TableName,
   //             Sort:  idx + 1,
   //          }
   //          carTableList = append(carTableList, dwc)
   //       }
   //    }
   // }()
   wg.Wait()
   resMap["time_rule"] = timeList
   resMap["compareBase"] = personTableList
   resMap["compareCarBase"] = carTableList
   // resMap["compareBase"] = personTableList
   // resMap["compareCarBase"] = carTableList
   for k, dList := range resMap {
      v := dList
@@ -187,7 +188,6 @@
      return &bhomeclient.Reply{ Msg: "查询失败"}
   }
}
// @Summary 根据type查找字典列表
// @Description  根据type查找字典列表