|
|
@@ -1620,3 +1620,49 @@ func (r *THJUserLevelInfo) Get() (err error) {
|
|
|
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// Spotgoodsprice 现货市价
|
|
|
+type Spotgoodsprice struct {
|
|
|
+ WRSTANDARDID int64 `json:"wrstandardid" xorm:"WRSTANDARDID"` // 现货商品ID(通用则为0)
|
|
|
+ WRSTANDARDCODE string `json:"wrstandardcode" xorm:"WRSTANDARDCODE"` // 现货商品代码
|
|
|
+ WRSTANDARDNAME string `json:"wrstandardname" xorm:"WRSTANDARDNAME"` // 现货商品名称
|
|
|
+ SPOTGOODSPRICE float64 `json:"spotgoodsprice" xorm:"SPOTGOODSPRICE"` // 当前价格
|
|
|
+ PRESPOTGOODSPRICE float64 `json:"prespotgoodsprice" xorm:"PRESPOTGOODSPRICE"` // 上日价格
|
|
|
+ TRADEDATE string `json:"tradedate" xorm:"TRADEDATE"` // 交易日(yyyyMMdd)
|
|
|
+
|
|
|
+ PageEx `xorm:"extends"` // 页码信息
|
|
|
+}
|
|
|
+
|
|
|
+func (r *Spotgoodsprice) calc() {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func (r *Spotgoodsprice) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = `
|
|
|
+ select
|
|
|
+ wr.WRSTANDARDID,
|
|
|
+ wr.WRSTANDARDCODE,
|
|
|
+ wr.wrstandardname,
|
|
|
+ t.prespotgoodsprice,
|
|
|
+ t.spotgoodsprice,
|
|
|
+ to_char(to_date(t.TRADEDATE, 'yyyymmdd'), 'yyyy-mm-dd') TRADEDATE
|
|
|
+ from ERMCP_SpotGoodsPrice t
|
|
|
+ left join wrstandard wr
|
|
|
+ on t.wrstandardid = wr.wrstandardid
|
|
|
+ order by wr.wrstandardname desc
|
|
|
+`
|
|
|
+
|
|
|
+ sqlId.Page(r.Page, r.PageSize)
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+func (r *Spotgoodsprice) GetDataByPage() (interface{}, error, int, int, int) {
|
|
|
+ sData := make([]Spotgoodsprice, 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
|
|
|
+}
|