Browse Source

no message

xingzai 7 months ago
parent
commit
dcd3a22a28
2 changed files with 12 additions and 4 deletions
  1. 9 1
      controllers/cygx/rai_serve.go
  2. 3 3
      models/cygx/rai_serve_bill.go

+ 9 - 1
controllers/cygx/rai_serve.go

@@ -71,8 +71,16 @@ func (this *RaiServeCoAntroller) SearchTag() {
 		br.Msg = "请输入搜索关键词"
 		return
 	}
+
+	keyWordSlice := strings.Split(keyWord, ",")
+	var conditionindustrial string
+	var conditionsubject string
+	for _, v := range keyWordSlice {
+		conditionindustrial += ` OR i.industry_name LIKE '%` + v + `%' `
+		conditionsubject += ` OR s.subject_name LIKE  '%` + v + `%' `
+	}
 	resp := new(cygx.RaiServeTagListResp)
-	list, err := cygx.GetRaiServeSearchTagRespList(keyWord)
+	list, err := cygx.GetRaiServeSearchTagRespList(keyWord, conditionindustrial, conditionsubject)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()

+ 3 - 3
models/cygx/rai_serve_bill.go

@@ -51,7 +51,7 @@ type RaiServeCoverageRateResp struct {
 }
 
 // 服务类型列表
-func GetRaiServeSearchTagRespList(keywords string) (items []*RaiServeTagResp, err error) {
+func GetRaiServeSearchTagRespList(keywords, conditionindustrial, conditionsubject string) (items []*RaiServeTagResp, err error) {
 	o := orm.NewOrmUsingDB("hz_cygx")
 	sql := `SELECT
 			1 AS tag_type,
@@ -63,7 +63,7 @@ func GetRaiServeSearchTagRespList(keywords string) (items []*RaiServeTagResp, er
 		WHERE
 			1 = 1 
 			AND i.chart_permission_id IN ( 19, 20, 21, 22 ) 
-			AND i.industry_name LIKE '%` + keywords + `%' UNION ALL
+			AND  (i.industry_name LIKE '%` + keywords + `%' ` + conditionindustrial + ` ) UNION ALL
 		SELECT
 			2 AS tag_type,
 			s.industrial_subject_id AS tag_id,
@@ -75,7 +75,7 @@ func GetRaiServeSearchTagRespList(keywords string) (items []*RaiServeTagResp, er
 		WHERE
 			1 = 1 
 			AND i.chart_permission_id IN ( 19, 20, 21, 22 ) 
-			AND s.subject_name LIKE  '%` + keywords + `%'
+			AND ( s.subject_name LIKE  '%` + keywords + `%' ` + conditionsubject + ` ) 
 		ORDER BY
 			create_time ASC `
 	_, err = o.Raw(sql).QueryRows(&items)