package models import ( "eta_gn/eta_index_lib/global" "time" ) //type BaseFromCoalmineMapping struct { // BaseFromCoalmineMappingId int `orm:"column(base_from_coalmine_mapping_id);pk"` // IndexName string `description:"持买单量指标名称"` // IndexCode string `description:"持买单量指标编码"` // CreateTime time.Time `description:"时间"` //} type BaseFromCoalmineMapping struct { BaseFromCoalmineMappingId int `gorm:"column:base_from_coalmine_mapping_id;primaryKey" description:"持买单量指标ID"` IndexName string `gorm:"column:index_name" description:"持买单量指标名称"` IndexCode string `gorm:"column:index_code" description:"持买单量指标编码"` CreateTime time.Time `gorm:"column:create_time" description:"时间"` } func (m *BaseFromCoalmineMapping) TableName() string { return "base_from_coalmine_mapping" } //type BaseFromCoalmineJsmIndex struct { // BaseFromCoalmineJsmIndexId int `orm:"column(base_from_coalmine_jsm_index_id);pk"` // IndexName string `description:"持买单量指标名称"` // IndexCode string `description:"持买单量指标编码"` // Exchange string `description:"样本统计类别"` // DealValue string `description:"成交量"` // DataTime string `description:"数据日期"` // Source string `description:"来源"` // Province string `description:"省份"` // Description string `description:"描述"` // Unit string `description:"单位"` // Frequency string `description:"频率"` // CreateTime time.Time `description:"插入时间"` // ModifyTime time.Time `description:"修改时间"` //} type BaseFromCoalmineJsmIndex struct { BaseFromCoalmineJsmIndexId int `gorm:"column:base_from_coalmine_jsm_index_id;primaryKey" description:"持买单量指标ID"` IndexName string `gorm:"column:index_name" description:"持买单量指标名称"` IndexCode string `gorm:"column:index_code" description:"持买单量指标编码"` Exchange string `gorm:"column:exchange" description:"样本统计类别"` DealValue string `gorm:"column:deal_value" description:"成交量"` DataTime string `gorm:"column:data_time" description:"数据日期"` Source string `gorm:"column:source" description:"来源"` Province string `gorm:"column:province" description:"省份"` Description string `gorm:"column:description" description:"描述"` Unit string `gorm:"column:unit" description:"单位"` Frequency string `gorm:"column:frequency" description:"频率"` CreateTime time.Time `gorm:"column:create_time" description:"插入时间"` ModifyTime time.Time `gorm:"column:modify_time" description:"修改时间"` } func (m *BaseFromCoalmineJsmIndex) TableName() string { return "base_from_coalmine_jsm_index" } //type BaseFromCoalmineCompanyIndex struct { // BaseFromCoalmineCompanyIndexId int `orm:"column(base_from_coalmine_company_index_id);pk"` // IndexName string `description:"持买单量指标名称"` // IndexCode string `description:"持买单量指标编码"` // DealValue string `description:"成交量"` // DataTime string `description:"数据日期"` // Source string `description:"来源"` // Province string `description:"省份"` // City string `description:"城市"` // GroupName string `description:"集团名称"` // Unit string `description:"单位"` // Frequency string `description:"频率"` // CreateTime time.Time `description:"插入时间"` // ModifyTime time.Time `description:"修改时间"` //} type BaseFromCoalmineCompanyIndex struct { BaseFromCoalmineCompanyIndexId int `gorm:"column:base_from_coalmine_company_index_id;primaryKey" description:"持买单量指标ID"` IndexName string `gorm:"column:index_name" description:"持买单量指标名称"` IndexCode string `gorm:"column:index_code" description:"持买单量指标编码"` DealValue string `gorm:"column:deal_value" description:"成交量"` DataTime string `gorm:"column:data_time" description:"数据日期"` Source string `gorm:"column:source" description:"来源"` Province string `gorm:"column:province" description:"省份"` City string `gorm:"column:city" description:"城市"` GroupName string `gorm:"column:group_name" description:"集团名称"` Unit string `gorm:"column:unit" description:"单位"` Frequency string `gorm:"column:frequency" description:"频率"` CreateTime time.Time `gorm:"column:create_time" description:"插入时间"` ModifyTime time.Time `gorm:"column:modify_time" description:"修改时间"` } func (m *BaseFromCoalmineCompanyIndex) TableName() string { return "base_from_coalmine_company_index" } //添加指标 func AddBaseFromCoalmineMapping(item *BaseFromCoalmineMapping) (lastId int, err error) { //o := orm.NewOrm() //lastId, err = o.Insert(item) err = global.DEFAULT_DmSQL.Create(item).Error lastId = item.BaseFromCoalmineMappingId return } //查询指标 func GetBaseFromCoalmineMapping() (items []*BaseFromCoalmineMapping, err error) { //o := orm.NewOrm() sql := `SELECT * FROM base_from_coalmine_mapping` //_, err = o.Raw(sql).QueryRows(&items) err = global.DEFAULT_DmSQL.Raw(sql).Find(&items).Error return } //查询数据 func GetBaseFromCoalmineIndex() (items []*BaseFromCoalmineJsmIndex, err error) { //o := orm.NewOrm() sql := `SELECT * FROM base_from_coalmine_jsm_index` //_, err = o.Raw(sql).QueryRows(&items) err = global.DEFAULT_DmSQL.Raw(sql).Find(&items).Error return } func UpdateBaseFromCoalmineIndex(item *BaseFromCoalmineJsmIndex) (err error) { //o := orm.NewOrm() sql := `UPDATE base_from_coalmine_jsm_index SET deal_value=? WHERE index_name=? AND data_time = ?` //_, err = o.Raw(sql, item.DealValue, item.IndexName, item.DataTime).Exec() err = global.DEFAULT_DmSQL.Exec(sql, item.DealValue, item.IndexName, item.DataTime).Error return } //添加数据 func AddBaseFromCoalmineIndex(item *BaseFromCoalmineJsmIndex) (lastId int, err error) { //o := orm.NewOrm() //lastId, err = o.Insert(item) err = global.DEFAULT_DmSQL.Create(item).Error lastId = item.BaseFromCoalmineJsmIndexId return } //添加公司指标 func AddBaseFromCoalmineCompanyIndex(item *BaseFromCoalmineCompanyIndex) (lastId int64, err error) { //o := orm.NewOrm() //lastId, err = o.Insert(item) err = global.DEFAULT_DmSQL.Create(item).Error lastId = int64(item.BaseFromCoalmineCompanyIndexId) return } //查询公司指标 func GetBaseFromCoalmineCompanyIndex() (items []*BaseFromCoalmineCompanyIndex, err error) { //o := orm.NewOrm() sql := `SELECT * FROM base_from_coalmine_company_index` //_, err = o.Raw(sql).QueryRows(&items) err = global.DEFAULT_DmSQL.Raw(sql).Find(&items).Error return } func UpdateBaseFromCoalmineCompanyIndex(item *BaseFromCoalmineCompanyIndex) (err error) { //o := orm.NewOrm() sql := `UPDATE base_from_coalmine_company_index SET deal_value=? WHERE index_name=? AND data_time = ?` //_, err = o.Raw(sql, item.DealValue, item.IndexName, item.DataTime).Exec() err = global.DEFAULT_DmSQL.Exec(sql, item.DealValue, item.IndexName, item.DataTime).Error return } type CoalMineDataReq struct { SheetData []SheetData } type SheetData struct { Name string Rows []Row Cols []*Col MaxRow int MaxCol int Hidden bool Selected bool } type Row struct { Cells []Cell Hidden bool Height float64 OutlineLevel uint8 isCustom bool } type Col struct { Min int Max int Hidden bool Width float64 Collapsed bool OutlineLevel uint8 numFmt string } type Cell struct { Value string }