|
|
@@ -52,6 +52,23 @@ func (Erms3Spotcontractdetail) TableName() string {
|
|
|
return "ERMS3_SPOTCONTRACTDETAIL"
|
|
|
}
|
|
|
|
|
|
+// Erms3SpotContractInfo 合同明细.
|
|
|
+type Erms3SpotContractInfo struct {
|
|
|
+ Erms3Spotcontractdetail `xorm:"extends"`
|
|
|
+ Areauserid int64 `json:"areauserid" xorm:"AREAUSERID"` // 所属机构
|
|
|
+ Accountid int64 `json:"accountid" xorm:"ACCOUNTID"` // 资金账户ID
|
|
|
+ Customeruserid int64 `json:"customeruserid" xorm:"CUSTOMERUSERID"` // 客户ID
|
|
|
+ Customeraccountid int64 `json:"customeraccountid" xorm:"CUSTOMERACCOUNTID"` // 客户资金账户ID
|
|
|
+ Signdate time.Time `json:"signdate" xorm:"SIGNDATE"` // 签订日期
|
|
|
+ Closestatus int32 `json:"closestatus" xorm:"CLOSESTATUS"` // 完结状态 - 0:未完结 1:已完结
|
|
|
+ Relatedbizid string `json:"relatedbizid" xorm:"RELATEDBIZID"` // 关联业务ID
|
|
|
+ Goodunit string `json:"goodunit" xorm:"'GOODUNIT'"` // 报价单位
|
|
|
+ Wrstandardcode string `json:"wrstandardcode" xorm:"'WRSTANDARDCODE'"` // 仓单标准代码
|
|
|
+ Wrstandardname string `json:"wrstandardname" xorm:"'WRSTANDARDNAME'"` // 仓单标准名称
|
|
|
+ Deliverygoodscode string `json:"deliverygoodscode" xorm:"'DELIVERYGOODSCODE'"` // 交割商品代码
|
|
|
+ Deliverygoodsname string `json:"deliverygoodsname" xorm:"'DELIVERYGOODSNAME'"` // 交割商品名称
|
|
|
+}
|
|
|
+
|
|
|
// Erms3SpotContractApply 现货合同申请表
|
|
|
type Erms3SpotContractApply struct {
|
|
|
SpotContractID int64 `json:"spotcontractid" xorm:"'SPOTCONTRACTID'" binging:"required"` // 现货合同ID(345+Unix秒时间戳(10位)+xxxxxx)
|
|
|
@@ -152,3 +169,22 @@ func AddSpotContractApply(spotContractApply Erms3SpotContractApply) error {
|
|
|
|
|
|
return err
|
|
|
}
|
|
|
+
|
|
|
+func QueryErms3SpotContractInfo(accountids []int64, contracttype, contractmode, status int32) ([]Erms3SpotContractInfo, error) {
|
|
|
+ datas := make([]Erms3SpotContractInfo, 0)
|
|
|
+ engine := db.GetEngine()
|
|
|
+ s := engine.Table("ERMS3_SPOTCONTRACTDETAIL").
|
|
|
+ Join("LEFT", "ERMS3_SPOTCONTRACT", "ERMS3_SPOTCONTRACTDETAIL.SPOTCONTRACTID = ERMS3_SPOTCONTRACT.SPOTCONTRACTID").
|
|
|
+ Join("LEFT", "ERMS3_BIZTRADEDETAIL", "ERMS3_BIZTRADEDETAIL.SPOTDETAILID = ERMS3_SPOTCONTRACTDETAIL.SPOTDETAILID").
|
|
|
+ Join("LEFT", "WRSTANDARD", "WRSTANDARD.WRSTANDARDID = ERMS3_SPOTCONTRACTDETAIL.WRSTANDARDID").
|
|
|
+ Join("LEFT", "DELIVERYGOODS", "DELIVERYGOODS.DELIVERYGOODSID = WRSTANDARD.DELIVERYGOODSID").
|
|
|
+ Join("LEFT", "ENUMDICITEM", "WRSTANDARD.UNITID = ENUMDICITEM.ENUMITEMNAME AND ENUMDICITEM.ENUMDICCODE = 'goodsunit'").
|
|
|
+ Select(`to_char(ERMS3_SPOTCONTRACTDETAIL.SPOTCONTRACTID) SPOTCONTRACTID, ERMS3_SPOTCONTRACT.AREAUSERID, ERMS3_SPOTCONTRACT.ACCOUNTID, ERMS3_SPOTCONTRACT.CUSTOMERUSERID,
|
|
|
+ERMS3_SPOTCONTRACT.CUSTOMERACCOUNTID, ERMS3_SPOTCONTRACT.CLOSESTATUS, ERMS3_SPOTCONTRACT.SIGNDATE, ERMS3_SPOTCONTRACTDETAIL.*, WRSTANDARD.WRSTANDARDNAME, WRSTANDARD.WRSTANDARDCODE, DELIVERYGOODS.DELIVERYGOODSNAME, DELIVERYGOODS.DELIVERYGOODSCODE,
|
|
|
+to_char(ERMS3_BIZTRADEDETAIL.RELATEDBIZID) RELATEDBIZID, ENUMDICITEM.ENUMDICNAME GOODUNIT`).
|
|
|
+ Where("ERMS3_SPOTCONTRACT.CONTRACTTYPE = ? AND ERMS3_SPOTCONTRACT.CONTRACTMODE = ? AND ERMS3_SPOTCONTRACT.CLOSESTATUS = ?", contracttype, contractmode, status).
|
|
|
+ In("ERMS3_SPOTCONTRACT.ACCOUNTID", accountids).
|
|
|
+ Desc("ERMS3_SPOTCONTRACTDETAIL.SPOTCONTRACTID")
|
|
|
+ err := s.Find(&datas)
|
|
|
+ return datas, err
|
|
|
+}
|