123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- package models
- import (
- "eta_gn/eta_chart_lib/global"
- "eta_gn/eta_chart_lib/utils"
- )
- // GetEtaEdbChartEdbMapping 商品曲线图查询对应的普通指标
- func GetEtaEdbChartEdbMapping(chartInfoId int) (item *ChartEdbInfoMapping, err error) {
- o := global.DmSQL["data"]
- aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
- sql := ` SELECT ` + aField + `,b.source_name,b.source,b.sub_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
- FROM chart_edb_mapping AS a
- INNER JOIN edb_info AS b ON a.edb_info_id=b.edb_info_id
- WHERE a.chart_info_id=? AND a.source = ?
- ORDER BY chart_edb_mapping_id ASC `
- err = o.Raw(sql, chartInfoId, utils.CHART_SOURCE_DEFAULT).First(&item).Error
- return
- }
- // GetEtaEdbChartEdbMappingList 商品曲线图查询对应的普通指标
- func GetEtaEdbChartEdbMappingList(chartInfoId int) (items []*ChartEdbInfoMapping, err error) {
- o := global.DmSQL["data"]
- aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
- sql := ` SELECT ` + aField + `,b.source_name,b.source,b.sub_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,b.classify_id,b.is_join_permission
- FROM chart_edb_mapping AS a
- INNER JOIN edb_info AS b ON a.edb_info_id=b.edb_info_id
- WHERE a.chart_info_id=? AND a.source = ?
- ORDER BY chart_edb_mapping_id ASC `
- err = o.Raw(sql, chartInfoId, utils.CHART_SOURCE_DEFAULT).Scan(&items).Error
- return
- }
- // GetFutureGoodEdbChartEdbMapping 商品曲线图查询对应的商品指标
- func GetFutureGoodEdbChartEdbMapping(chartInfoId int) (item *ChartEdbInfoMapping, err error) {
- o := global.DmSQL["data"]
- aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
- sql := ` SELECT ` + aField + `,b.future_good_edb_info_id,b.future_good_edb_code as edb_code,b.future_good_edb_name as edb_name,b.start_date,b.end_date,b.modify_time,b.latest_date,b.latest_value
- FROM chart_edb_mapping AS a
- INNER JOIN future_good_edb_info AS b ON a.edb_info_id=b.future_good_edb_info_id
- WHERE a.chart_info_id=? AND a.source = ?
- ORDER BY chart_edb_mapping_id ASC `
- err = o.Raw(sql, chartInfoId, utils.CHART_SOURCE_FUTURE_GOOD).First(&item).Error
- return
- }
- // GetFutureGoodEdbChartEdbMappingList 商品曲线图查询对应的商品指标
- func GetFutureGoodEdbChartEdbMappingList(chartInfoId int) (items []*ChartEdbInfoMapping, err error) {
- o := global.DmSQL["data"]
- aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
- sql := ` SELECT ` + aField + `,b.future_good_edb_info_id,b.future_good_edb_code as edb_code,b.future_good_edb_name as edb_name,b.start_date,b.end_date,b.modify_time,b.latest_date,b.latest_value
- FROM chart_edb_mapping AS a
- INNER JOIN future_good_edb_info AS b ON a.edb_info_id=b.future_good_edb_info_id
- WHERE a.chart_info_id=? AND a.source = ?
- ORDER BY chart_edb_mapping_id ASC `
- err = o.Raw(sql, chartInfoId, utils.CHART_SOURCE_FUTURE_GOOD).Scan(&items).Error
- return
- }
- // GetChartEdbMappingByEdbInfoId 根据指标id获取edb_mapping
- func GetChartEdbMappingByEdbInfoId(edbInfoId int) (item *ChartEdbInfoMapping, err error) {
- o := global.DmSQL["data"]
- sql := ` SELECT edb_info_id,source_name,source,sub_source,edb_code,edb_name,edb_name_en,frequency,unit,unit_en,start_date,end_date,modify_time,latest_date,latest_value,unique_code,edb_info_type AS edb_info_category_type,max_value,min_value
- FROM edb_info
- WHERE edb_info_id = ? limit 1`
- err = o.Raw(sql, edbInfoId).First(&item).Error
- return
- }
- // GetChartEdbMappingListByEdbInfoIdList 根据指标id列表获取关联关系
- func GetChartEdbMappingListByEdbInfoIdList(edbIdList []int) (list []*ChartEdbInfoMapping, err error) {
- num := len(edbIdList)
- if num <= 0 {
- return
- }
- o := global.DmSQL["data"]
- sql := ` SELECT edb_info_id,source_name,source,sub_source,edb_code,edb_name,edb_name_en,frequency,unit,unit_en,start_date,end_date,modify_time,latest_date,latest_value,unique_code,edb_info_type AS edb_info_category_type,max_value,min_value,edb_type
- FROM edb_info
- WHERE edb_info_id IN(` + utils.GetGormInReplace(num) + `)
- ORDER BY FIELD(edb_info_id,` + utils.GetOrmInReplace(num) + `)
- `
- var pars []interface{}
- pars = append(pars, edbIdList)
- for _, v := range edbIdList {
- pars = append(pars, v)
- }
- err = o.Raw(sql, pars...).Scan(&list).Error
- return
- }
- // func GetEtaEdbChartEdbMapping(chartInfoId int) (item *ChartEdbInfoMapping, err error) {
- // o := orm.NewOrmUsingDB("data")
- // aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
- // sql := ` SELECT ` + aField + `,b.source_name,b.source,b.sub_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
- // FROM chart_edb_mapping AS a
- // INNER JOIN edb_info AS b ON a.edb_info_id=b.edb_info_id
- // WHERE a.chart_info_id=? AND a.source = ?
- // ORDER BY chart_edb_mapping_id ASC `
- // err = o.Raw(sql, chartInfoId, utils.CHART_SOURCE_DEFAULT).QueryRow(&item)
- // return
- // }
- // // GetEtaEdbChartEdbMappingList 商品曲线图查询对应的普通指标
- // func GetEtaEdbChartEdbMappingList(chartInfoId int) (items []*ChartEdbInfoMapping, err error) {
- // o := orm.NewOrmUsingDB("data")
- // aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
- // sql := ` SELECT ` + aField + `,b.source_name,b.source,b.sub_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,b.classify_id,b.is_join_permission
- // FROM chart_edb_mapping AS a
- // INNER JOIN edb_info AS b ON a.edb_info_id=b.edb_info_id
- // WHERE a.chart_info_id=? AND a.source = ?
- // ORDER BY chart_edb_mapping_id ASC `
- // _, err = o.Raw(sql, chartInfoId, utils.CHART_SOURCE_DEFAULT).QueryRows(&items)
- // return
- // }
- // // GetFutureGoodEdbChartEdbMapping 商品曲线图查询对应的商品指标
- // func GetFutureGoodEdbChartEdbMapping(chartInfoId int) (item *ChartEdbInfoMapping, err error) {
- // o := orm.NewOrmUsingDB("data")
- // aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
- // sql := ` SELECT ` + aField + `,b.future_good_edb_info_id,b.future_good_edb_code as edb_code,b.future_good_edb_name as edb_name,b.start_date,b.end_date,b.modify_time,b.latest_date,b.latest_value
- // FROM chart_edb_mapping AS a
- // INNER JOIN future_good_edb_info AS b ON a.edb_info_id=b.future_good_edb_info_id
- // WHERE a.chart_info_id=? AND a.source = ?
- // ORDER BY chart_edb_mapping_id ASC `
- // err = o.Raw(sql, chartInfoId, utils.CHART_SOURCE_FUTURE_GOOD).QueryRow(&item)
- // return
- // }
- // // GetFutureGoodEdbChartEdbMappingList 商品曲线图查询对应的商品指标
- // func GetFutureGoodEdbChartEdbMappingList(chartInfoId int) (items []*ChartEdbInfoMapping, err error) {
- // o := orm.NewOrmUsingDB("data")
- // aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
- // sql := ` SELECT ` + aField + `,b.future_good_edb_info_id,b.future_good_edb_code as edb_code,b.future_good_edb_name as edb_name,b.start_date,b.end_date,b.modify_time,b.latest_date,b.latest_value
- // FROM chart_edb_mapping AS a
- // INNER JOIN future_good_edb_info AS b ON a.edb_info_id=b.future_good_edb_info_id
- // WHERE a.chart_info_id=? AND a.source = ?
- // ORDER BY chart_edb_mapping_id ASC `
- // _, err = o.Raw(sql, chartInfoId, utils.CHART_SOURCE_FUTURE_GOOD).QueryRows(&items)
- // return
- // }
- // // GetChartEdbMappingByEdbInfoId 根据指标id获取edb_mapping
- // func GetChartEdbMappingByEdbInfoId(edbInfoId int) (item *ChartEdbInfoMapping, err error) {
- // o := orm.NewOrmUsingDB("data")
- // sql := ` SELECT edb_info_id,source_name,source,sub_source,edb_code,edb_name,edb_name_en,frequency,unit,unit_en,start_date,end_date,modify_time,latest_date,latest_value,unique_code,edb_info_type AS edb_info_category_type,max_value,min_value
- // FROM edb_info
- // WHERE edb_info_id = ? limit 1`
- // err = o.Raw(sql, edbInfoId).QueryRow(&item)
- // return
- // }
- // // GetChartEdbMappingListByEdbInfoIdList 根据指标id列表获取关联关系
- // func GetChartEdbMappingListByEdbInfoIdList(edbIdList []int) (list []*ChartEdbInfoMapping, err error) {
- // num := len(edbIdList)
- // if num <= 0 {
- // return
- // }
- // o := orm.NewOrmUsingDB("data")
- // sql := ` SELECT edb_info_id,source_name,source,sub_source,edb_code,edb_name,edb_name_en,frequency,unit,unit_en,start_date,end_date,modify_time,latest_date,latest_value,unique_code,edb_info_type AS edb_info_category_type,max_value,min_value,edb_type
- // FROM edb_info
- // WHERE edb_info_id IN(` + utils.GetOrmInReplace(num) + `)
- // ORDER BY FIELD(edb_info_id,` + utils.GetOrmInReplace(num) + `)
- // `
- // _, err = o.Raw(sql, edbIdList, edbIdList).QueryRows(&list)
- // return
- // }
|