|
@@ -143,7 +143,7 @@ func GetRzdIndexFrequency(classify int) ([]*string, error) {
|
|
|
}
|
|
|
|
|
|
// RzdIndexAddValidate 指标添加校验
|
|
|
-func RzdIndexAddValidate(req *data_manage.BaseFromRzdIndexBatchAddCheckReq) (*data_manage.BaseFromRzdIndexPage, error) {
|
|
|
+func RzdIndexAddValidate(req *data_manage.BaseFromRzdIndexBatchAddCheckReq) ([]*data_manage.BaseFromRzdIndexAndData, error) {
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
|
|
@@ -154,9 +154,11 @@ func RzdIndexAddValidate(req *data_manage.BaseFromRzdIndexBatchAddCheckReq) (*da
|
|
|
pars = append(pars, id)
|
|
|
}
|
|
|
}
|
|
|
- if req.Frequency != "" {
|
|
|
- condition += ` AND frequency=? `
|
|
|
- pars = append(pars, req.Frequency)
|
|
|
+ if len(req.FrequencyList) > 0 {
|
|
|
+ condition += ` AND frequency in (` + utils.GetOrmInReplace(len(req.FrequencyList)) + `)`
|
|
|
+ for _, frequency := range req.FrequencyList {
|
|
|
+ pars = append(pars, frequency)
|
|
|
+ }
|
|
|
}
|
|
|
if req.SearchParams != "" {
|
|
|
condition += ` AND index_name like ? or index_code ?`
|
|
@@ -177,40 +179,22 @@ func RzdIndexAddValidate(req *data_manage.BaseFromRzdIndexBatchAddCheckReq) (*da
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if req.PageSize <= 0 {
|
|
|
- req.PageSize = utils.PageSize20
|
|
|
- }
|
|
|
- if req.CurrentIndex <= 0 {
|
|
|
- req.CurrentIndex = 1
|
|
|
- }
|
|
|
- startSize := utils.StartIndex(req.CurrentIndex, req.PageSize)
|
|
|
-
|
|
|
count, err := data_manage.GetRzdIndexNotExistEdbInfoCount(condition, pars)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
- page := paging.GetPaging(req.CurrentIndex, req.PageSize, count)
|
|
|
|
|
|
- result := data_manage.BaseFromRzdIndexPage{}
|
|
|
- result.Paging = page
|
|
|
-
|
|
|
- if count <= 0 {
|
|
|
- return &result, nil
|
|
|
- } else if count > 30 {
|
|
|
- return &result, fmt.Errorf("批量添加指标数量不得超过30个")
|
|
|
+ if count > 30 {
|
|
|
+ return nil, fmt.Errorf("批量添加指标数量不得超过30个")
|
|
|
}
|
|
|
|
|
|
condition += ` ORDER BY base_from_rzd_index_id asc`
|
|
|
|
|
|
- condition += ` limit ?, ?`
|
|
|
- pars = append(pars, startSize, req.PageSize)
|
|
|
-
|
|
|
indexList, err := data_manage.GetRzdIndexNotExistEdbInfoPage(condition, pars)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
- result.List = indexList
|
|
|
- return &result, nil
|
|
|
+ return indexList, nil
|
|
|
}
|
|
|
|
|
|
// RzdIndexNameCheck 指标名称校验
|