|
@@ -75,19 +75,19 @@ func GetOilchemClassifyList() (list []*BaseFromOilchemClassify, err error) {
|
|
|
}
|
|
|
|
|
|
type BaseFromOilchemIndexList struct {
|
|
|
- BaseFromOilchemIndexId int // 主键ID
|
|
|
- IndexCode string // 指标编码
|
|
|
- IndexName string // 指标名称
|
|
|
- ClassifyId int // 分类ID
|
|
|
- Unit string // 单位
|
|
|
- Frequency string // 频度
|
|
|
- Describe string // 指标描述
|
|
|
- Sort int // 排序
|
|
|
- CreateTime string // 创建时间
|
|
|
- ModifyTime string // 修改时间
|
|
|
- EdbExist int `description:"edb是否存在"`
|
|
|
- DataList []*BaseFromOilchemData
|
|
|
- Paging *paging.PagingItem `description:"分页数据"`
|
|
|
+ BaseFromOilchemIndexId int // 主键ID
|
|
|
+ IndexCode string // 指标编码
|
|
|
+ IndexName string // 指标名称
|
|
|
+ ClassifyId int // 分类ID
|
|
|
+ Unit string // 单位
|
|
|
+ Frequency string // 频度
|
|
|
+ Describe string // 指标描述
|
|
|
+ Sort int // 排序
|
|
|
+ CreateTime string // 创建时间
|
|
|
+ ModifyTime string // 修改时间
|
|
|
+ EdbExist int `description:"edb是否存在"`
|
|
|
+ DataList []*BaseFromOilchemData `gorm:"-"`
|
|
|
+ Paging *paging.PagingItem `description:"分页数据" gorm:"-"`
|
|
|
}
|
|
|
|
|
|
type BaseFromOilchemIndexListResp struct {
|
|
@@ -113,7 +113,7 @@ LEFT JOIN edb_info AS e ON a.index_code=e.edb_code AND e.source=89
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetOilchemIndexList(condition string, pars interface{}, startSize, pageSize int) (items []*BaseFromOilchemIndex, err error) {
|
|
|
+func GetOilchemIndexList(condition string, pars []interface{}, startSize, pageSize int) (items []*BaseFromOilchemIndex, err error) {
|
|
|
o := global.DbMap[utils.DbNameIndex]
|
|
|
sql := ` SELECT * FROM base_from_oilchem_index WHERE 1=1 `
|
|
|
if condition != "" {
|
|
@@ -121,31 +121,32 @@ func GetOilchemIndexList(condition string, pars interface{}, startSize, pageSize
|
|
|
}
|
|
|
|
|
|
sql += `group BY index_code ASC order by create_time DESC LIMIT ?,? `
|
|
|
- err = o.Raw(sql, pars, startSize, pageSize).Find(&items).Error
|
|
|
+ pars = append(pars, startSize, pageSize)
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetOilchemIndexListCount(condition string, pars interface{}) (count int, err error) {
|
|
|
+func GetOilchemIndexListCount(condition string, pars []interface{}) (count int, err error) {
|
|
|
o := global.DbMap[utils.DbNameIndex]
|
|
|
sql := ` SELECT COUNT(1) AS count FROM base_from_oilchem_index WHERE 1=1 `
|
|
|
if condition != "" {
|
|
|
sql += condition
|
|
|
}
|
|
|
- err = o.Raw(sql, pars).Scan(&count).Error
|
|
|
+ err = o.Raw(sql, pars...).Scan(&count).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetOilchemDataListCount(condition string, pars interface{}) (count int, err error) {
|
|
|
+func GetOilchemDataListCount(condition string, pars []interface{}) (count int, err error) {
|
|
|
o := global.DbMap[utils.DbNameIndex]
|
|
|
sql := ` SELECT COUNT(1) AS count FROM base_from_oilchem_data WHERE 1=1 `
|
|
|
if condition != "" {
|
|
|
sql += condition
|
|
|
}
|
|
|
- err = o.Raw(sql, pars).Scan(&count).Error
|
|
|
+ err = o.Raw(sql, pars...).Scan(&count).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetOilchemIndexData(condition string, pars interface{}, startSize, pageSize int) (items []*BaseFromOilchemData, err error) {
|
|
|
+func GetOilchemIndexData(condition string, pars []interface{}, startSize, pageSize int) (items []*BaseFromOilchemData, err error) {
|
|
|
o := global.DbMap[utils.DbNameIndex]
|
|
|
sql := ` SELECT * FROM base_from_oilchem_data WHERE 1=1 `
|
|
|
if condition != "" {
|
|
@@ -153,7 +154,8 @@ func GetOilchemIndexData(condition string, pars interface{}, startSize, pageSize
|
|
|
}
|
|
|
|
|
|
sql += ` order by data_time DESC LIMIT ?,? `
|
|
|
- err = o.Raw(sql, pars, startSize, pageSize).Find(&items).Error
|
|
|
+ pars = append(pars, startSize, pageSize)
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
|
return
|
|
|
}
|
|
|
|