12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- package models
- import (
- "eta_gn/eta_index_lib/global"
- "time"
- )
- type BaseFromCoalmineFirmIndex struct {
- BaseFromCoalmineFirmIndexID int `gorm:"column:base_from_coalmine_firm_index_id;primaryKey"`
- IndexName string `gorm:"column:index_name"`
- IndexCode string `gorm:"column:index_code"`
- DataTime string `gorm:"column:data_time"`
- DealValue string `gorm:"column:deal_value"`
- GroupName string `gorm:"column:group_name"`
- Source string `gorm:"column:source"`
- Unit string `gorm:"column:unit"`
- Frequency string `gorm:"column:frequency" description:"频率"`
- CreateTime time.Time `gorm:"column:create_time" description:"插入时间"`
- ModifyTime time.Time `gorm:"column:modify_time" description:"修改时间"`
- }
- func (m *BaseFromCoalmineFirmIndex) TableName() string {
- return "base_from_coalmine_firm_index"
- }
- func GetBaseFromCoalmineFirmIndex() (items []*BaseFromCoalmineFirmIndex, err error) {
-
- sql := `SELECT * FROM base_from_coalmine_firm_index`
-
- err = global.DEFAULT_DmSQL.Raw(sql).Find(&items).Error
- return
- }
- func AddBaseFromCoalFirmIndex(item *BaseFromCoalmineFirmIndex) (lastId int, err error) {
-
-
- err = global.DEFAULT_DmSQL.Create(item).Error
- lastId = item.BaseFromCoalmineFirmIndexID
- return
- }
- func UpdateBaseFromCoalFirmIndex(item *BaseFromCoalmineFirmIndex) (err error) {
-
- sql := `UPDATE base_from_coalmine_firm_index SET deal_value=? WHERE index_name=? AND data_time = ?`
-
- err = global.DEFAULT_DmSQL.Exec(sql, item.DealValue, item.IndexName, item.DataTime).Error
- return
- }
|