|
|
@@ -1631,3 +1631,89 @@ func (r *Ermcp3HedgePlan) GetData(status string) ([]Ermcp3HedgePlan, error) {
|
|
|
|
|
|
return sData, nil
|
|
|
}
|
|
|
+
|
|
|
+// Ermcp3GoodsGroup 商品组
|
|
|
+type Ermcp3GoodsGroup struct {
|
|
|
+ GOODSGROUPID int32 `json:"goodsgroupid" xorm:"'GOODSGROUPID'"` // 商品组ID(自增ID)
|
|
|
+ GOODSGROUPNAME string `json:"goodsgroupname" xorm:"'GOODSGROUPNAME'"` // 商品组名称
|
|
|
+ GOODSGROUPSTATUS int32 `json:"goodsgroupstatus" xorm:"'GOODSGROUPSTATUS'"` // 商品组状态 - 1:正常 2:注销
|
|
|
+ MARKETID int32 `json:"marketid" xorm:"'MARKETID'"` // 所属市场ID
|
|
|
+ CREATETIME string `json:"createtime" xorm:"'CREATETIME'"` // 创建时间
|
|
|
+ CREATORID int32 `json:"creatorid" xorm:"'CREATORID'"` // 创建人
|
|
|
+ MODIFYTIME string `json:"modifytime" xorm:"'MODIFYTIME'"` // 修改时间
|
|
|
+ MODIFIERID int32 `json:"modifierid" xorm:"'MODIFIERID'"` // 修改人
|
|
|
+ QUOTESOURCEGROUPID int64 `json:"quotesourcegroupid" xorm:"'QUOTESOURCEGROUPID'"` // 所属行情源分组ID[参考行情市场用\通道交易]
|
|
|
+ OUTERGROUPCODE string `json:"outergroupcode" xorm:"'OUTERGROUPCODE'"` // 外部商品组代码[通道交易]
|
|
|
+ CANSHORT int32 `json:"canshort" xorm:"'CANSHORT'"` // 是否允许做空[通道交易] - 0:不能做空 1:可以做空
|
|
|
+ EXEXCHANGEID int64 `json:"exexchangeid" xorm:"'EXEXCHANGEID'"` // 外部交易所ID[通道交易]
|
|
|
+ CURRENCYID int32 `json:"currencyid" xorm:"'CURRENCYID'"` // 报价货币ID
|
|
|
+ GOODUNITID int32 `json:"goodunitid" xorm:"'GOODUNITID'"` // 报价单位ID
|
|
|
+ AGREEUNIT float32 `json:"agreeunit" xorm:"'AGREEUNIT'"` // 合约单位
|
|
|
+ DECIMALPLACE int32 `json:"decimalplace" xorm:"'DECIMALPLACE'"` // 报价小数位
|
|
|
+ QUOTEMINUNIT int32 `json:"quoteminunit" xorm:"'QUOTEMINUNIT'"` // 行情最小变动单位 [整数,报价小数位一起使用]
|
|
|
+ INNERDEALMODE int32 `json:"innerdealmode" xorm:"'INNERDEALMODE'"` // 内部成交方式[通道交易] - 1:净头寸 2:开平 3:平今
|
|
|
+ OUTERDEALMODE int32 `json:"outerdealmode" xorm:"'OUTERDEALMODE'"` // 外部成交方式[通道交易]- 1:净头寸 2:开平 3:平今
|
|
|
+ SYNCGOODSQTY int32 `json:"syncgoodsqty" xorm:"'SYNCGOODSQTY'"` // 同步合约数[通道交易-投资管理用] - 0表示不限
|
|
|
+ CLOSEPRICEMODE int32 `json:"closepricemode" xorm:"'CLOSEPRICEMODE'"` // 强平价格方式 - 1:市价 2:最新价 3:涨跌停(未实现)
|
|
|
+ GROUPCATEGROYID int32 `json:"groupcategroyid" xorm:"'GROUPCATEGROYID'"` // 品种分类ID
|
|
|
+
|
|
|
+ AreaUserId int64 `json:"areauserid" form:"areauserid" binding:"required"` // 所属机构id(套保品是有areauserid的,当要排除已配置商品组时需要areauserid过滤)
|
|
|
+ ExcludeCfg int32 `json:"excludecfg" form:"excludecfg"` // 排除套保品已配置期货分类下的商品组(但显示已配置商品组) 1-排除
|
|
|
+}
|
|
|
+
|
|
|
+func (r *Ermcp3GoodsGroup) calc() {
|
|
|
+}
|
|
|
+
|
|
|
+func (r *Ermcp3GoodsGroup) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = "SELECT t.GOODSGROUPID," +
|
|
|
+ " t.GOODSGROUPNAME," +
|
|
|
+ " t.GOODSGROUPSTATUS," +
|
|
|
+ " t.MARKETID," +
|
|
|
+ " to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME," +
|
|
|
+ " t.CREATORID," +
|
|
|
+ " to_char(t.MODIFYTIME, 'yyyy-mm-dd hh24:mi:ss') MODIFYTIME," +
|
|
|
+ " t.MODIFIERID," +
|
|
|
+ " t.QUOTESOURCEGROUPID," +
|
|
|
+ " t.OUTERGROUPCODE," +
|
|
|
+ " t.CANSHORT," +
|
|
|
+ " t.EXEXCHANGEID," +
|
|
|
+ " t.CURRENCYID," +
|
|
|
+ " t.GOODUNITID," +
|
|
|
+ " t.AGREEUNIT," +
|
|
|
+ " t.DECIMALPLACE," +
|
|
|
+ " t.QUOTEMINUNIT," +
|
|
|
+ " t.INNERDEALMODE," +
|
|
|
+ " t.OUTERDEALMODE," +
|
|
|
+ " t.SYNCGOODSQTY," +
|
|
|
+ " t.CLOSEPRICEMODE," +
|
|
|
+ " t.GROUPCATEGROYID" +
|
|
|
+ " FROM GOODSGROUP t" +
|
|
|
+ " WHERE 1 = 1"
|
|
|
+ if r.ExcludeCfg == 1 {
|
|
|
+ str := "select t.goodsgroupid" +
|
|
|
+ " from ERMS_MiddleGoods t" +
|
|
|
+ " where t.areauserid = %v" +
|
|
|
+ "union all" +
|
|
|
+ "select goodsgroupid" +
|
|
|
+ " from goodsgroup t" +
|
|
|
+ " where t.groupcategroyid not in" +
|
|
|
+ " (select distinct g.groupcategroyid" +
|
|
|
+ " from erms_middlegoods t" +
|
|
|
+ " left join goodsgroup g" +
|
|
|
+ " on t.goodsgroupid = g.goodsgroupid" +
|
|
|
+ " where t.areauserid = %v)"
|
|
|
+ str = fmt.Sprintf(str, r.AreaUserId, r.AreaUserId)
|
|
|
+ sqlId.Join(fmt.Sprintf("and t.groupcategroyid not in(%v)", str))
|
|
|
+ }
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+// GetDataEx 商品组信息
|
|
|
+func (r *Ermcp3GoodsGroup) GetDataEx() (interface{}, error) {
|
|
|
+ sData := make([]Ermcp3GoodsGroup, 0)
|
|
|
+ err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
|
|
|
+ for i := range sData {
|
|
|
+ sData[i].calc()
|
|
|
+ }
|
|
|
+ return sData, err
|
|
|
+}
|