|
@@ -250,3 +250,27 @@ func GetEdbDataTableNameAndSubSource(source, subSource int) (tableName string) {
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+func GetBaseIndexTableName(source int) (tableName string) {
|
|
|
+ edbSource := EdbSourceIdMap[source]
|
|
|
+ if edbSource != nil {
|
|
|
+ tableName = edbSource.IndexTableName
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+func GetBaseIndexInfoByEdbCode(edbCode string, source int) (item *BaseIndexInfo, err error) {
|
|
|
+ var pars []interface{}
|
|
|
+ pars = append(pars, edbCode)
|
|
|
+ o := orm.NewOrmUsingDB("data")
|
|
|
+
|
|
|
+ tableName := GetBaseIndexTableName(source)
|
|
|
+ if tableName == "" {
|
|
|
+ err = fmt.Errorf("未找到对应的表")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ sql := ` SELECT * FROM %s WHERE index_code=? `
|
|
|
+
|
|
|
+ sql = fmt.Sprintf(sql, tableName)
|
|
|
+ err = o.Raw(sql, pars).QueryRow(&item)
|
|
|
+ return
|
|
|
+}
|