|
@@ -188,11 +188,11 @@ func GetBaseFromFenweiIndexByIndexCode(indexCode string) (list *BaseFromFenweiIn
|
|
|
func GetFenWeiIndexFrequency(classifyId int) (items []*string, err error) {
|
|
|
sql := `SELECT DISTINCT frequency
|
|
|
FROM base_from_fenwei_index
|
|
|
- WHERE frequency != ''`
|
|
|
+ WHERE frequency is not null`
|
|
|
|
|
|
// 如果 classifyId > 0,则添加该条件
|
|
|
if classifyId > 0 {
|
|
|
- sql += ` AND base_from_ly_classify_id = ?`
|
|
|
+ sql += ` AND classify_id = ?`
|
|
|
}
|
|
|
|
|
|
sql += ` ORDER BY FIELD(frequency, '日度', '周度', '月度', '季度', '半年度', '年度')`
|
|
@@ -213,8 +213,8 @@ func GetFenWeiIndexByCodeAndClassify(indexCode string, classifyId int, frequency
|
|
|
|
|
|
// SQL 查询语句
|
|
|
sql := `SELECT a.index_code, a.index_name, a.frequency, a.unit, MAX(b.modify_time) AS modify_time
|
|
|
- FROM base_from_ly_index AS a
|
|
|
- INNER JOIN base_from_ly_data AS b ON a.base_from_ly_index_id = b.base_from_ly_index_id
|
|
|
+ FROM base_from_fenwei_index AS a
|
|
|
+ INNER JOIN base_from_fenwei_data AS b ON a.fenwei_index_id = b.fenwei_index_id
|
|
|
WHERE 1=1`
|
|
|
|
|
|
var params []interface{}
|
|
@@ -246,7 +246,7 @@ func GetFenWeiIndexByCodeAndClassify(indexCode string, classifyId int, frequency
|
|
|
|
|
|
// GetBaseFromFenWeiDataByIndexCode 根据指标编码查询
|
|
|
func GetBaseFromFenWeiDataByIndexCode(indexCode string) (items []*BaseFromFenweiData, err error) {
|
|
|
- sql := `SELECT * FROM base_from_ly_data WHERE index_code=? ORDER BY data_time desc`
|
|
|
+ sql := `SELECT * FROM base_from_fenwei_data WHERE index_code=? ORDER BY data_time desc`
|
|
|
o := orm.NewOrmUsingDB("data")
|
|
|
_, err = o.Raw(sql, indexCode).QueryRows(&items)
|
|
|
return
|
|
@@ -254,7 +254,7 @@ func GetBaseFromFenWeiDataByIndexCode(indexCode string) (items []*BaseFromFenwei
|
|
|
|
|
|
// GetFenWeiDataListByIndexCodes 根据指标编码查询
|
|
|
func GetFenWeiDataListByIndexCodes(IndexCodes string) (items []string, err error) {
|
|
|
- sql := ` SELECT data_time FROM base_from_ly_data WHERE index_code IN(` + IndexCodes + `) GROUP BY data_time DESC `
|
|
|
+ sql := ` SELECT data_time FROM base_from_fenwei_data WHERE index_code IN(` + IndexCodes + `) GROUP BY data_time DESC `
|
|
|
o := orm.NewOrmUsingDB("data")
|
|
|
_, err = o.Raw(sql).QueryRows(&items)
|
|
|
return
|