Parcourir la source

行情买卖大厅增过品牌和年份过滤

zou.yingbin il y a 3 ans
Parent
commit
ace586e906
5 fichiers modifiés avec 66 ajouts et 2 suppressions
  1. 2 0
      controllers/wrTrade2/qryWrTrade.go
  2. 12 0
      docs/docs.go
  3. 12 0
      docs/swagger.json
  4. 8 0
      docs/swagger.yaml
  5. 32 2
      models/wrTrade2.go

+ 2 - 0
controllers/wrTrade2/qryWrTrade.go

@@ -27,6 +27,8 @@ import (
 // @Param warehouseid query int false "仓库id(筛选条件)"
 // @Param deliverygoodsid query int false "品种id"
 // @Param wrstandardid query int false "品类id"
+// @Param brandid query int false "品牌id(dgfactoryitemid)"
+// @Param yearsid query int false "年份id(dgfactoryitemid)"
 // @Param wrfactortypeid query int false "仓单要素id"
 // @Param deliverymonth query string false "交收月(yyyy-mm) 仓单预售填写"
 // @Success 200 {array} models.WrOrderQuote

+ 12 - 0
docs/docs.go

@@ -12324,6 +12324,18 @@ var doc = `{
                     },
                     {
                         "type": "integer",
+                        "description": "品牌id(dgfactoryitemid)",
+                        "name": "brandid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "年份id(dgfactoryitemid)",
+                        "name": "yearsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
                         "description": "仓单要素id",
                         "name": "wrfactortypeid",
                         "in": "query"

+ 12 - 0
docs/swagger.json

@@ -12309,6 +12309,18 @@
                     },
                     {
                         "type": "integer",
+                        "description": "品牌id(dgfactoryitemid)",
+                        "name": "brandid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "年份id(dgfactoryitemid)",
+                        "name": "yearsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
                         "description": "仓单要素id",
                         "name": "wrfactortypeid",
                         "in": "query"

+ 8 - 0
docs/swagger.yaml

@@ -27549,6 +27549,14 @@ paths:
         in: query
         name: wrstandardid
         type: integer
+      - description: 品牌id(dgfactoryitemid)
+        in: query
+        name: brandid
+        type: integer
+      - description: 年份id(dgfactoryitemid)
+        in: query
+        name: yearsid
+        type: integer
       - description: 仓单要素id
         in: query
         name: wrfactortypeid

+ 32 - 2
models/wrTrade2.go

@@ -50,6 +50,8 @@ type WrOrderQuote struct {
 	MarketId    int32  `json:"-" form:"marketid"`    // 市场id
 	BRANDNAME   string `json:"-" form:"brandname"`   // 品牌名称
 	DGITEMNAME  string `json:"-" form:"dgitemname"`  // 筛选项
+	BrandId     int    `json:"-" form:"brandid"`     // 品牌id
+	YearsId     int    `json:"-" form:"yearsid"`     // 年份id
 }
 
 func (r *WrOrderQuote) calc() {
@@ -151,7 +153,21 @@ func (r *WrOrderQuote) buildSqlFixedPrice() string {
 	if d, ok := r.ftItemName(); ok {
 		param2.AndLikes("w.wrfactortypename", d...)
 	}
-	param2.AndEx("w.wrstandardid", r.WRSTANDARDID, r.WRSTANDARDID > 0)
+	//指定品类id
+	if r.WRSTANDARDID > 0 {
+		param2.AndEx("w.wrstandardid", r.WRSTANDARDID, r.WRSTANDARDID > 0)
+	} else {
+		//品牌过滤
+		if r.BrandId > 0 {
+			param2.JoinFormat(" and w.WRSTANDARDID in(select WRSTANDARDID from WRStandardFactoryItem t "+
+				"where dgfactoryitemtypeid = 100 and t.dgfactoryitemid=%d)", r.BrandId)
+		}
+		//年份过滤
+		if r.YearsId > 0 {
+			param2.JoinFormat(" and w.WRSTANDARDID in(select WRSTANDARDID from WRStandardFactoryItem t "+
+				"where dgfactoryitemtypeid = 101 and t.dgfactoryitemid=%d)", r.YearsId)
+		}
+	}
 	param2.AndEx("w.warehouseid", r.WAREHOUSEID, r.WAREHOUSEID > 0)
 	param2.AndEx("w.deliverygoodsid", r.DELIVERYGOODSID, r.DELIVERYGOODSID > 0)
 	sqlId.FormatParam(param.String(), param.String(), param2.String())
@@ -262,7 +278,21 @@ func (r *WrOrderQuote) buildSqlPriceMove() string {
 	if d, ok := r.ftItemName(); ok {
 		param2.AndLikes("w.wrfactortypename", d...)
 	}
-	param2.AndEx("w.wrstandardid", r.WRSTANDARDID, r.WRSTANDARDID > 0)
+	//指定品类id
+	if r.WRSTANDARDID > 0 {
+		param2.AndEx("w.wrstandardid", r.WRSTANDARDID, r.WRSTANDARDID > 0)
+	} else {
+		//品牌过滤
+		if r.BrandId > 0 {
+			param2.JoinFormat(" and w.WRSTANDARDID in(select WRSTANDARDID from WRStandardFactoryItem t "+
+				"where dgfactoryitemtypeid = 100 and t.dgfactoryitemid=%d)", r.BrandId)
+		}
+		//年份过滤
+		if r.YearsId > 0 {
+			param2.JoinFormat(" and w.WRSTANDARDID in(select WRSTANDARDID from WRStandardFactoryItem t "+
+				"where dgfactoryitemtypeid = 101 and t.dgfactoryitemid=%d)", r.YearsId)
+		}
+	}
 	param2.AndEx("w.warehouseid", r.WAREHOUSEID, r.WAREHOUSEID > 0)
 	param2.AndEx("w.deliverygoodsid", r.DELIVERYGOODSID, r.DELIVERYGOODSID > 0)
 	sqlId.FormatParam(param.String(), param.String(), param2.String())