|
@@ -687,15 +687,79 @@ func (this *SpeechRecognitionController) List() {
|
|
|
cond += fmt.Sprintf(` AND %s = ?`, speech_recognition.SpeechRecognitionCols.SysUserId)
|
|
|
pars = append(pars, params.CreateUserId)
|
|
|
}
|
|
|
- if params.MenuId > 0 {
|
|
|
- cond += fmt.Sprintf(` AND %s = ?`, speech_recognition.SpeechRecognitionCols.MenuId)
|
|
|
- pars = append(pars, params.MenuId)
|
|
|
+ // 语音识别目录-筛选子目录集合
|
|
|
+ if params.MenuId > 0 && !params.IsTagMenu {
|
|
|
+ {
|
|
|
+ menuOb := new(speech_recognition.SpeechRecognitionMenu)
|
|
|
+ menus, e := menuOb.GetItemsByCondition(``, make([]interface{}, 0), []string{}, "")
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取语音识别目录列表失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ childIds := services.GetSpeechRecognitionMenuChildrenRecursive(menus, params.MenuId)
|
|
|
+ menuIds := make([]int, 0)
|
|
|
+ menuIds = append(menuIds, params.MenuId)
|
|
|
+ if len(childIds) > 0 {
|
|
|
+ menuIds = append(menuIds, childIds...)
|
|
|
+ }
|
|
|
+ cond += fmt.Sprintf(` AND %s IN (%s)`, speech_recognition.SpeechRecognitionCols.MenuId, utils.GetOrmInReplace(len(menuIds)))
|
|
|
+ pars = append(pars, menuIds)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 标签目录-筛选目录下所有标签
|
|
|
+ tagIds := make([]int, 0)
|
|
|
+ if params.MenuId > 0 && params.IsTagMenu {
|
|
|
+ {
|
|
|
+ menuOb := new(speech_recognition.SpeechRecognitionTagMenu)
|
|
|
+ menus, e := menuOb.GetItemsByCondition(``, make([]interface{}, 0), []string{}, "")
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取标签目录列表失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ childIds := services.GetSpeechRecognitionTagMenuChildrenRecursive(menus, params.MenuId)
|
|
|
+ menuIds := make([]int, 0)
|
|
|
+ menuIds = append(menuIds, params.MenuId)
|
|
|
+ if len(childIds) > 0 {
|
|
|
+ menuIds = append(menuIds, childIds...)
|
|
|
+ }
|
|
|
+ // 获取目录下所有标签
|
|
|
+ tagOb := new(speech_recognition.SpeechRecognitionTag)
|
|
|
+ ids, e := tagOb.GetTagIdsByMenuIds(menuIds)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "通过目录IDs获取标签IDs失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 此处查询无结果直接返回
|
|
|
+ if len(ids) == 0 {
|
|
|
+ br.Data = dataResp
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ tagIds = ids
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 标签筛选
|
|
|
- if params.TagId > 0 {
|
|
|
+ if params.TagId > 0 && params.TagIds == "" {
|
|
|
+ tagIds = append(tagIds, params.TagId)
|
|
|
+ }
|
|
|
+ if params.TagId <= 0 && params.TagIds != "" {
|
|
|
+ tagArr := strings.Split(params.TagIds, ",")
|
|
|
+ if len(tagArr) > 0 {
|
|
|
+ for _, v := range tagArr {
|
|
|
+ t, _ := strconv.Atoi(v)
|
|
|
+ tagIds = append(tagIds, t)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(tagIds) > 0 {
|
|
|
mappingOb := new(speech_recognition.SpeechRecognitionTagMapping)
|
|
|
- tagSpeechIds, e := mappingOb.GetSpeechIdsByTagId(params.TagId)
|
|
|
+ tagSpeechIds, e := mappingOb.GetSpeechIdsByTagIds(tagIds)
|
|
|
if e != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取标签关联语音识别失败, Err: " + e.Error()
|