|
|
@@ -2034,3 +2034,51 @@ func (r *THJProfit) GetDataByPage() (interface{}, error, int, int, int) {
|
|
|
}
|
|
|
return sData, err, r.Page, r.PageSize, total
|
|
|
}
|
|
|
+
|
|
|
+// 定金比例个性化查询
|
|
|
+type GThjinvesotrdeposit struct {
|
|
|
+ USERID int64 `json:"userid" xorm:"USERID" form:"userid" binding:"required"` // 用户ID
|
|
|
+ DEPOSITRATE float64 `json:"depositrate" xorm:"DEPOSITRATE"` // 定金比例
|
|
|
+ DEPOSITQTY int64 `json:"-" xorm:"DEPOSITQTY"` // 可用量
|
|
|
+
|
|
|
+ QTY int64 `json:"qty" xorm:"QTY"` // 可用量
|
|
|
+
|
|
|
+ WRSTANDARDID int64 `json:"-" xorm:"-" form:"wrstandardid" binding:"required"` // 现货商品ID
|
|
|
+
|
|
|
+ PageEx `xorm:"extends"` // 页码信息
|
|
|
+}
|
|
|
+
|
|
|
+func (r *GThjinvesotrdeposit) calc() {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func (r *GThjinvesotrdeposit) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = `
|
|
|
+ select
|
|
|
+ t.DEPOSITRATE,
|
|
|
+ sum(t.depositqty) QTY
|
|
|
+ from THJ_InvesotrDeposit t
|
|
|
+ where (
|
|
|
+ t.userid = %v or
|
|
|
+ t.userid in (select t.refereeuserid from useraccount t where t.userid=%v))
|
|
|
+ AND t.depositrate not in (select distinct t.depositrate from THJ_PresaleApplyDeposit t where t.wrstandardid = %v
|
|
|
+ )
|
|
|
+ group by t.depositrate
|
|
|
+ order by t.depositrate
|
|
|
+ `
|
|
|
+ sqlId.FormatParam(r.USERID, r.USERID, r.WRSTANDARDID)
|
|
|
+
|
|
|
+ sqlId.Page(r.Page, r.PageSize)
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+func (r *GThjinvesotrdeposit) GetDataByPage() (interface{}, error, int, int, int) {
|
|
|
+ sData := make([]GThjinvesotrdeposit, 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
|
|
|
+}
|