Jelajahi Sumber

默认值处理

WH01243 7 bulan lalu
induk
melakukan
e9670f322d
1 mengubah file dengan 21 tambahan dan 8 penghapusan
  1. 21 8
      jyBXCore/rpc/service/operator.go

+ 21 - 8
jyBXCore/rpc/service/operator.go

@@ -800,26 +800,26 @@ func SearchList(operator Operator) (int64, *[]map[string]interface{}, int64) {
 	if operator.Tag == 0 {
 		if operator.Order == 0 {
 			orderStr = `{"publishtime":{"order":"desc"}}`
-			mysqlOrderStr = ` order by   publishtime desc`
+			mysqlOrderStr = ` order by    a.publishtime desc`
 		} else {
 			orderStr = `{"publishtime":{"order":"asc"}}`
-			mysqlOrderStr = ` order by   publishtime asc`
+			mysqlOrderStr = ` order by    a.publishtime asc`
 		}
 	} else if operator.Tag == 1 {
 		if operator.Order == 0 {
 			orderStr = `{"publishtime":{"order":"desc"}}`
-			mysqlOrderStr = ` order by   publishtime desc`
+			mysqlOrderStr = ` order by    a.publishtime desc`
 		} else {
 			orderStr = `{"expurasingtime":{"order":"asc"}}`
-			mysqlOrderStr = ` order by   expurasingtime asc`
+			mysqlOrderStr = ` order by    a.expurasingtime asc`
 		}
 	} else if operator.Tag == 2 {
 		if operator.Order == 0 {
 			orderStr = `{"publishtime":{"order":"desc"}}`
-			mysqlOrderStr = ` order by   publishtime desc`
+			mysqlOrderStr = ` order by    a.publishtime desc`
 		} else {
 			orderStr = `{"bidopentime":{"order":"asc"}}`
-			mysqlOrderStr = ` order by   bidopentime asc`
+			mysqlOrderStr = ` order by   a.bidopentime asc`
 		}
 	}
 	queryStr = fmt.Sprintf(query, strings.Join(mustArr, ","), strings.Join(filterArr, ","), start, operator.PageSize, orderStr)
@@ -834,20 +834,30 @@ func SearchList(operator Operator) (int64, *[]map[string]interface{}, int64) {
 	fmt.Println("时差", end1-start1)
 	if len(*data) > 0 {
 		//查询tidb真实数据
-		idArr := []interface{}{}
+		idArr := []interface{}{gconv.String(operator.EntId)}
 		wh := []string{}
 		for _, v := range *data {
 			id := gconv.String(v["id"])
 			idArr = append(idArr, id)
 			wh = append(wh, "?")
 		}
-		sqlStr := fmt.Sprintf(`select  * from customer_data where   id in (%s) %s `, strings.Join(wh, ","), mysqlOrderStr)
+		sqlStr := fmt.Sprintf(` SELECT
+			a.*,b.encrypt_id
+		FROM
+			customer_data a
+			LEFT JOIN customer_data_yys_project_winner b    
+			on   a.eid=? 
+		and   a.projectId =b.projectId 
+		and  a.s_winner=b.winner_name
+		where   a.id in (%s)                  
+		 %s `, strings.Join(wh, ","), mysqlOrderStr)
 		fmt.Println(sqlStr, idArr)
 		data = IC.BiMysql.SelectBySql(sqlStr,
 			idArr...)
 		if data != nil && len(*data) > 0 {
 			_, winnerMap := getConfiguration("运营商中标标签", "winner_tag", operator.EntId)
 			_, industryMap := getConfiguration("行业", "industry", operator.EntId)
+			//中标单位处理
 			for i, v := range *data {
 				(*data)[i]["publishtime"] = TimeHandle(gconv.String(v["publishtime"]))
 				(*data)[i]["bidopentime"] = TimeHandle(gconv.String(v["bidopentime"]))
@@ -867,6 +877,9 @@ func SearchList(operator Operator) (int64, *[]map[string]interface{}, int64) {
 
 }
 func TimeHandle(timeStr string) int64 {
+	if timeStr == "" {
+		return 0
+	}
 	// 定义一个布局,需要与时间字符串格式相匹配
 	layout := "2006-01-02 15:04:05"
 	// 使用Parse将字符串转换为time.Time类型