浏览代码

fix:修改sql语句

duxin 3 年之前
父节点
当前提交
831b9260c0
共有 1 个文件被更改,包括 4 次插入5 次删除
  1. 4 5
      rpc/consumer/internal/logic/inforelatedlogic.go

+ 4 - 5
rpc/consumer/internal/logic/inforelatedlogic.go

@@ -1,14 +1,13 @@
 package logic
 
 import (
+	"app.yhyue.com/moapp/jyInfo/rpc/consumer/consumer"
+	"app.yhyue.com/moapp/jyInfo/rpc/consumer/internal/svc"
 	"app.yhyue.com/moapp/jyInfo/rpc/model"
 	"app.yhyue.com/moapp/jyInfo/rpc/util"
 	se "app.yhyue.com/moapp/jybase/encrypt"
 	"context"
 
-	"app.yhyue.com/moapp/jyInfo/rpc/consumer/consumer"
-	"app.yhyue.com/moapp/jyInfo/rpc/consumer/internal/svc"
-
 	mc "app.yhyue.com/moapp/jybase/common"
 	"github.com/zeromicro/go-zero/core/logx"
 )
@@ -36,10 +35,10 @@ func (l *InfoRelatedLogic) InfoRelated(in *consumer.UserIdReq) (*consumer.InfoRe
 	)
 	queryName = ` and type=` + mc.InterfaceToStr(in.MsgType)
 	if in.Match != "" {
-		queryName = ` and title LIKE '%` + in.Match + `%' `
+		queryName = queryName + ` and title LIKE '%` + in.Match + `%' `
 	}
 	if in.AppId != "" {
-		queryName = ` and app_id = ` + util.StrFormat(in.AppId)
+		queryName = queryName + ` and app_id = ` + util.StrFormat(in.AppId)
 	}
 	allData := model.Mysql.SelectBySql(`SELECT id,title from information WHERE user_id="` + in.UserId + `" and published=2 and is_del=1` + queryName + ` order by create_time desc limit 50`)
 	if allData == nil || len(*allData) == 0 {