|
|
@@ -837,7 +837,9 @@ type MyBuyOrder struct {
|
|
|
WAREHOUSEIDS string `json:"warehouseids" xorm:"WAREHOUSEIDS"` // 仓库ID - 多个, 逗号分隔
|
|
|
MARKETID int32 `json:"marketid" xorm:"MARKETID"` // 市场ID
|
|
|
|
|
|
- IsHis bool `json:"-" form:"ishis"` // 是否历史查询
|
|
|
+ IsHis bool `json:"-" form:"ishis"` // 是否历史查询
|
|
|
+ BeginDate string `json:"-" form:"begindate"` // 开始交易日
|
|
|
+ EndDate string `json:"-" form:"enddate"` // 结束交易日
|
|
|
|
|
|
PageEx `xorm:"extends"` // 页码信息
|
|
|
}
|
|
|
@@ -887,6 +889,9 @@ func (r *MyBuyOrder) buildSql_His() string {
|
|
|
}
|
|
|
sqlId.AndLike("q.ZSALLPROPERTIES", r.ZSALLPROPERTIES)
|
|
|
sqlId.AndEx("t.WRTRADEORDERID", r.WRTRADEORDERID, r.WRTRADEORDERID != "")
|
|
|
+ if r.BeginDate != "" && r.EndDate != "" {
|
|
|
+ sqlId.JoinFormat(" AND (t.TRADEDATE >= '%v' AND t.TRADEDATE <= '%v')", r.BeginDate, r.EndDate)
|
|
|
+ }
|
|
|
sqlId.OrderByDesc("t.WRTRADEORDERID")
|
|
|
sqlId.Page(r.Page, r.PageSize)
|
|
|
return sqlId.String()
|
|
|
@@ -1015,7 +1020,9 @@ type MySellOrder struct {
|
|
|
TOTALQTY float64 `json:"totalqty" xorm:"TOTALQTY"` // 总重量
|
|
|
SELLEDQTY float64 `json:"selledqty" xorm:"SELLEDQTY"` // 成交重量
|
|
|
|
|
|
- IsHis bool `json:"-" form:"ishis"` // 是否历史查询
|
|
|
+ IsHis bool `json:"-" form:"ishis"` // 是否历史查询
|
|
|
+ BeginDate string `json:"-" form:"begindate"` // 开始交易日
|
|
|
+ EndDate string `json:"-" form:"enddate"` // 结束交易日
|
|
|
|
|
|
PageEx `xorm:"extends"` // 页码信息
|
|
|
}
|
|
|
@@ -1249,6 +1256,9 @@ func (r *MySellOrder) buildSql_His() string {
|
|
|
}
|
|
|
sqlId.AndLike("q.ZSALLPROPERTIES", r.ZSALLPROPERTIES)
|
|
|
sqlId.AndEx("t.WRTRADEORDERID", r.WRTRADEORDERID, r.WRTRADEORDERID != "")
|
|
|
+ if r.BeginDate != "" && r.EndDate != "" {
|
|
|
+ sqlId.JoinFormat(" AND (t.TRADEDATE >= '%v' AND t.TRADEDATE <= '%v')", r.BeginDate, r.EndDate)
|
|
|
+ }
|
|
|
sqlId.OrderByDesc("t.WRTRADEORDERID")
|
|
|
sqlId.Page(r.Page, r.PageSize)
|
|
|
return sqlId.String()
|
|
|
@@ -1864,6 +1874,7 @@ type MyPerformanc struct {
|
|
|
|
|
|
USERID int64 `json:"-" form:"userid" binding:"required"` // 用户ID
|
|
|
BuyOrSell int64 `json:"buyorsell" form:"buyorsell"` // 方向 - 0:买 1:卖
|
|
|
+ IsHis bool `json:"-" form:"ishis"` // 是否历史查询
|
|
|
BeginDate string `json:"-" form:"begindate"` // 开始交易日
|
|
|
EndDate string `json:"-" form:"enddate"` // 结束交易日
|
|
|
|
|
|
@@ -2020,7 +2031,7 @@ func (r *MyPerformanc) buildSql_His() string {
|
|
|
func (r *MyPerformanc) GetDataByPage() (interface{}, error, int, int, int) {
|
|
|
sData := make([]MyPerformanc, 0)
|
|
|
sql := ""
|
|
|
- if r.BeginDate != "" && r.EndDate != "" {
|
|
|
+ if r.IsHis {
|
|
|
sql = r.buildSql_His()
|
|
|
} else {
|
|
|
sql = r.buildSql()
|
|
|
@@ -2033,3 +2044,114 @@ func (r *MyPerformanc) GetDataByPage() (interface{}, error, int, int, int) {
|
|
|
}
|
|
|
return sData, err, r.Page, r.PageSize, total
|
|
|
}
|
|
|
+
|
|
|
+// MyFavorite 我的收藏
|
|
|
+type MyFavorite struct {
|
|
|
+ USERID int64 `json:"userid" xorm:"USERID" form:"userid" binding:"required"` // 用户ID
|
|
|
+ WRTRADEORDERID string `json:"wrtradeorderid" xorm:"WRTRADEORDERID1"` // 仓单贸易委托单ID(320+Unix秒时间戳(10位)+xxxxxx)
|
|
|
+ BUYORSELL int32 `json:"buyorsell" xorm:"BUYORSELL"` // 买卖 - 0:买 1:卖
|
|
|
+ WRFACTORTYPEID string `json:"wrfactortypeid" xorm:"WRFACTORTYPEID1"` // 仓单要素类型ID/商品ID(77)
|
|
|
+ WRSTANDARDID int64 `json:"wrstandardid" xorm:"WRSTANDARDID"` // 现货商品ID(自增 SEQ_GOODS 确保不重复)
|
|
|
+ FAVORITESTATUS int32 `json:"favoritestatus" xorm:"FAVORITESTATUS"` // 收藏状态 - 1:正常 2:失效
|
|
|
+ MARKETID int32 `json:"marketid" xorm:"MARKETID"` // 市场ID
|
|
|
+
|
|
|
+ ZSCATEGORYDISPLAY string `json:"zscategorydisplay" xorm:"ZSCATEGORYDISPLAY"` //
|
|
|
+ ZSCURRENCYTYPEDISPLAY string `json:"zscurrencytypedisplay" xorm:"ZSCURRENCYTYPEDISPLAY"` //
|
|
|
+ ZSCURRENCYTYPEDISPLAYUNIT string `json:"zscurrencytypedisplayunit" xorm:"ZSCURRENCYTYPEDISPLAYUNIT"` //
|
|
|
+ WAREHOUSENAMEDISPLAY string `json:"warehousenamedisplay" xorm:"WAREHOUSENAMEDISPLAY"` //
|
|
|
+ ZSSHAPETYPEDISPLAY string `json:"zsshapetypedisplay" xorm:"ZSSHAPETYPEDISPLAY"` //
|
|
|
+ ZSCOLORTYPE1DISPLAY string `json:"zscolortype1display" xorm:"ZSCOLORTYPE1DISPLAY"` //
|
|
|
+ ZSCOLORTYPE2DISPLAY string `json:"zscolortype2display" xorm:"ZSCOLORTYPE2DISPLAY"` //
|
|
|
+ ZSCLARITYTYPE1DISPLAY string `json:"zsclaritytype1display" xorm:"ZSCLARITYTYPE1DISPLAY"` //
|
|
|
+ ZSCLARITYTYPE2DISPLAY string `json:"zsclaritytype2display" xorm:"ZSCLARITYTYPE2DISPLAY"` //
|
|
|
+ ZSCUTTYPE1DISPLAY string `json:"zscuttype1display" xorm:"ZSCUTTYPE1DISPLAY"` //
|
|
|
+ ZSCUTTYPE2DISPLAY string `json:"zscuttype2display" xorm:"ZSCUTTYPE2DISPLAY"` //
|
|
|
+ ZSSYMMETRYTYPE1DISPLAY string `json:"zssymmetrytype1display" xorm:"ZSSYMMETRYTYPE1DISPLAY"` //
|
|
|
+ ZSSYMMETRYTYPE2DISPLAY string `json:"zssymmetrytype2display" xorm:"ZSSYMMETRYTYPE2DISPLAY"` //
|
|
|
+ ZSPOLISHTYPE1DISPLAY string `json:"zspolishtype1display" xorm:"ZSPOLISHTYPE1DISPLAY"` //
|
|
|
+ ZSPOLISHTYPE2DISPLAY string `json:"zspolishtype2display" xorm:"ZSPOLISHTYPE2DISPLAY"` //
|
|
|
+ ZSFLUORESCENCETYPE1DISPLAY string `json:"zsfluorescencetype1display" xorm:"ZSFLUORESCENCETYPE1DISPLAY"` //
|
|
|
+ ZSFLUORESCENCETYPE2DISPLAY string `json:"zsfluorescencetype2display" xorm:"ZSFLUORESCENCETYPE2DISPLAY"` //
|
|
|
+ ZSCERTTYPEDISPLAY string `json:"zscerttypedisplay" xorm:"ZSCERTTYPEDISPLAY"` //
|
|
|
+ ZSCRYSTALTYPEDISPLAY string `json:"zscrystaltypedisplay" xorm:"ZSCRYSTALTYPEDISPLAY"` //
|
|
|
+ ZSSTYLETYPEDISPLAY string `json:"zsstyletypedisplay" xorm:"ZSSTYLETYPEDISPLAY"` //
|
|
|
+ ZSCZCOLOR1TYPEDISPLAY string `json:"zsczcolor1typedisplay" xorm:"ZSCZCOLOR1TYPEDISPLAY"` //
|
|
|
+ ZSCZCOLOR2TYPEDISPLAY string `json:"zsczcolor2typedisplay" xorm:"ZSCZCOLOR2TYPEDISPLAY"` //
|
|
|
+ ZSCZCOLOR3TYPEDISPLAY string `json:"zsczcolor3typedisplay" xorm:"ZSCZCOLOR3TYPEDISPLAY"` //
|
|
|
+ PRICE float64 `json:"price" xorm:"PRICE"` // 价格
|
|
|
+ PRICEPER string `json:"priceper" xorm:"PRICEPER"` // 克拉单价
|
|
|
+ SIZEDISPLAY string `json:"sizedisplay" xorm:"SIZEDISPLAY"` // 尺寸
|
|
|
+
|
|
|
+ PageEx `xorm:"extends"` // 页码信息
|
|
|
+
|
|
|
+ ZSCATEGORYS string `json:"-" form:"zscategorys"` // 钻石分类,格式: 1,2,3
|
|
|
+}
|
|
|
+
|
|
|
+func (r *MyFavorite) calc() {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func (r *MyFavorite) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = `
|
|
|
+ SELECT
|
|
|
+ t.USERID ,
|
|
|
+ to_char(t.WRTRADEORDERID) WRTRADEORDERID1,
|
|
|
+ t.BUYORSELL ,
|
|
|
+ to_char(t.WRFACTORTYPEID) WRFACTORTYPEID1,
|
|
|
+ t.WRSTANDARDID ,
|
|
|
+ t.FAVORITESTATUS,
|
|
|
+ t.MARKETID ,
|
|
|
+ q.ZSCATEGORYDISPLAY ,
|
|
|
+ q.ZSCURRENCYTYPEDISPLAY ,
|
|
|
+ q.ZSCURRENCYTYPEDISPLAYUNIT ,
|
|
|
+ q.WAREHOUSENAMEDISPLAY ,
|
|
|
+ q.ZSSHAPETYPEDISPLAY ,
|
|
|
+ q.ZSCOLORTYPE1DISPLAY ,
|
|
|
+ q.ZSCOLORTYPE2DISPLAY ,
|
|
|
+ q.ZSCLARITYTYPE1DISPLAY ,
|
|
|
+ q.ZSCLARITYTYPE2DISPLAY ,
|
|
|
+ q.ZSCUTTYPE1DISPLAY ,
|
|
|
+ q.ZSCUTTYPE2DISPLAY ,
|
|
|
+ q.ZSSYMMETRYTYPE1DISPLAY ,
|
|
|
+ q.ZSSYMMETRYTYPE2DISPLAY ,
|
|
|
+ q.ZSPOLISHTYPE1DISPLAY ,
|
|
|
+ q.ZSPOLISHTYPE2DISPLAY ,
|
|
|
+ q.ZSFLUORESCENCETYPE1DISPLAY,
|
|
|
+ q.ZSFLUORESCENCETYPE2DISPLAY,
|
|
|
+ q.ZSCERTTYPEDISPLAY ,
|
|
|
+ q.ZSCRYSTALTYPEDISPLAY ,
|
|
|
+ q.ZSSTYLETYPEDISPLAY ,
|
|
|
+ q.ZSCZCOLOR1TYPEDISPLAY ,
|
|
|
+ q.ZSCZCOLOR2TYPEDISPLAY ,
|
|
|
+ q.ZSCZCOLOR3TYPEDISPLAY ,
|
|
|
+ q.PRICE ,
|
|
|
+ q.PRICEPER ,
|
|
|
+ CASE WHEN
|
|
|
+ q.SIZE1 IS NOT NULL AND q.SIZE2 IS NOT NULL AND q.SIZE2 IS NOT NULL THEN q.SIZE1 || '*' || q.SIZE2 || '*' || q.SIZE3
|
|
|
+ ELSE q.SIZE1
|
|
|
+ END AS SIZEDISPLAY
|
|
|
+ FROM Wrtrade_Myfavorite t
|
|
|
+ LEFT JOIN view_GZ_WRStandard_Ex_Query q ON t.WRSTANDARDID = q.WRSTANDARDID
|
|
|
+ WHERE t.marketid=67201
|
|
|
+ `
|
|
|
+
|
|
|
+ sqlId.And("t.USERID", r.USERID)
|
|
|
+ if r.ZSCATEGORYS != "" {
|
|
|
+ sqlId.JoinFormat(" AND q.ZSCATEGORY in (%v)", r.ZSCATEGORYS)
|
|
|
+ }
|
|
|
+ sqlId.OrderByDesc("t.CREATETIME")
|
|
|
+
|
|
|
+ sqlId.Page(r.Page, r.PageSize)
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+func (r *MyFavorite) GetDataByPage() (interface{}, error, int, int, int) {
|
|
|
+ sData := make([]MyFavorite, 0)
|
|
|
+ err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
|
|
|
+ total := 0
|
|
|
+ for i := range sData {
|
|
|
+ sData[i].calc()
|
|
|
+ total = sData[i].Total
|
|
|
+ }
|
|
|
+ return sData, err, r.Page, r.PageSize, total
|
|
|
+}
|