Jianghan 1 year ago
parent
commit
8890fb65da
1 changed files with 26 additions and 20 deletions
  1. 26 20
      api/internal/service/plistService.go

+ 26 - 20
api/internal/service/plistService.go

@@ -23,23 +23,24 @@ type ProjectData struct {
 }
 
 type ProjectEntry struct {
-	ProjectId   string   `ch:"project_id"`
-	ProjectName string   `ch:"project_name"`
-	Buyer       string   `ch:"buyer"`
-	BuyerId     string   `ch:"buyer_id"`
-	Winner      []string `ch:"winner"`
-	WinnerId    []string `ch:"winner_id"`
-	Area        string   `ch:"area"`
-	City        string   `ch:"city"`
-	District    string   `ch:"district"`
-	ZbTime      int64    `ch:"zbtime"`
-	EndTime     int64    `ch:"endtime"`
-	IsHandle    int      `json:"IsHandle"`
-	IsIgnore    int      `json:"IsIgnore"`
-	IsCreate    int      `json:"IsCreate"`
-	MyConn      bool     `json:"MyConn"`
-	ConnType    int      `json:"ConnType"`
-	HighSuccess bool     `json:"HighSuccess"`
+	ProjectId    string   `ch:"project_id"`
+	ProjectName  string   `ch:"project_name"`
+	BusinessType string   `ch:"business_type"`
+	Buyer        string   `ch:"buyer"`
+	BuyerId      string   `ch:"buyer_id"`
+	Winner       []string `ch:"winner"`
+	WinnerId     []string `ch:"winner_id"`
+	Area         string   `ch:"area"`
+	City         string   `ch:"city"`
+	District     string   `ch:"district"`
+	ZbTime       int64    `ch:"zbtime"`
+	EndTime      int64    `ch:"endtime"`
+	IsHandle     int      `json:"IsHandle"`
+	IsIgnore     int      `json:"IsIgnore"`
+	IsCreate     int      `json:"IsCreate"`
+	MyConn       bool     `json:"MyConn"`
+	ConnType     int      `json:"ConnType"`
+	HighSuccess  bool     `json:"HighSuccess"`
 }
 
 func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasNextPage bool, total int) {
@@ -197,9 +198,14 @@ func getQuerySql(req *types.ProjectListReq, isPage bool, buyerArr []string) (cou
 		}
 		querys = append(querys, fmt.Sprintf(" a.property_form in (%s) ", strings.Join(arr, ",")))
 	}
-	countSql = fmt.Sprintf("select count(1) from %s a where %s ", "information.transaction_info", strings.Join(querys, " and "))
-	findSql = "select a.project_id, a.project_name, a.buyer, a.buyer_id, a.winner, a.winner_id, a.area, a.city, a.district, a.zbtime, a.endtime "
-	findSql = fmt.Sprintf("%s from %s  a  where  %s ", findSql, "information.transaction_info", strings.Join(querys, " and "))
+	findSql = "select a.project_id, a.project_name, a.business_type, a.buyer, a.buyer_id, a.winner, a.winner_id, a.area, a.city, a.district, a.zbtime, a.endtime "
+	if len(querys) > 0 {
+		countSql = fmt.Sprintf("select count(1) from %s a where %s ", "information.transaction_info", strings.Join(querys, " and "))
+		findSql = fmt.Sprintf("%s from %s  a  where  %s ", findSql, "information.transaction_info", strings.Join(querys, " and "))
+	} else {
+		countSql = fmt.Sprintf("select count(1) from %s a ", "information.transaction_info")
+		findSql = fmt.Sprintf("%s from %s  a ", findSql, "information.transaction_info")
+	}
 	if isPage {
 		findSql += fmt.Sprintf(" limit %d,%d", (req.PageNum-1)*req.PageSize, req.PageSize)
 	}