|
@@ -2,6 +2,7 @@ package models
|
|
|
|
|
|
import (
|
|
|
"errors"
|
|
|
+ "eta_gn/eta_index_lib/global"
|
|
|
"eta_gn/eta_index_lib/utils"
|
|
|
"fmt"
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
@@ -13,15 +14,26 @@ import (
|
|
|
// BaseFromFenwei 涌溢咨询
|
|
|
type BaseFromFenwei struct{}
|
|
|
|
|
|
+//type BaseFromFenweiData struct {
|
|
|
+// FenweiDataId int `orm:"column(fenwei_data_id);pk"`
|
|
|
+// FenweiIndexId int
|
|
|
+// IndexCode string
|
|
|
+// DataTime string
|
|
|
+// Value string
|
|
|
+// CreateTime time.Time
|
|
|
+// ModifyTime time.Time
|
|
|
+// DataTimestamp int64
|
|
|
+//}
|
|
|
+
|
|
|
type BaseFromFenweiData struct {
|
|
|
- FenweiDataId int `orm:"column(fenwei_data_id);pk"`
|
|
|
- FenweiIndexId int
|
|
|
- IndexCode string
|
|
|
- DataTime string
|
|
|
- Value string
|
|
|
- CreateTime time.Time
|
|
|
- ModifyTime time.Time
|
|
|
- DataTimestamp int64
|
|
|
+ FenweiDataId int `gorm:"column:fenwei_data_id;primaryKey"`
|
|
|
+ FenweiIndexId int `gorm:"column:fenwei_index_id"`
|
|
|
+ IndexCode string `gorm:"column:index_code"`
|
|
|
+ DataTime string `gorm:"column:data_time"`
|
|
|
+ Value string `gorm:"column:value"`
|
|
|
+ CreateTime time.Time `gorm:"column:create_time"`
|
|
|
+ ModifyTime time.Time `gorm:"column:modify_time"`
|
|
|
+ DataTimestamp int64 `gorm:"column:data_timestamp"`
|
|
|
}
|
|
|
|
|
|
func (m *BaseFromFenweiData) TableName() string {
|
|
@@ -29,18 +41,19 @@ func (m *BaseFromFenweiData) TableName() string {
|
|
|
}
|
|
|
|
|
|
func GetBaseFromFenweiDataByCondition(condition string, pars []interface{}) (list []*BaseFromFenweiData, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
sql := `SELECT * FROM base_from_fenwei_data WHERE 1=1 `
|
|
|
if condition != "" {
|
|
|
sql += condition
|
|
|
}
|
|
|
- _, err = o.Raw(sql, pars).QueryRows(&list)
|
|
|
+ //_, err = o.Raw(sql, pars).QueryRows(&list)
|
|
|
+ err = global.DEFAULT_DmSQL.Raw(sql, pars).Find(&list).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// Add 添加
|
|
|
func (obj BaseFromFenwei) Add(edbCode string) (err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
@@ -72,7 +85,8 @@ func (obj BaseFromFenwei) Add(edbCode string) (err error) {
|
|
|
if isAdd {
|
|
|
addSql = strings.TrimRight(addSql, ",")
|
|
|
utils.FileLog.Info("addSql:" + addSql)
|
|
|
- _, err = o.Raw(addSql).Exec()
|
|
|
+ //_, err = o.Raw(addSql).Exec()
|
|
|
+ err = global.DEFAULT_DmSQL.Exec(addSql).Error
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -83,7 +97,7 @@ func (obj BaseFromFenwei) Add(edbCode string) (err error) {
|
|
|
// Refresh 刷新汾渭数据指标数据
|
|
|
func (obj BaseFromFenwei) Refresh(edbInfoId int, edbCode, startDate string) (err error) {
|
|
|
source := obj.GetSource()
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -181,7 +195,8 @@ func (obj BaseFromFenwei) Refresh(edbInfoId int, edbCode, startDate string) (err
|
|
|
|
|
|
if isAdd {
|
|
|
addSql = strings.TrimRight(addSql, ",")
|
|
|
- _, err = o.Raw(addSql).Exec()
|
|
|
+ //_, err = o.Raw(addSql).Exec()
|
|
|
+ err = global.DEFAULT_DmSQL.Exec(addSql).Error
|
|
|
if err != nil {
|
|
|
fmt.Println("RefreshEdbDataFromBaiinfo add Err", err.Error())
|
|
|
return
|
|
@@ -200,19 +215,34 @@ func (obj BaseFromFenwei) GetSourceName() string {
|
|
|
return utils.DATA_SOURCE_NAME_FENWEI
|
|
|
}
|
|
|
|
|
|
+//type BaseFromFenweiIndex struct {
|
|
|
+// FenweiIndexId int64 `orm:"column(fenwei_index_id);pk"`
|
|
|
+// IndexCode string
|
|
|
+// IndexName string
|
|
|
+// Frequency string
|
|
|
+// Unit string
|
|
|
+// ClassifyId int
|
|
|
+// StartDate string
|
|
|
+// EndDate string
|
|
|
+// Sort int
|
|
|
+// TerminalCode string
|
|
|
+// CreateTime time.Time
|
|
|
+// ModifyTime time.Time
|
|
|
+//}
|
|
|
+
|
|
|
type BaseFromFenweiIndex struct {
|
|
|
- FenweiIndexId int64 `orm:"column(fenwei_index_id);pk"`
|
|
|
- IndexCode string
|
|
|
- IndexName string
|
|
|
- Frequency string
|
|
|
- Unit string
|
|
|
- ClassifyId int
|
|
|
- StartDate string
|
|
|
- EndDate string
|
|
|
- Sort int
|
|
|
- TerminalCode string
|
|
|
- CreateTime time.Time
|
|
|
- ModifyTime time.Time
|
|
|
+ FenweiIndexId int64 `gorm:"column:fenwei_index_id;primaryKey"`
|
|
|
+ IndexCode string `gorm:"column:index_code"`
|
|
|
+ IndexName string `gorm:"column:index_name"`
|
|
|
+ Frequency string `gorm:"column:frequency"`
|
|
|
+ Unit string `gorm:"column:unit"`
|
|
|
+ ClassifyId int `gorm:"column:classify_id"`
|
|
|
+ StartDate string `gorm:"column:start_date"`
|
|
|
+ EndDate string `gorm:"column:end_date"`
|
|
|
+ Sort int `gorm:"column:sort"`
|
|
|
+ TerminalCode string `gorm:"column:terminal_code"`
|
|
|
+ CreateTime time.Time `gorm:"column:create_time"`
|
|
|
+ ModifyTime time.Time `gorm:"column:modify_time"`
|
|
|
}
|
|
|
|
|
|
func (m *BaseFromFenweiIndex) TableName() string {
|
|
@@ -220,34 +250,40 @@ func (m *BaseFromFenweiIndex) TableName() string {
|
|
|
}
|
|
|
|
|
|
func (m *BaseFromFenweiIndex) Add() (lastId int64, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
- lastId, err = o.Insert(m)
|
|
|
+ //o := orm.NewOrm()
|
|
|
+ //lastId, err = o.Insert(m)
|
|
|
+ err = global.DEFAULT_DmSQL.Create(m).Error
|
|
|
+ lastId = m.FenweiIndexId
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func (m *BaseFromFenweiIndex) Update(updateCols []string) (err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
- _, err = o.Update(m, updateCols...)
|
|
|
+ //o := orm.NewOrm()
|
|
|
+ //_, err = o.Update(m, updateCols...)
|
|
|
+ err = global.DEFAULT_DmSQL.Save(m).Error
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func (m *BaseFromFenweiIndex) ModifyIndexMaxAndMinDate(indexCode string, item *EdbInfoMaxAndMinInfo) (err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
sql := ` UPDATE base_from_fenwei_index SET start_date=?,end_date=?,modify_time=NOW() WHERE index_code=? `
|
|
|
- _, err = o.Raw(sql, item.MinDate, item.MaxDate, indexCode).Exec()
|
|
|
+ //_, err = o.Raw(sql, item.MinDate, item.MaxDate, indexCode).Exec()
|
|
|
+ err = global.DEFAULT_DmSQL.Exec(sql, item.MinDate, item.MaxDate, indexCode).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func (m *BaseFromFenweiIndex) GetByIndexCode(indexCode string) (item *BaseFromFenweiIndex, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
sql := ` SELECT * FROM base_from_fenwei_index WHERE index_code=? `
|
|
|
- err = o.Raw(sql, indexCode).QueryRow(&item)
|
|
|
+ //err = o.Raw(sql, indexCode).QueryRow(&item)
|
|
|
+ err = global.DEFAULT_DmSQL.Raw(sql, indexCode).Find(&item).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func (m *BaseFromFenweiIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromFenweiIndex, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
fields := strings.Join(fieldArr, ",")
|
|
|
if len(fieldArr) == 0 {
|
|
|
fields = `*`
|
|
@@ -257,7 +293,8 @@ func (m *BaseFromFenweiIndex) GetItemsByCondition(condition string, pars []inter
|
|
|
order = ` ORDER BY ` + orderRule
|
|
|
}
|
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_fenwei_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
+ //_, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
+ err = global.DEFAULT_DmSQL.Raw(sql, pars).Find(&items).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -276,15 +313,17 @@ type BaseFromFenweiIndexList struct {
|
|
|
}
|
|
|
|
|
|
func (y *BaseFromFenweiData) GetByIndexCode(indexCode string) (list []*BaseFromFenweiData, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
sql := ` SELECT * FROM base_from_fenwei_data WHERE index_code=? `
|
|
|
- _, err = o.Raw(sql, indexCode).QueryRows(&list)
|
|
|
+ //_, err = o.Raw(sql, indexCode).QueryRows(&list)
|
|
|
+ err = global.DEFAULT_DmSQL.Raw(sql, indexCode).Find(&list).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func (y *BaseFromFenweiData) AddMulti(item []*BaseFromFenweiData) (err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
- _, err = o.InsertMulti(1, item)
|
|
|
+ //o := orm.NewOrm()
|
|
|
+ //_, err = o.InsertMulti(1, item)
|
|
|
+ err = global.DEFAULT_DmSQL.CreateInBatches(item, len(item)).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -324,42 +363,59 @@ type HandleFenWeiNetDataReq struct {
|
|
|
}
|
|
|
|
|
|
func (y *BaseFromFenweiData) GetMaxAndMinDateByIndexCode(indexCode string) (item *EdbInfoMaxAndMinInfo, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
sql := ` SELECT MIN(data_time) AS min_date,MAX(data_time) AS max_date,MIN(value) AS min_value,MAX(value) AS max_value FROM base_from_fenwei_data WHERE index_code=? `
|
|
|
- err = o.Raw(sql, indexCode).QueryRow(&item)
|
|
|
+ //err = o.Raw(sql, indexCode).QueryRow(&item)
|
|
|
+ err = global.DEFAULT_DmSQL.Raw(sql, indexCode).Find(&item).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// BaseFromFenweiClassify 汾渭数据分类表
|
|
|
type BaseFromFenweiClassify struct {
|
|
|
- ClassifyId int `orm:"column(classify_id);pk"`
|
|
|
- ClassifyName string `description:"分类名称"`
|
|
|
- ParentId int `description:"父级id"`
|
|
|
- SysUserId int `description:"创建人id"`
|
|
|
- SysUserRealName string `description:"创建人姓名"`
|
|
|
- Level int `description:"层级"`
|
|
|
- Sort int `description:"排序字段,越小越靠前,默认值:10"`
|
|
|
- ModifyTime time.Time `description:"修改时间"`
|
|
|
- CreateTime time.Time `description:"创建时间"`
|
|
|
-}
|
|
|
+ ClassifyId int `gorm:"column:classify_id;primaryKey" description:"分类ID"`
|
|
|
+ ClassifyName string `gorm:"column:classify_name" description:"分类名称"`
|
|
|
+ ParentId int `gorm:"column:parent_id" description:"父级id"`
|
|
|
+ SysUserId int `gorm:"column:sys_user_id" description:"创建人id"`
|
|
|
+ SysUserRealName string `gorm:"column:sys_user_real_name" description:"创建人姓名"`
|
|
|
+ Level int `gorm:"column:level" description:"层级"`
|
|
|
+ Sort int `gorm:"column:sort" description:"排序字段,越小越靠前,默认值:10"`
|
|
|
+ ModifyTime time.Time `gorm:"column:modify_time" description:"修改时间"`
|
|
|
+ CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
|
|
|
+}
|
|
|
+
|
|
|
+//type BaseFromFenweiClassify struct {
|
|
|
+// ClassifyId int `orm:"column(classify_id);pk"`
|
|
|
+// ClassifyName string `description:"分类名称"`
|
|
|
+// ParentId int `description:"父级id"`
|
|
|
+// SysUserId int `description:"创建人id"`
|
|
|
+// SysUserRealName string `description:"创建人姓名"`
|
|
|
+// Level int `description:"层级"`
|
|
|
+// Sort int `description:"排序字段,越小越靠前,默认值:10"`
|
|
|
+// ModifyTime time.Time `description:"修改时间"`
|
|
|
+// CreateTime time.Time `description:"创建时间"`
|
|
|
+//}
|
|
|
|
|
|
func (y *BaseFromFenweiClassify) Add() (lastId int64, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
- lastId, err = o.Insert(y)
|
|
|
+ //o := orm.NewOrm()
|
|
|
+ //lastId, err = o.Insert(y)
|
|
|
+ err = global.DEFAULT_DmSQL.Create(y).Error
|
|
|
+ lastId = int64(y.ClassifyId)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func (y *BaseFromFenweiClassify) Update(updateCols []string) (err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
- _, err = o.Update(y, updateCols...)
|
|
|
+ //o := orm.NewOrm()
|
|
|
+ //_, err = o.Update(y, updateCols...)
|
|
|
+ err = global.DEFAULT_DmSQL.Save(y).Error
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func (y *BaseFromFenweiClassify) GetByClassifyName(classifyName string) (item []*BaseFromFenweiClassify, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
sql := ` SELECT * FROM base_from_fenwei_classify WHERE classify_name=? `
|
|
|
- _, err = o.Raw(sql, classifyName).QueryRows(&item)
|
|
|
+ //_, err = o.Raw(sql, classifyName).QueryRows(&item)
|
|
|
+ err = global.DEFAULT_DmSQL.Raw(sql, classifyName).Find(&item).Error
|
|
|
|
|
|
if errors.Is(err, orm.ErrNoRows) {
|
|
|
return nil, nil
|
|
@@ -369,7 +425,7 @@ func (y *BaseFromFenweiClassify) GetByClassifyName(classifyName string) (item []
|
|
|
}
|
|
|
|
|
|
func (y *BaseFromFenweiClassify) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromFenweiClassify, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
fields := strings.Join(fieldArr, ",")
|
|
|
if len(fieldArr) == 0 {
|
|
|
fields = `*`
|
|
@@ -379,19 +435,32 @@ func (y *BaseFromFenweiClassify) GetItemsByCondition(condition string, pars []in
|
|
|
order = ` ORDER BY ` + orderRule
|
|
|
}
|
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_fenwei_classify WHERE 1=1 %s %s`, fields, condition, order)
|
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
+ //_, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
+ err = global.DEFAULT_DmSQL.Raw(sql, pars).Find(&items).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// BaseFromFenweiClassifyItem 汾渭数据分类信息
|
|
|
+//type BaseFromFenweiClassifyItem struct {
|
|
|
+// ClassifyId int `description:"分类ID"`
|
|
|
+// ClassifyName string `description:"分类名称"`
|
|
|
+// ParentId int `description:"父级id"`
|
|
|
+// Level int `description:"层级"`
|
|
|
+// Sort int `description:"排序字段"`
|
|
|
+// CreateTime string `description:"创建时间"`
|
|
|
+// ModifyTime string `description:"修改时间"`
|
|
|
+// Child []*BaseFromFenweiClassifyItem `description:"子分类"`
|
|
|
+//}
|
|
|
+
|
|
|
// BaseFromFenweiClassifyItem 汾渭数据分类信息
|
|
|
type BaseFromFenweiClassifyItem struct {
|
|
|
- ClassifyId int `description:"分类ID"`
|
|
|
- ClassifyName string `description:"分类名称"`
|
|
|
- ParentId int `description:"父级id"`
|
|
|
- Level int `description:"层级"`
|
|
|
- Sort int `description:"排序字段"`
|
|
|
- CreateTime string `description:"创建时间"`
|
|
|
- ModifyTime string `description:"修改时间"`
|
|
|
+ ClassifyId int `gorm:"column:classify_id" description:"分类ID"`
|
|
|
+ ClassifyName string `gorm:"column:classify_name" description:"分类名称"`
|
|
|
+ ParentId int `gorm:"column:parent_id" description:"父级id"`
|
|
|
+ Level int `gorm:"column:level" description:"层级"`
|
|
|
+ Sort int `gorm:"column:sort" description:"排序字段"`
|
|
|
+ CreateTime string `gorm:"column:create_time" description:"创建时间"`
|
|
|
+ ModifyTime string `gorm:"column:modify_time" description:"修改时间"`
|
|
|
Child []*BaseFromFenweiClassifyItem `description:"子分类"`
|
|
|
}
|
|
|
|
|
@@ -416,20 +485,21 @@ func MultiUpdateBaseFromFenweiDataValue(items []*BaseFromFenweiData) (err error)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
sql := `UPDATE base_from_fenwei_data SET value = ?, modify_time = NOW() WHERE index_code = ? AND data_time = ? LIMIT 1`
|
|
|
- p, err := o.Raw(sql).Prepare()
|
|
|
+ //p, err := o.Raw(sql).Prepare()
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
- defer func() {
|
|
|
- _ = p.Close()
|
|
|
- }()
|
|
|
+ //defer func() {
|
|
|
+ // _ = p.Close()
|
|
|
+ //}()
|
|
|
for _, v := range items {
|
|
|
if v.IndexCode == "" || v.DataTime == "" {
|
|
|
continue
|
|
|
}
|
|
|
- _, err = p.Exec(v.Value, v.IndexCode, v.DataTime)
|
|
|
+ //_, err = p.Exec(v.Value, v.IndexCode, v.DataTime)
|
|
|
+ err = global.DEFAULT_DmSQL.Exec(sql, v.Value, v.IndexCode, v.DataTime).Error
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -439,10 +509,10 @@ func MultiUpdateBaseFromFenweiDataValue(items []*BaseFromFenweiData) (err error)
|
|
|
|
|
|
// GetBaseFromFenWeiIndexByIndexName 根据指标名称查询指标
|
|
|
func GetBaseFromFenWeiIndexByIndexName(indexName string) (item *BaseFromFenweiIndex, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
sql := ` SELECT * FROM base_from_fenwei_index WHERE index_name=? `
|
|
|
- err = o.Raw(sql, indexName).QueryRow(&item)
|
|
|
-
|
|
|
+ //err = o.Raw(sql, indexName).QueryRow(&item)
|
|
|
+ err = global.DEFAULT_DmSQL.Raw(sql, indexName).Find(&item).Error
|
|
|
if errors.Is(err, orm.ErrNoRows) {
|
|
|
return nil, nil
|
|
|
}
|
|
@@ -451,9 +521,10 @@ func GetBaseFromFenWeiIndexByIndexName(indexName string) (item *BaseFromFenweiIn
|
|
|
|
|
|
// GetBaseFromFenweiDataByIndexCodeAndDataTime 根据指标编码和dataTime查询指标数据
|
|
|
func GetBaseFromFenweiDataByIndexCodeAndDataTime(indexCode, dataTime string) (item *BaseFromFenweiData, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
sql := ` SELECT * FROM base_from_fenwei_data WHERE index_code=? AND data_time=? `
|
|
|
- err = o.Raw(sql, indexCode, dataTime).QueryRow(&item)
|
|
|
+ //err = o.Raw(sql, indexCode, dataTime).QueryRow(&item)
|
|
|
+ err = global.DEFAULT_DmSQL.Raw(sql, indexCode, dataTime).Find(&item).Error
|
|
|
|
|
|
if errors.Is(err, orm.ErrNoRows) {
|
|
|
return nil, nil
|
|
@@ -468,23 +539,27 @@ func BatchAddBaseFromFenWeiData(items []*BaseFromFenweiData) (err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- o := orm.NewOrm()
|
|
|
- _, err = o.InsertMulti(1, items)
|
|
|
+ //o := orm.NewOrm()
|
|
|
+ //_, err = o.InsertMulti(1, items)
|
|
|
+ err = global.DEFAULT_DmSQL.CreateInBatches(items, 1).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// AddBaseFromFenWeiClassify 新增汾渭分类
|
|
|
func AddBaseFromFenWeiClassify(item *BaseFromFenweiClassify) (classifyId int64, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
- classifyId, err = o.Insert(item)
|
|
|
+ //o := orm.NewOrm()
|
|
|
+ //classifyId, err = o.Insert(item)
|
|
|
+ err = global.DEFAULT_DmSQL.Create(item).Error
|
|
|
+ classifyId = int64(item.ClassifyId)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// GetBaseFromFenWeiIndexByIndexCode 跟据指标编码查询指标信息
|
|
|
func GetBaseFromFenWeiIndexByIndexCode(indexCode string) (item *BaseFromFenweiIndex, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
sql := ` SELECT * FROM base_from_fenwei_index WHERE index_code=? `
|
|
|
- err = o.Raw(sql, indexCode).QueryRow(&item)
|
|
|
+ //err = o.Raw(sql, indexCode).QueryRow(&item)
|
|
|
+ err = global.DEFAULT_DmSQL.Raw(sql, indexCode).Find(&item).Error
|
|
|
|
|
|
if errors.Is(err, orm.ErrNoRows) {
|
|
|
return nil, nil
|