|
|
@@ -847,3 +847,111 @@ func (r *ThjscoreconfigReq) Get() (data []Thjscoreconfig, err error) {
|
|
|
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+type THJProduct struct {
|
|
|
+ WRSTANDARDID string `json:"wrstandardid" xorm:"WRSTANDARDID"` // 现货商品ID(自增 SEQ_GOODS 确保不重复)
|
|
|
+ WRSTANDARDCODE string `json:"wrstandardcode" xorm:"WRSTANDARDCODE"` // 现货商品代码
|
|
|
+ WRSTANDARDNAME string `json:"wrstandardname" xorm:"WRSTANDARDNAME"` // 现货商品名称
|
|
|
+ BANNERPICURL string `json:"bannerpicurl" xorm:"BANNERPICURL"` // Banner图(逗号分隔)
|
|
|
+ PICTUREURLS string `json:"pictureurls" xorm:"PICTUREURLS"` // 详情图片(逗号分隔)
|
|
|
+
|
|
|
+ UserID int `json:"-" xorm:"-" form:"userid" binding:"required"` // 用户ID
|
|
|
+ FavoriteFlag bool `json:"-" xorm:"-" form:"favoriteflag"` // 关注标志 true-已关注 false-未关注
|
|
|
+
|
|
|
+ PageEx `xorm:"extends"` // 页码信息
|
|
|
+}
|
|
|
+
|
|
|
+func (r *THJProduct) calc() {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func (r *THJProduct) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = `
|
|
|
+ select
|
|
|
+ to_char(t.WRSTANDARDID) WRSTANDARDID,
|
|
|
+ t.WRSTANDARDNAME,
|
|
|
+ t.BANNERPICURL,
|
|
|
+ t.PICTUREURLS
|
|
|
+ from wrstandard t
|
|
|
+ where t.IsValid = 1
|
|
|
+ and t.wrstandardid
|
|
|
+ %v
|
|
|
+ (select t.goodsid from UserFavoriteGoods t where t.userid = %v)
|
|
|
+`
|
|
|
+ param := "not in"
|
|
|
+ if r.FavoriteFlag {
|
|
|
+ param = "in"
|
|
|
+ }
|
|
|
+ sqlId.FormatParam(param, r.UserID)
|
|
|
+
|
|
|
+ sqlId.Page(r.Page, r.PageSize)
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+func (r *THJProduct) GetDataByPage() (interface{}, error, int, int, int) {
|
|
|
+ sData := make([]THJProduct, 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
|
|
|
+}
|
|
|
+
|
|
|
+type THJTradeData struct {
|
|
|
+ RECKONDATE string `json:"reckondate" xorm:"RECKONDATE"` // 日照日期(yyyyMMdd)日照日期(yyyyMMdd)
|
|
|
+ MARKETID int64 `json:"marketid" xorm:"MARKETID" form:"marketid" binding:"required"` // 市场ID 采购-64201 供求-65201
|
|
|
+ BUYTRADELOT int32 `json:"buytradelot" xorm:"BUYTRADELOT"` // 购买笔数
|
|
|
+ BUYTRADEQTY float64 `json:"buytradeqty" xorm:"BUYTRADEQTY"` // 购买数量
|
|
|
+ SELLTRADELOT int32 `json:"selltradelot" xorm:"SELLTRADELOT"` // 销售笔数
|
|
|
+ SELLTRADEQTY float64 `json:"selltradeqty" xorm:"SELLTRADEQTY"` // 销售数量
|
|
|
+ USERID int64 `json:"userid" xorm:"USERID" form:"userid" binding:"required"` // 用户ID
|
|
|
+
|
|
|
+ WRSTANDARDNAME string `json:"wrstandardname" xorm:"WRSTANDARDNAME"` // 现货商品名称
|
|
|
+
|
|
|
+ PageEx `xorm:"extends"` // 页码信息
|
|
|
+}
|
|
|
+
|
|
|
+func (r *THJTradeData) calc() {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func (r *THJTradeData) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = `
|
|
|
+ select
|
|
|
+ a.*
|
|
|
+ from
|
|
|
+ (select
|
|
|
+ to_char(to_date(t.reckondate, 'yyyymmdd'), 'yyyy-mm-dd') RECKONDATE,
|
|
|
+ wr.WRSTANDARDNAME,
|
|
|
+ t.BUYTRADEQTY,
|
|
|
+ t.BUYTRADELOT,
|
|
|
+ t.SELLTRADEQTY,
|
|
|
+ t.SELLTRADELOT,
|
|
|
+ t.updatetime
|
|
|
+ from Reckon_WRTradeSum t
|
|
|
+ left join wrstandard wr on t.wrstandardid = wr.wrstandardid
|
|
|
+ left join useraccount ua on t.userid = ua.userid
|
|
|
+ where
|
|
|
+ t.refereeuserid = %v
|
|
|
+ and
|
|
|
+ t.marketid = %v) a
|
|
|
+ order by a.updatetime desc
|
|
|
+ `
|
|
|
+ sqlId.FormatParam(r.USERID, r.MARKETID)
|
|
|
+
|
|
|
+ sqlId.Page(r.Page, r.PageSize)
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+func (r *THJTradeData) GetDataByPage() (interface{}, error, int, int, int) {
|
|
|
+ sData := make([]THJTradeData, 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
|
|
|
+}
|