| | |
| | | "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 { |
| | |
| | | } |
| | | |
| | | type DicList []DicWithChildren |
| | | |
| | | func (dl DicList) Len()int { |
| | | return len(dl) |
| | | } |
| | |
| | | resMap := make(map[string]DicList, 0) |
| | | |
| | | wg := &sync.WaitGroup{} |
| | | wg.Add(4) |
| | | wg.Add(2) |
| | | go func() { |
| | | defer wg.Done() |
| | | for _, dic := range allDics { |
| | |
| | | } |
| | | } |
| | | }() |
| | | //人员底库 |
| | | 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 |
| | |
| | | return &bhomeclient.Reply{ Msg: "查询失败"} |
| | | } |
| | | } |
| | | |
| | | |
| | | // @Summary 根据type查找字典列表 |
| | | // @Description 根据type查找字典列表 |