|
@@ -37,6 +37,7 @@ type MiddleGoods struct {
|
|
|
AREAUSERID uint32 `json:"areauserid" xorm:"'AREAUSERID'"` // 机构用户ID
|
|
AREAUSERID uint32 `json:"areauserid" xorm:"'AREAUSERID'"` // 机构用户ID
|
|
|
GOODSGROUPID int32 `json:"goodsgroupid" xorm:"'GOODSGROUPID'"` // 关联期货品种ID
|
|
GOODSGROUPID int32 `json:"goodsgroupid" xorm:"'GOODSGROUPID'"` // 关联期货品种ID
|
|
|
ISVALID int32 `json:"isvalid" xorm:"'ISVALID'"` // 状态 0-无效(停用) 1-有效(正常)
|
|
ISVALID int32 `json:"isvalid" xorm:"'ISVALID'"` // 状态 0-无效(停用) 1-有效(正常)
|
|
|
|
|
+ MODIFYTIME string `json:"modifytime" xorm:"'MODIFYTIME'"` // 修改时间
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (r *middleGoodsMgr) isNeedLoad() bool {
|
|
func (r *middleGoodsMgr) isNeedLoad() bool {
|
|
@@ -67,7 +68,8 @@ func (r *middleGoodsMgr) load() {
|
|
|
" RELATEDGOODSTYPE," +
|
|
" RELATEDGOODSTYPE," +
|
|
|
" NEEDHEDGERATIO," +
|
|
" NEEDHEDGERATIO," +
|
|
|
" AREAUSERID," +
|
|
" AREAUSERID," +
|
|
|
- " GOODSGROUPID" +
|
|
|
|
|
|
|
+ " GOODSGROUPID," +
|
|
|
|
|
+ " MODIFYTIME," +
|
|
|
" ISVALID" +
|
|
" ISVALID" +
|
|
|
" from erms_middlegoods t"
|
|
" from erms_middlegoods t"
|
|
|
sData := make([]MiddleGoods, 0)
|
|
sData := make([]MiddleGoods, 0)
|
|
@@ -102,7 +104,7 @@ func (r *middleGoodsMgr) getByUserID(userId uint32) ([]MiddleGoods, error) {
|
|
|
defer r.mtx.RUnlock()
|
|
defer r.mtx.RUnlock()
|
|
|
ret := make([]MiddleGoods, 0)
|
|
ret := make([]MiddleGoods, 0)
|
|
|
for _, v := range r.data {
|
|
for _, v := range r.data {
|
|
|
- if v.AREAUSERID == userId{
|
|
|
|
|
|
|
+ if v.AREAUSERID == userId {
|
|
|
ret = append(ret, v)
|
|
ret = append(ret, v)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -123,14 +125,14 @@ func GetMiddleGoods(middlGoodsId uint32) (MiddleGoods, error) {
|
|
|
|
|
|
|
|
// 获取指定用户套保商品
|
|
// 获取指定用户套保商品
|
|
|
func GetMiddleGoodsByUserID(userId uint32) ([]MiddleGoods, error) {
|
|
func GetMiddleGoodsByUserID(userId uint32) ([]MiddleGoods, error) {
|
|
|
- if vGoodMgr.isNeedLoad(){
|
|
|
|
|
|
|
+ if vGoodMgr.isNeedLoad() {
|
|
|
vGoodMgr.load()
|
|
vGoodMgr.load()
|
|
|
}
|
|
}
|
|
|
return vGoodMgr.getByUserID(userId)
|
|
return vGoodMgr.getByUserID(userId)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 从数据库中获取套保商品
|
|
// 从数据库中获取套保商品
|
|
|
-func GetMiddleGoodsFromDB(userId uint32)([]MiddleGoods, error) {
|
|
|
|
|
|
|
+func GetMiddleGoodsFromDB(userId uint32) ([]MiddleGoods, error) {
|
|
|
vGoodMgr.load()
|
|
vGoodMgr.load()
|
|
|
return vGoodMgr.getByUserID(userId)
|
|
return vGoodMgr.getByUserID(userId)
|
|
|
-}
|
|
|
|
|
|
|
+}
|