Browse Source

fix: 语音识别筛选

hsun 11 months ago
parent
commit
3c7f604a40

+ 23 - 6
controllers/speech_recognition/speech_recognition.go

@@ -628,9 +628,11 @@ func (this *SpeechRecognitionController) SaveTag() {
 // @Param   FileName  query  string  false  "文件名称"
 // @Param   StartTime  query  string  false  "开始时间"
 // @Param   EndTime  query  string  false  "结束时间"
-// @Param   CreateUserId  query  int  false  "创建人ID"
+// @Param   CreateUserIds  query  string  false  "创建人ID"
 // @Param   TagId  query  int  false  "标签ID"
+// @Param   TagIds  query  string  false  "标签ID"
 // @Param   MenuId  query  int  false  "目录ID"
+// @Param   IsTagMenu  query  bool  false  "是否为标签目录"
 // @Success 200 {object} speech_recognition.SpeechRecognitionListResp
 // @router /list [get]
 func (this *SpeechRecognitionController) List() {
@@ -683,9 +685,24 @@ func (this *SpeechRecognitionController) List() {
 			cond += fmt.Sprintf(` AND (%s BETWEEN ? AND ?)`, speech_recognition.SpeechRecognitionCols.CreateTime)
 			pars = append(pars, st, ed)
 		}
-		if params.CreateUserId > 0 {
-			cond += fmt.Sprintf(` AND %s = ?`, speech_recognition.SpeechRecognitionCols.SysUserId)
-			pars = append(pars, params.CreateUserId)
+		if params.CreateUserId != "" {
+			userArr := strings.Split(strings.TrimSpace(params.CreateUserId), ",")
+			if len(userArr) > 0 {
+				userIds := make([]int, 0)
+				for _, v := range userArr {
+					t, _ := strconv.Atoi(v)
+					userIds = append(userIds, t)
+				}
+				if len(userIds) == 0 {
+					br.Data = dataResp
+					br.Ret = 200
+					br.Success = true
+					br.Msg = "获取成功"
+					return
+				}
+				cond += fmt.Sprintf(` AND %s IN (%s)`, speech_recognition.SpeechRecognitionCols.SysUserId, utils.GetOrmInReplace(len(userIds)))
+				pars = append(pars, userIds)
+			}
 		}
 		// 语音识别目录-筛选子目录集合
 		if params.MenuId > 0 && !params.IsTagMenu {
@@ -919,7 +936,7 @@ func (this *SpeechRecognitionController) Detail() {
 // @Description 导出内容
 // @Param	request	body speech_recognition.SpeechRecognitionContentExportReq true "type json string"
 // @Success 200 string "操作成功"
-// @router /export [post]
+// @router /export [get]
 func (this *SpeechRecognitionController) Export() {
 	br := new(models.BaseResponse).Init()
 	defer func() {
@@ -937,7 +954,7 @@ func (this *SpeechRecognitionController) Export() {
 		return
 	}
 	var req speech_recognition.SpeechRecognitionContentExportReq
-	if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
+	if e := this.ParseForm(req); e != nil {
 		br.Msg = "参数有误"
 		br.ErrMsg = "参数解析失败, Err: " + e.Error()
 		return

+ 1 - 1
models/speech_recognition/speech_recognition.go

@@ -426,7 +426,7 @@ type SpeechRecognitionListReq struct {
 	FileName     string `form:"FileName" description:"文件名称"`
 	StartTime    string `form:"StartTime" description:"开始时间"`
 	EndTime      string `form:"EndTime" description:"结束时间"`
-	CreateUserId int    `form:"CreateUserId" description:"创建人ID"`
+	CreateUserId string `form:"CreateUserId" description:"创建人IDs"`
 	TagId        int    `form:"TagId" description:"标签ID"`
 	TagIds       string `form:"TagIds" description:"标签IDs, 英文逗号分隔"`
 	MenuId       int    `form:"MenuId" description:"目录ID"`

+ 1 - 1
routers/commentsRouter.go

@@ -6068,7 +6068,7 @@ func init() {
         beego.ControllerComments{
             Method: "Export",
             Router: `/export`,
-            AllowHTTPMethods: []string{"post"},
+            AllowHTTPMethods: []string{"get"},
             MethodParams: param.Make(),
             Filters: nil,
             Params: nil})