|
@@ -1,9 +1,9 @@
|
|
package data_source
|
|
package data_source
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "eta/eta_api/global"
|
|
"eta/eta_api/utils"
|
|
"eta/eta_api/utils"
|
|
"fmt"
|
|
"fmt"
|
|
- "github.com/beego/beego/v2/client/orm"
|
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
"strings"
|
|
"strings"
|
|
"time"
|
|
"time"
|
|
@@ -207,7 +207,7 @@ func (m *BaseFromRzdIndex) Format2SearchDataSource(origin *BaseFromRzdIndex) (it
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromRzdIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromRzdIndex, err error) {
|
|
func (m *BaseFromRzdIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromRzdIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -217,7 +217,7 @@ func (m *BaseFromRzdIndex) GetItemsByCondition(condition string, pars []interfac
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_rzd_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_rzd_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -283,7 +283,7 @@ func (m *BaseFromHisugarIndex) Format2SearchDataSource(origin *BaseFromHisugarIn
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromHisugarIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromHisugarIndex, err error) {
|
|
func (m *BaseFromHisugarIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromHisugarIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -293,7 +293,7 @@ func (m *BaseFromHisugarIndex) GetItemsByCondition(condition string, pars []inte
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_hisugar_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_hisugar_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -357,7 +357,7 @@ func (m *BaseFromLyIndex) Format2SearchDataSource(origin *BaseFromLyIndex) (item
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromLyIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromLyIndex, err error) {
|
|
func (m *BaseFromLyIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromLyIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -367,7 +367,7 @@ func (m *BaseFromLyIndex) GetItemsByCondition(condition string, pars []interface
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_ly_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_ly_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -434,7 +434,7 @@ func (m *BaseFromSciHqIndex) Format2SearchDataSource(origin *BaseFromSciHqIndex)
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromSciHqIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromSciHqIndex, err error) {
|
|
func (m *BaseFromSciHqIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromSciHqIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -444,7 +444,7 @@ func (m *BaseFromSciHqIndex) GetItemsByCondition(condition string, pars []interf
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_sci_hq_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_sci_hq_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -507,7 +507,7 @@ func (m *BaseFromOilchemIndex) Format2SearchDataSource(origin *BaseFromOilchemIn
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromOilchemIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromOilchemIndex, err error) {
|
|
func (m *BaseFromOilchemIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromOilchemIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -517,7 +517,7 @@ func (m *BaseFromOilchemIndex) GetItemsByCondition(condition string, pars []inte
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_oilchem_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_oilchem_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -590,7 +590,7 @@ func (m *BaseFromThsHfIndex) Format2SearchDataSource(origin *BaseFromThsHfIndex)
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromThsHfIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromThsHfIndex, err error) {
|
|
func (m *BaseFromThsHfIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromThsHfIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -600,7 +600,7 @@ func (m *BaseFromThsHfIndex) GetItemsByCondition(condition string, pars []interf
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_ths_hf_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_ths_hf_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -663,7 +663,7 @@ func (m *BaseFromCcfIndex) Format2SearchDataSource(origin *BaseFromCcfIndex) (it
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromCcfIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromCcfIndex, err error) {
|
|
func (m *BaseFromCcfIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromCcfIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -673,7 +673,7 @@ func (m *BaseFromCcfIndex) GetItemsByCondition(condition string, pars []interfac
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_ccf_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_ccf_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -736,7 +736,7 @@ func (m *BaseFromUsdaFasIndex) Format2SearchDataSource(origin *BaseFromUsdaFasIn
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromUsdaFasIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromUsdaFasIndex, err error) {
|
|
func (m *BaseFromUsdaFasIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromUsdaFasIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -746,7 +746,7 @@ func (m *BaseFromUsdaFasIndex) GetItemsByCondition(condition string, pars []inte
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s, end_value AS latest_value FROM base_from_usda_fas_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s, end_value AS latest_value FROM base_from_usda_fas_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -809,7 +809,7 @@ func (m *BaseFromMysteelChemicalIndex) Format2SearchDataSource(origin *BaseFromM
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromMysteelChemicalIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromMysteelChemicalIndex, err error) {
|
|
func (m *BaseFromMysteelChemicalIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromMysteelChemicalIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -819,7 +819,7 @@ func (m *BaseFromMysteelChemicalIndex) GetItemsByCondition(condition string, par
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s, end_value AS latest_value FROM base_from_mysteel_chemical_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s, end_value AS latest_value FROM base_from_mysteel_chemical_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -882,7 +882,7 @@ func (m *BaseFromSmmIndex) Format2SearchDataSource(origin *BaseFromSmmIndex) (it
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromSmmIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromSmmIndex, err error) {
|
|
func (m *BaseFromSmmIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromSmmIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -892,7 +892,7 @@ func (m *BaseFromSmmIndex) GetItemsByCondition(condition string, pars []interfac
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s, end_value AS latest_value FROM base_from_smm_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s, end_value AS latest_value FROM base_from_smm_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -955,7 +955,7 @@ func (m *BaseFromBaiinfoIndex) Format2SearchDataSource(origin *BaseFromBaiinfoIn
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromBaiinfoIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromBaiinfoIndex, err error) {
|
|
func (m *BaseFromBaiinfoIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromBaiinfoIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -965,7 +965,7 @@ func (m *BaseFromBaiinfoIndex) GetItemsByCondition(condition string, pars []inte
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_baiinfo_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_baiinfo_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1028,7 +1028,7 @@ func (m *BaseFromSciIndex) Format2SearchDataSource(origin *BaseFromSciIndex) (it
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromSciIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromSciIndex, err error) {
|
|
func (m *BaseFromSciIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromSciIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -1038,7 +1038,7 @@ func (m *BaseFromSciIndex) GetItemsByCondition(condition string, pars []interfac
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_sci_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_sci_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1101,7 +1101,7 @@ func (m *BaseFromCoalmineMapping) Format2SearchDataSource(origin *BaseFromCoalmi
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromCoalmineMapping) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromCoalmineMapping, err error) {
|
|
func (m *BaseFromCoalmineMapping) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromCoalmineMapping, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -1111,7 +1111,7 @@ func (m *BaseFromCoalmineMapping) GetItemsByCondition(condition string, pars []i
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_coalmine_mapping WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_coalmine_mapping WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1174,7 +1174,7 @@ func (m *BaseFromEiaSteoIndex) Format2SearchDataSource(origin *BaseFromEiaSteoIn
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromEiaSteoIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromEiaSteoIndex, err error) {
|
|
func (m *BaseFromEiaSteoIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromEiaSteoIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -1184,7 +1184,7 @@ func (m *BaseFromEiaSteoIndex) GetItemsByCondition(condition string, pars []inte
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_eia_steo_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_eia_steo_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1247,7 +1247,7 @@ func (m *BaseFromIcpiIndex) Format2SearchDataSource(origin *BaseFromIcpiIndex) (
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromIcpiIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromIcpiIndex, err error) {
|
|
func (m *BaseFromIcpiIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromIcpiIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -1257,7 +1257,7 @@ func (m *BaseFromIcpiIndex) GetItemsByCondition(condition string, pars []interfa
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_icpi_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_icpi_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1320,7 +1320,7 @@ func (m *BaseFromYongyiIndex) Format2SearchDataSource(origin *BaseFromYongyiInde
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromYongyiIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromYongyiIndex, err error) {
|
|
func (m *BaseFromYongyiIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromYongyiIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -1330,7 +1330,7 @@ func (m *BaseFromYongyiIndex) GetItemsByCondition(condition string, pars []inter
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_yongyi_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_yongyi_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1393,7 +1393,7 @@ func (m *BaseFromFenweiIndex) Format2SearchDataSource(origin *BaseFromFenweiInde
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromFenweiIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromFenweiIndex, err error) {
|
|
func (m *BaseFromFenweiIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromFenweiIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -1403,7 +1403,7 @@ func (m *BaseFromFenweiIndex) GetItemsByCondition(condition string, pars []inter
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_fenwei_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
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...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1466,7 +1466,7 @@ func (m *BaseFromSci99Index) Format2SearchDataSource(origin *BaseFromSci99Index)
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromSci99Index) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromSci99Index, err error) {
|
|
func (m *BaseFromSci99Index) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromSci99Index, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -1476,7 +1476,7 @@ func (m *BaseFromSci99Index) GetItemsByCondition(condition string, pars []interf
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_sci99_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_sci99_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1538,7 +1538,7 @@ func (m *BaseFromGlIndex) Format2SearchDataSource(origin *BaseFromGlIndex) (item
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromGlIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromGlIndex, err error) {
|
|
func (m *BaseFromGlIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromGlIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("gl")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameGL]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -1548,7 +1548,7 @@ func (m *BaseFromGlIndex) GetItemsByCondition(condition string, pars []interface
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM mb_index_main_info WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM mb_index_main_info WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1611,7 +1611,7 @@ func (m *BaseFromManualEdb) Format2SearchDataSource(origin *BaseFromManualEdb) (
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromManualEdb) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromManualEdb, err error) {
|
|
func (m *BaseFromManualEdb) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromManualEdb, err error) {
|
|
- o := orm.NewOrmUsingDB("edb")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameManualIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -1621,7 +1621,7 @@ func (m *BaseFromManualEdb) GetItemsByCondition(condition string, pars []interfa
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM edbinfo WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM edbinfo WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1684,7 +1684,7 @@ func (m *BaseFromBusinessIndex) Format2SearchDataSource(origin *BaseFromBusiness
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromBusinessIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromBusinessIndex, err error) {
|
|
func (m *BaseFromBusinessIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromBusinessIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -1694,7 +1694,7 @@ func (m *BaseFromBusinessIndex) GetItemsByCondition(condition string, pars []int
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_business_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_business_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1757,7 +1757,7 @@ func (m *BaseFromBloombergIndex) Format2SearchDataSource(origin *BaseFromBloombe
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromBloombergIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromBloombergIndex, err error) {
|
|
func (m *BaseFromBloombergIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromBloombergIndex, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -1767,7 +1767,7 @@ func (m *BaseFromBloombergIndex) GetItemsByCondition(condition string, pars []in
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_bloomberg_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_bloomberg_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1830,7 +1830,7 @@ func (m *BaseFromMtjhMapping) Format2SearchDataSource(origin *BaseFromMtjhMappin
|
|
}
|
|
}
|
|
|
|
|
|
func (m *BaseFromMtjhMapping) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromMtjhMapping, err error) {
|
|
func (m *BaseFromMtjhMapping) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromMtjhMapping, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -1840,7 +1840,7 @@ func (m *BaseFromMtjhMapping) GetItemsByCondition(condition string, pars []inter
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_mtjh_mapping WHERE 1=1 %s %s`, fields, condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM base_from_mtjh_mapping WHERE 1=1 %s %s`, fields, condition, order)
|
|
- _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1943,19 +1943,19 @@ func getCoalmineDataTableName(indexCode string) string {
|
|
|
|
|
|
// GetBaseIndexDataMinMax 获取数据源极值
|
|
// GetBaseIndexDataMinMax 获取数据源极值
|
|
func GetBaseIndexDataMinMax(source, subSource int, indexCode string) (item *BaseIndexDataMinMax, err error) {
|
|
func GetBaseIndexDataMinMax(source, subSource int, indexCode string) (item *BaseIndexDataMinMax, err error) {
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
var sql string
|
|
var sql string
|
|
var latestVal string
|
|
var latestVal string
|
|
|
|
|
|
// 煤炭江湖
|
|
// 煤炭江湖
|
|
if source == utils.DATA_SOURCE_MTJH {
|
|
if source == utils.DATA_SOURCE_MTJH {
|
|
sql = `SELECT MIN(data_time) AS min_date, MAX(data_time) AS max_date FROM base_from_mtjh_index WHERE index_code = ?`
|
|
sql = `SELECT MIN(data_time) AS min_date, MAX(data_time) AS max_date FROM base_from_mtjh_index WHERE index_code = ?`
|
|
- if err = o.Raw(sql, indexCode).QueryRow(&item); err != nil {
|
|
|
|
|
|
+ if err = o.Raw(sql, indexCode).First(&item).Error; err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
sql = `SELECT deal_value AS latest_value FROM base_from_mtjh_index WHERE index_code = ? ORDER BY data_time DESC LIMIT 1`
|
|
sql = `SELECT deal_value AS latest_value FROM base_from_mtjh_index WHERE index_code = ? ORDER BY data_time DESC LIMIT 1`
|
|
- if err = o.Raw(sql, indexCode).QueryRow(&latestVal); err != nil {
|
|
|
|
|
|
+ if err = o.Raw(sql, indexCode).Scan(&latestVal).Error; err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
item.LatestValue = latestVal
|
|
item.LatestValue = latestVal
|
|
@@ -1975,13 +1975,13 @@ func GetBaseIndexDataMinMax(source, subSource int, indexCode string) (item *Base
|
|
}
|
|
}
|
|
sql = `SELECT MIN(%s) AS min_date, MAX(%s) AS max_date FROM %s WHERE index_code = ?`
|
|
sql = `SELECT MIN(%s) AS min_date, MAX(%s) AS max_date FROM %s WHERE index_code = ?`
|
|
sql = fmt.Sprintf(sql, fieldDataTime, fieldDataTime, dataTable)
|
|
sql = fmt.Sprintf(sql, fieldDataTime, fieldDataTime, dataTable)
|
|
- if err = o.Raw(sql, indexCode).QueryRow(&item); err != nil {
|
|
|
|
|
|
+ if err = o.Raw(sql, indexCode).First(&item).Error; err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
sql = `SELECT deal_value AS latest_value FROM %s WHERE index_code = ? ORDER BY %s DESC LIMIT 1`
|
|
sql = `SELECT deal_value AS latest_value FROM %s WHERE index_code = ? ORDER BY %s DESC LIMIT 1`
|
|
sql = fmt.Sprintf(sql, dataTable, fieldDataTime)
|
|
sql = fmt.Sprintf(sql, dataTable, fieldDataTime)
|
|
- if err = o.Raw(sql, indexCode).QueryRow(&latestVal); err != nil {
|
|
|
|
|
|
+ if err = o.Raw(sql, indexCode).Scan(&latestVal).Error; err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
item.LatestValue = latestVal
|
|
item.LatestValue = latestVal
|
|
@@ -1997,13 +1997,13 @@ func GetBaseIndexDataMinMax(source, subSource int, indexCode string) (item *Base
|
|
|
|
|
|
sql = `SELECT MIN(data_time) AS min_date, MAX(data_time) AS max_date FROM %s WHERE index_code = ?`
|
|
sql = `SELECT MIN(data_time) AS min_date, MAX(data_time) AS max_date FROM %s WHERE index_code = ?`
|
|
sql = fmt.Sprintf(sql, dataTable)
|
|
sql = fmt.Sprintf(sql, dataTable)
|
|
- if err = o.Raw(sql, indexCode).QueryRow(&item); err != nil {
|
|
|
|
|
|
+ if err = o.Raw(sql, indexCode).First(&item).Error; err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
sql = `SELECT value AS latest_value FROM %s WHERE index_code = ? ORDER BY data_time DESC LIMIT 1`
|
|
sql = `SELECT value AS latest_value FROM %s WHERE index_code = ? ORDER BY data_time DESC LIMIT 1`
|
|
sql = fmt.Sprintf(sql, dataTable)
|
|
sql = fmt.Sprintf(sql, dataTable)
|
|
- if err = o.Raw(sql, indexCode).QueryRow(&latestVal); err != nil {
|
|
|
|
|
|
+ if err = o.Raw(sql, indexCode).Scan(&latestVal).Error; err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
item.LatestValue = latestVal
|
|
item.LatestValue = latestVal
|
|
@@ -2033,7 +2033,7 @@ func GetMtjhBaseInfoFromDataTable(codes []string) (items []*BaseFromMtjhIndex, e
|
|
return
|
|
return
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT * FROM base_from_mtjh_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(codeLens))
|
|
sql := fmt.Sprintf(`SELECT * FROM base_from_mtjh_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(codeLens))
|
|
- _, err = orm.NewOrmUsingDB("data").Raw(sql, codes).QueryRows(&items)
|
|
|
|
|
|
+ err = global.DbMap[utils.DbNameIndex].Raw(sql, codes).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2053,7 +2053,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
|
|
if codeLens == 0 {
|
|
if codeLens == 0 {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- o := orm.NewOrmUsingDB("data")
|
|
|
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
items = make([]*BaseFromCoalmineIndexBase, 0)
|
|
items = make([]*BaseFromCoalmineIndexBase, 0)
|
|
var jsmCodes, companyCodes, firmCodes, coastalCodes, inlandCodes []string
|
|
var jsmCodes, companyCodes, firmCodes, coastalCodes, inlandCodes []string
|
|
for _, code := range codes {
|
|
for _, code := range codes {
|
|
@@ -2077,7 +2077,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
|
|
itemsOnce := make([]*BaseFromCoalmineIndexBase, 0)
|
|
itemsOnce := make([]*BaseFromCoalmineIndexBase, 0)
|
|
if len(jsmCodes) > 0 {
|
|
if len(jsmCodes) > 0 {
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_jsm_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(jsmCodes)))
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_jsm_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(jsmCodes)))
|
|
- _, err = o.Raw(sql, jsmCodes).QueryRows(&itemsOnce)
|
|
|
|
|
|
+ err = o.Raw(sql, jsmCodes).Find(&itemsOnce).Error
|
|
if err != nil {
|
|
if err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -2085,7 +2085,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
|
|
}
|
|
}
|
|
if len(companyCodes) > 0 {
|
|
if len(companyCodes) > 0 {
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_company_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(companyCodes)))
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_company_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(companyCodes)))
|
|
- _, err = o.Raw(sql, companyCodes).QueryRows(&itemsOnce)
|
|
|
|
|
|
+ err = o.Raw(sql, companyCodes).Find(&itemsOnce).Error
|
|
if err != nil {
|
|
if err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -2093,7 +2093,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
|
|
}
|
|
}
|
|
if len(firmCodes) > 0 {
|
|
if len(firmCodes) > 0 {
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_firm_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(firmCodes)))
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_firm_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(firmCodes)))
|
|
- _, err = o.Raw(sql, firmCodes).QueryRows(&itemsOnce)
|
|
|
|
|
|
+ err = o.Raw(sql, firmCodes).Find(&itemsOnce).Error
|
|
if err != nil {
|
|
if err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -2101,7 +2101,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
|
|
}
|
|
}
|
|
if len(coastalCodes) > 0 {
|
|
if len(coastalCodes) > 0 {
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_coastal_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(coastalCodes)))
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_coastal_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(coastalCodes)))
|
|
- _, err = o.Raw(sql, coastalCodes).QueryRows(&itemsOnce)
|
|
|
|
|
|
+ err = o.Raw(sql, coastalCodes).Find(&itemsOnce).Error
|
|
if err != nil {
|
|
if err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -2109,7 +2109,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
|
|
}
|
|
}
|
|
if len(inlandCodes) > 0 {
|
|
if len(inlandCodes) > 0 {
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_inland_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(inlandCodes)))
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_inland_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(inlandCodes)))
|
|
- _, err = o.Raw(sql, inlandCodes).QueryRows(&itemsOnce)
|
|
|
|
|
|
+ err = o.Raw(sql, inlandCodes).Find(&itemsOnce).Error
|
|
if err != nil {
|
|
if err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|