|
@@ -17,7 +17,7 @@ func RzdIndexData(classifyId int, frequency string, currentIndex, startSize, pag
|
|
|
var pars []interface{}
|
|
|
if classifyId >= 0 {
|
|
|
// 递归查询子集分类
|
|
|
- classifyIdList, err := recursiveQuery(classifyId)
|
|
|
+ classifyIdList, err := RzdClassifyRecursiveQuery(classifyId)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
@@ -99,8 +99,8 @@ func RzdIndexData(classifyId int, frequency string, currentIndex, startSize, pag
|
|
|
return resultList, nil
|
|
|
}
|
|
|
|
|
|
-// 递归查询分类
|
|
|
-func recursiveQuery(classifyId int) ([]int, error) {
|
|
|
+// RzdClassifyRecursiveQuery 递归查询分类
|
|
|
+func RzdClassifyRecursiveQuery(classifyId int) ([]int, error) {
|
|
|
var classifyIdList []int
|
|
|
|
|
|
// 查询当前分类 ID 的子分类
|
|
@@ -115,7 +115,7 @@ func recursiveQuery(classifyId int) ([]int, error) {
|
|
|
classifyIdList = append(classifyIdList, classify.BaseFromRzdClassifyId)
|
|
|
|
|
|
// 递归查询当前子分类的子分类
|
|
|
- childIds, err := recursiveQuery(classify.BaseFromRzdClassifyId)
|
|
|
+ childIds, err := RzdClassifyRecursiveQuery(classify.BaseFromRzdClassifyId)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
@@ -129,7 +129,7 @@ func recursiveQuery(classifyId int) ([]int, error) {
|
|
|
|
|
|
func GetRzdIndexFrequency(classify int) ([]*string, error) {
|
|
|
|
|
|
- classifyIdList, err := recursiveQuery(classify)
|
|
|
+ classifyIdList, err := RzdClassifyRecursiveQuery(classify)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
@@ -148,7 +148,7 @@ func RzdIndexAddValidate(req *data_manage.BaseFromRzdIndexBatchAddCheckReq) ([]*
|
|
|
var pars []interface{}
|
|
|
|
|
|
if req.IsCheckAll {
|
|
|
- if len(req.ClassifyIdList) >= 0 {
|
|
|
+ if len(req.ClassifyIdList) > 0 {
|
|
|
condition += ` AND base_from_rzd_classify_id in (` + utils.GetOrmInReplace(len(req.ClassifyIdList)) + `)`
|
|
|
for _, id := range req.ClassifyIdList {
|
|
|
pars = append(pars, id)
|
|
@@ -366,7 +366,7 @@ func GetRzdIndexInfo(keyWord string, classifyIdList []string, frequencyList []st
|
|
|
}
|
|
|
|
|
|
// GetRzdIndexDetail 获取指标详情
|
|
|
-func GetRzdIndexDetail(indexCode string) (rzdIndexInfoList *data_manage.BaseFromRzdIndexList, err error) {
|
|
|
+func GetRzdIndexDetail(indexCode string, currentIndex, startSize, pageSize int) (rzdIndexInfoList *data_manage.BaseFromRzdIndexList, err error) {
|
|
|
|
|
|
// 获取指标
|
|
|
var condition string
|
|
@@ -384,11 +384,32 @@ func GetRzdIndexDetail(indexCode string) (rzdIndexInfoList *data_manage.BaseFrom
|
|
|
if len(rzdIndexList) > 0 {
|
|
|
rzdIndex = rzdIndexList[0]
|
|
|
// 查询指标数据
|
|
|
- dataList, err := data_manage.GetBaseFormRzdDataByIndexCode(indexCode)
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+ condition += ` and index_code = ?`
|
|
|
+ pars = append(pars, indexCode)
|
|
|
+
|
|
|
+ count, err := data_manage.GetBaseFormRzdDataByConditionCount(condition, pars)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
- rzdIndex.DataList = dataList
|
|
|
+ pagingItem := paging.GetPaging(currentIndex, pageSize, count)
|
|
|
+ if count <= 0 {
|
|
|
+ rzdIndex.Paging = pagingItem
|
|
|
+ } else {
|
|
|
+ condition += ` ORDER BY data_time desc`
|
|
|
+
|
|
|
+ condition += ` LIMIT ?, ?`
|
|
|
+ pars = append(pars, startSize, pageSize)
|
|
|
+
|
|
|
+ dataList, err := data_manage.GetBaseFormRzdDataByCondition(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ rzdIndex.Paging = pagingItem
|
|
|
+ rzdIndex.DataList = dataList
|
|
|
+ }
|
|
|
|
|
|
// 查询是否在指标库
|
|
|
edbInfo, err := data_manage.GetEdbInfoByEdbCode(utils.DATA_SOURCE_RZD, indexCode)
|