|
@@ -1,6 +1,10 @@
|
|
|
package data_manage
|
|
|
|
|
|
-import "eta_gn/eta_chart_lib/global"
|
|
|
+import (
|
|
|
+ "eta_gn/eta_chart_lib/global"
|
|
|
+ "eta_gn/eta_chart_lib/utils"
|
|
|
+ "gorm.io/gorm"
|
|
|
+)
|
|
|
|
|
|
// type ChartEdbInfoMapping struct {
|
|
|
// EdbInfoId int `description:"指标id"`
|
|
@@ -85,6 +89,14 @@ type ChartEdbInfoMapping struct {
|
|
|
IsNullData bool `gorm:"-" json:"-" description:"是否空数据"`
|
|
|
}
|
|
|
|
|
|
+func (e *ChartEdbInfoMapping) AfterFind(db *gorm.DB) (err error) {
|
|
|
+ e.StartDate = utils.GormDateStrToDateTimeStr(e.StartDate)
|
|
|
+ e.EndDate = utils.GormDateStrToDateTimeStr(e.EndDate)
|
|
|
+ e.LatestDate = utils.GormDateStrToDateTimeStr(e.LatestDate)
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func GetChartEdbMappingList(chartInfoId int) (list []*ChartEdbInfoMapping, err error) {
|
|
|
o := global.DmSQL["data"]
|
|
|
sql := ` SELECT a.*,b.source_name,b.source,b.edb_code,b.edb_name,b.edb_name_en,b.frequency,b.unit,b.unit_en,b.start_date,b.end_date,b.modify_time,b.latest_date,b.latest_value,b.unique_code,b.edb_info_type AS edb_info_category_type
|
|
@@ -92,7 +104,7 @@ func GetChartEdbMappingList(chartInfoId int) (list []*ChartEdbInfoMapping, err e
|
|
|
INNER JOIN edb_info AS b ON a.edb_info_id=b.edb_info_id
|
|
|
WHERE chart_info_id=?
|
|
|
ORDER BY chart_edb_mapping_id ASC `
|
|
|
- err = o.Raw(sql, chartInfoId).Scan(&list).Error
|
|
|
+ err = o.Raw(sql, chartInfoId).Find(&list).Error
|
|
|
return
|
|
|
}
|
|
|
|