|
|
@@ -960,3 +960,57 @@ func (r *THJTradeData) GetDataByPage() (interface{}, error, int, int, int) {
|
|
|
}
|
|
|
return sData, err, r.Page, r.PageSize, total
|
|
|
}
|
|
|
+
|
|
|
+// THJGoodsDetailReq 商品详情
|
|
|
+type THJGoodsDetailReq struct {
|
|
|
+ WRSTANDARDID int64 `form:"wrstandardid" binding:"required"` // 现货商品ID
|
|
|
+}
|
|
|
+
|
|
|
+// THJGoodsDetailRsp 商品详情
|
|
|
+type THJGoodsDetailRsp struct {
|
|
|
+ GoodsInfo THJWrstandardDetail_GoodsInfo `json:"goodsinfo"` // 商品信息
|
|
|
+ SpotGoodsPriceLogs []THJSpotGoodsPriceLog `json:"spotgoodspricelogs"` // 历史价格走势
|
|
|
+}
|
|
|
+
|
|
|
+func (r *THJGoodsDetailReq) GetTHJGoodsDetail() (rsp *THJGoodsDetailRsp, err error) {
|
|
|
+ engine := db.GetEngine()
|
|
|
+
|
|
|
+ rsp = new(THJGoodsDetailRsp)
|
|
|
+
|
|
|
+ // 采购商品信息
|
|
|
+ var goodsInfo THJWrstandardDetail_GoodsInfo
|
|
|
+ sql := fmt.Sprintf(`
|
|
|
+ select
|
|
|
+ t.WRSTANDARDID,
|
|
|
+ t.WRSTANDARDCODE,
|
|
|
+ t.WRSTANDARDNAME,
|
|
|
+ t.PICTUREURLS,
|
|
|
+ p.SPOTGOODSPRICE
|
|
|
+ from wrstandard t
|
|
|
+ left join ERMCP_SpotGoodsPrice p on t.WRSTANDARDID = p.WRSTANDARDID and p.spotgoodsbrandid=0 and p.currencyid = 1
|
|
|
+ where t.WRSTANDARDID = %v
|
|
|
+ `, r.WRSTANDARDID)
|
|
|
+ if _, err = engine.SQL(sql).Get(&goodsInfo); err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ rsp.GoodsInfo = goodsInfo
|
|
|
+
|
|
|
+ // 历史价格走势
|
|
|
+ spotGoodsPriceLogs := make([]THJSpotGoodsPriceLog, 0)
|
|
|
+ sql = fmt.Sprintf(`
|
|
|
+ select
|
|
|
+ t.SPOTGOODSPRICE,
|
|
|
+ t.TRADEDATE
|
|
|
+ from ERMCP_SpotGoodsPriceLog t
|
|
|
+ where t.wrstandardid = %v
|
|
|
+ and t.SPOTGOODSBRANDID = 0
|
|
|
+ and t.CURRENCYID = 1
|
|
|
+ order by t.LogID
|
|
|
+ `, r.WRSTANDARDID)
|
|
|
+ if err = engine.SQL(sql).Find(&spotGoodsPriceLogs); err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ rsp.SpotGoodsPriceLogs = spotGoodsPriceLogs
|
|
|
+
|
|
|
+ return
|
|
|
+}
|