|
@@ -35,6 +35,7 @@ type BaseFromSciHqIndexView struct {
|
|
|
EndDate string `description:"结束日期"`
|
|
|
Sort int `description:"排序"`
|
|
|
EdbExist int `description:"edb是否存在"`
|
|
|
+ ModifyTime string
|
|
|
}
|
|
|
|
|
|
func (b *BaseFromSciHqIndex) Update(cols []string) (err error) {
|
|
@@ -135,9 +136,13 @@ func GetSciHqIndexCountByClassifyIds(classifyIds []int) (count int, err error) {
|
|
|
}
|
|
|
|
|
|
// GetSciHqIndexByClassifyId 根据分类id获取卓创红期指标列表
|
|
|
-func GetSciHqIndexByClassifyId(classifyId, startSize, pageSize int) (items []*BaseFromSciHqIndex, err error) {
|
|
|
+func GetSciHqIndexByClassifyId(classifyId, startSize, pageSize int) (items []*BaseFromSciHqIndexView, err error) {
|
|
|
o := orm.NewOrmUsingDB("data")
|
|
|
- sql := ` SELECT * FROM base_from_sci_hq_index WHERE classify_id = ? ORDER BY sort ASC LIMIT ?,? `
|
|
|
+ sql := ` SELECT b.*, e.edb_info_id,
|
|
|
+ CASE WHEN e.edb_info_id IS NULL THEN 0 ELSE 1 END AS edb_exist
|
|
|
+ FROM base_from_sci_hq_index AS b
|
|
|
+ LEFT JOIN edb_info AS e ON b.index_code=e.edb_code AND e.source=88
|
|
|
+ WHERE b.classify_id = ? ORDER BY b.sort ASC LIMIT ?,? `
|
|
|
_, err = o.Raw(sql, classifyId, startSize, pageSize).QueryRows(&items)
|
|
|
return
|
|
|
}
|
|
@@ -158,9 +163,13 @@ func GetSciHqIndexCount() (count int, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetSciHqIndexByPage(startSize, pageSize int) (items []*BaseFromSciHqIndex, err error) {
|
|
|
+func GetSciHqIndexByPage(startSize, pageSize int) (items []*BaseFromSciHqIndexView, err error) {
|
|
|
o := orm.NewOrmUsingDB("data")
|
|
|
- sql := ` SELECT * FROM base_from_sci_hq_index ORDER BY modify_time DESC LIMIT ?,?`
|
|
|
+ sql := ` SELECT b.*, e.edb_info_id,
|
|
|
+ CASE WHEN e.edb_info_id IS NULL THEN 0 ELSE 1 END AS edb_exist
|
|
|
+ FROM base_from_sci_hq_index AS b
|
|
|
+ LEFT JOIN edb_info AS e ON b.index_code=e.edb_code AND e.source=88
|
|
|
+ ORDER BY b.modify_time DESC LIMIT ?,?`
|
|
|
_, err = o.Raw(sql, startSize, pageSize).QueryRows(&items)
|
|
|
return
|
|
|
}
|