|
@@ -7,13 +7,13 @@ import (
|
|
|
)
|
|
|
|
|
|
type BaseFromOilchemClassify struct {
|
|
|
- BaseFromOilchemClassifyId int
|
|
|
- ClassifyName string
|
|
|
- ParentID int
|
|
|
- Level int
|
|
|
- Sort int
|
|
|
- CreateTime string
|
|
|
- ModifyTime string
|
|
|
+ BaseFromOilchemClassifyId int
|
|
|
+ ClassifyName string
|
|
|
+ ParentID int
|
|
|
+ Level int
|
|
|
+ Sort int
|
|
|
+ CreateTime string
|
|
|
+ ModifyTime string
|
|
|
}
|
|
|
|
|
|
type BaseFromOilchemIndex struct {
|
|
@@ -50,18 +50,18 @@ type BaseFromOilchemIndexList struct {
|
|
|
BaseFromOilchemIndexId int
|
|
|
IndexCode string
|
|
|
IndexName string
|
|
|
- ClassifyId uint
|
|
|
+ ClassifyId int
|
|
|
Unit string
|
|
|
Frequency string
|
|
|
Describe string
|
|
|
Sort int
|
|
|
CreateTime string
|
|
|
ModifyTime string
|
|
|
+ EdbExist int `description:"edb是否存在"`
|
|
|
DataList []*BaseFromOilchemData
|
|
|
Paging *paging.PagingItem `description:"分页数据"`
|
|
|
}
|
|
|
|
|
|
-
|
|
|
type BaseFromOilchemIndexListResp struct {
|
|
|
List []*BaseFromOilchemIndexView
|
|
|
Paging *paging.PagingItem `description:"分页数据"`
|
|
@@ -74,10 +74,13 @@ func GetOilchemIndexById(indexId int) (item *BaseFromOilchemIndex, err error) {
|
|
|
err = o.Raw(sql, indexId).QueryRow(&item)
|
|
|
return
|
|
|
}
|
|
|
-func GetOilchemIndexByCode(indexCode string) (item *BaseFromOilchemIndex, err error) {
|
|
|
+func GetOilchemIndexByCode(indexCode string) (item *BaseFromOilchemIndexView, err error) {
|
|
|
o := orm.NewOrmUsingDB("data")
|
|
|
- sql := ` SELECT * FROM base_from_oilchem_index WHERE 1=1 and index_code = ? `
|
|
|
- sql += `ORDER BY base_from_oilchem_index_id ASC `
|
|
|
+ sql := ` SELECT a.*,CASE WHEN e.edb_info_id IS NULL THEN 0 ELSE 1 END AS edb_exist
|
|
|
+ FROM base_from_oilchem_index as a
|
|
|
+LEFT JOIN edb_info AS e ON a.index_code=e.edb_code AND e.source=89
|
|
|
+ WHERE 1=1 and a.index_code = ? `
|
|
|
+ sql += `ORDER BY a.base_from_oilchem_index_id ASC `
|
|
|
err = o.Raw(sql, indexCode).QueryRow(&item)
|
|
|
return
|
|
|
}
|
|
@@ -142,7 +145,6 @@ type OilchemDataBatchListReq struct {
|
|
|
IsSelectAll bool `description:"是否查询全部, 默认false, true:全选, false:查询已选"`
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
func GetOilchemIndexByCondition(condition string, pars []interface{}) (items []*BaseFromOilchemIndex, err error) {
|
|
|
o := orm.NewOrmUsingDB("data")
|
|
@@ -176,22 +178,23 @@ func GetOilchemIndexAndEdbInfoByCondition(condition string, pars []interface{})
|
|
|
|
|
|
type BaseFromOilchemIndexView struct {
|
|
|
BaseFromOilchemIndexId int `orm:"pk"`
|
|
|
- EdbInfoId int `description:"指标库id"`
|
|
|
- ClassifyId int `description:"指标分类id"`
|
|
|
- IndexCode string `description:"指标编码"`
|
|
|
- IndexName string `description:"指标名称"`
|
|
|
- UniqueCode string `description:"唯一code"`
|
|
|
- Frequency string `description:"频度"`
|
|
|
- Unit string `description:"单位"`
|
|
|
- StartDate string `description:"开始日期"`
|
|
|
- EndDate string `description:"结束日期"`
|
|
|
- Sort int `description:"排序"`
|
|
|
- EdbExist int `description:"edb是否存在"`
|
|
|
- EdbClassifyId int `description:"edb分类id"`
|
|
|
- ModifyTime string
|
|
|
+ EdbInfoId int `description:"指标库id"`
|
|
|
+ ClassifyId int `description:"指标分类id"`
|
|
|
+ IndexCode string `description:"指标编码"`
|
|
|
+ IndexName string `description:"指标名称"`
|
|
|
+ UniqueCode string `description:"唯一code"`
|
|
|
+ Frequency string `description:"频度"`
|
|
|
+ Unit string `description:"单位"`
|
|
|
+ StartDate string `description:"开始日期"`
|
|
|
+ EndDate string `description:"结束日期"`
|
|
|
+ Sort int `description:"排序"`
|
|
|
+ EdbExist int `description:"edb是否存在"`
|
|
|
+ EdbClassifyId int `description:"edb分类id"`
|
|
|
+ ModifyTime string
|
|
|
+ DataTime string `description:"数据时间"`
|
|
|
+ Value string `description:"值"`
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
type ExportOilchemExcelReq struct {
|
|
|
KeyWord string `description:"关键字, 指标编码或指标ID"`
|
|
@@ -244,7 +247,6 @@ func GetOilchemFrequencyByCondition(condition string, pars []interface{}) (items
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
func GetOilchemIndexViewList(condition string, pars []interface{}, startSize, pageSize int) (items []*BaseFromOilchemIndexView, err error) {
|
|
|
o := orm.NewOrmUsingDB("data")
|
|
@@ -261,7 +263,6 @@ func GetOilchemIndexViewList(condition string, pars []interface{}, startSize, pa
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
func GetOilchemIndexViewListCount(condition string, pars []interface{}) (count int, err error) {
|
|
|
o := orm.NewOrmUsingDB("data")
|
|
@@ -275,4 +276,12 @@ func GetOilchemIndexViewListCount(condition string, pars []interface{}) (count i
|
|
|
sql += ` ORDER BY b.modify_time ASC `
|
|
|
err = o.Raw(sql, pars).QueryRow(&count)
|
|
|
return
|
|
|
-}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func GetOilchemDataViewList(indexIds []int) (items []*BaseFromOilchemData, err error) {
|
|
|
+ o := orm.NewOrmUsingDB("data")
|
|
|
+ sql := ` SELECT * FROM base_from_oilchem_data WHERE base_from_oilchem_index_id IN (` + utils.GetOrmInReplace(len(indexIds)) + `)ORDER BY data_time desc `
|
|
|
+ _, err = o.Raw(sql, indexIds).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|