Browse Source

no message

xingzai 7 months ago
parent
commit
734d08d829
2 changed files with 24 additions and 18 deletions
  1. 16 10
      controllers/cygx/rai_serve.go
  2. 8 8
      models/cygx/rai_serve_bill.go

+ 16 - 10
controllers/cygx/rai_serve.go

@@ -72,15 +72,15 @@ func (this *RaiServeCoAntroller) SearchTag() {
 		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 + `%' `
-	}
+	//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, conditionindustrial, conditionsubject)
+	list, err := cygx.GetRaiServeSearchTagRespList(keyWord)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
@@ -186,12 +186,18 @@ func (this *RaiServeCoAntroller) SearchTagCalendar() {
 			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 + `%' `
+		}
 		var permissionId []string
 		for _, v := range chartList {
 			permissionId = append(permissionId, strconv.Itoa(v.ChartPermissionId))
 		}
-		list, err = cygx.GetRaiServeSearchTagRespListBycharId(keyWord, strings.Join(permissionId, ","))
+		list, err = cygx.GetRaiServeSearchTagRespListBycharId(keyWord, strings.Join(permissionId, ","), conditionindustrial, conditionsubject)
 		if err != nil {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取数据失败,GetRaiServeSearchTagRespListBycharId Err:" + err.Error()

+ 8 - 8
models/cygx/rai_serve_bill.go

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