|
@@ -45,7 +45,7 @@ type BaseFromMysteelChemicalIndexItem struct {
|
|
|
IndexName string `description:"指标名称"`
|
|
|
Unit string `description:"单位"`
|
|
|
Frequency string `description:"频度"`
|
|
|
- Source string `description:"数据来源"`
|
|
|
+ Source string `description:"数据来源"`
|
|
|
StartDate string `description:"开始日期"`
|
|
|
EndDate string `description:"结束日期"`
|
|
|
CreateTime string `description:"创建时间"`
|
|
@@ -56,13 +56,15 @@ type BaseFromMysteelChemicalIndexItem struct {
|
|
|
IsStop int `description:"是否停更:1:停更,0:未停更"`
|
|
|
EdbExist int `description:"指标库是否已添加:0-否;1-是"`
|
|
|
}
|
|
|
-func (m *BaseFromMysteelChemicalIndexItem) AfterFind(tx * gorm.DB) (err error) {
|
|
|
- m.StartDate=utils.GormDateStrToDateStr(m.StartDate)
|
|
|
- m.EndDate =utils.GormDateStrToDateStr(m.EndDate)
|
|
|
- m.CreateTime=utils.GormDateStrToDateTimeStr(m.CreateTime)
|
|
|
- m.ModifyTime=utils.GormDateStrToDateTimeStr(m.ModifyTime)
|
|
|
+
|
|
|
+func (m *BaseFromMysteelChemicalIndexItem) AfterFind(tx *gorm.DB) (err error) {
|
|
|
+ m.StartDate = utils.GormDateStrToDateStr(m.StartDate)
|
|
|
+ m.EndDate = utils.GormDateStrToDateStr(m.EndDate)
|
|
|
+ m.CreateTime = utils.GormDateStrToDateTimeStr(m.CreateTime)
|
|
|
+ m.ModifyTime = utils.GormDateStrToDateTimeStr(m.ModifyTime)
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
var BaseFromMysteelChemicalIndexCols = struct {
|
|
|
BaseFromMysteelChemicalIndexId string
|
|
|
IndexCode string
|
|
@@ -98,7 +100,7 @@ func (m *BaseFromMysteelChemicalIndex) GeItemsByCondition(condition string, pars
|
|
|
pars = make([]interface{}, 0)
|
|
|
}
|
|
|
//pars = append(pars, utils.DATA_SOURCE_MYSTEEL_CHEMICAL)
|
|
|
- pars=utils.ForwardPars(pars,utils.DATA_SOURCE_MYSTEEL_CHEMICAL)
|
|
|
+ pars = utils.ForwardPars(pars, utils.DATA_SOURCE_MYSTEEL_CHEMICAL)
|
|
|
sql := `select a.*,b.edb_info_id,b.unique_code as edb_unique_code,b.classify_id as edb_classify_id FROM base_from_mysteel_chemical_index AS a LEFT JOIN edb_info b on a.index_code=b.edb_code AND b.source=? WHERE 1=1 `
|
|
|
if condition != "" {
|
|
|
sql += condition
|
|
@@ -205,7 +207,7 @@ type MysteelChemicalList struct {
|
|
|
}
|
|
|
|
|
|
func (m *MysteelChemicalList) AfterFind(tx *gorm.DB) (err error) {
|
|
|
- m.UpdateTime = utils.GormDateStrToDateTimeStr(m.UpdateTime)
|
|
|
+ m.UpdateTime = utils.GormDateStrToDateTimeStr(m.UpdateTime)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -216,7 +218,7 @@ type MysteelChemicalData struct {
|
|
|
}
|
|
|
|
|
|
func (m *MysteelChemicalData) AfterFind(tx *gorm.DB) (err error) {
|
|
|
- m.DataTime = utils.GormDateStrToDateStr(m.DataTime)
|
|
|
+ m.DataTime = utils.GormDateStrToDateStr(m.DataTime)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -346,9 +348,9 @@ func GetBaseFromMysteelChemicalDataTimeByIndexId(indexIdList []int) (items []str
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
- for i := range items {
|
|
|
- items[i] = utils.GormDateStrToDateStr(items[i])
|
|
|
- }
|
|
|
+ for i := range items {
|
|
|
+ items[i] = utils.GormDateStrToDateStr(items[i])
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -548,7 +550,7 @@ type BaseRefreshEdbInfo struct {
|
|
|
}
|
|
|
|
|
|
func (obj *BaseRefreshEdbInfo) AfterFind(tx *gorm.DB) (err error) {
|
|
|
- obj.EndDate = utils.GormDateStrToDateStr(obj.EndDate)
|
|
|
+ obj.EndDate = utils.GormDateStrToDateStr(obj.EndDate)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -755,3 +757,36 @@ func GetNotIsSupplierStopIndexByCodeList(codeList []string, isStop int) (items [
|
|
|
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+type MysteelChemicalPageListResp struct {
|
|
|
+ List []*MysteelChemicalList
|
|
|
+ Paging *paging.PagingItem `description:"分页数据"`
|
|
|
+}
|
|
|
+
|
|
|
+// GetNoEdbMysteelChemicalIndexCount 获取未加入指标库的钢联原始指标-分页
|
|
|
+func GetNoEdbMysteelChemicalIndexCount(condition string, pars []interface{}) (count int, err error) {
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
|
+ sql := fmt.Sprintf(`SELECT COUNT(1) FROM base_from_mysteel_chemical_index WHERE 1=1 AND index_code NOT IN (
|
|
|
+ SELECT DISTINCT edb_code FROM edb_info WHERE source = %d
|
|
|
+ ) `, utils.DATA_SOURCE_MYSTEEL_CHEMICAL)
|
|
|
+ if condition != "" {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
+ err = o.Raw(sql, pars...).Scan(&count).Error
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// GetNoEdbMysteelChemicalIndexPageList 获取未加入指标库的钢联原始指标-分页
|
|
|
+func GetNoEdbMysteelChemicalIndexPageList(condition string, pars []interface{}, startSize, pageSize int) (items []*MysteelChemicalList, err error) {
|
|
|
+ o := global.DbMap[utils.DbNameIndex]
|
|
|
+ sql := fmt.Sprintf(`SELECT * FROM base_from_mysteel_chemical_index WHERE 1=1 AND index_code NOT IN (
|
|
|
+ SELECT DISTINCT edb_code FROM edb_info WHERE source = %d
|
|
|
+ ) `, utils.DATA_SOURCE_MYSTEEL_CHEMICAL)
|
|
|
+ if condition != "" {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
+ sql += ` ORDER BY base_from_mysteel_chemical_index_id ASC LIMIT ?,?`
|
|
|
+ pars = append(pars, startSize, pageSize)
|
|
|
+ err = o.Raw(sql, pars...).Find(&items).Error
|
|
|
+ return
|
|
|
+}
|