zhou.xiaoning 4 yıl önce
ebeveyn
işleme
74e4d5984d
3 değiştirilmiş dosya ile 45 ekleme ve 52 silme
  1. 42 49
      config/config.xml
  2. 1 1
      controllers/common/table.go
  3. 2 2
      models/common.go

+ 42 - 49
config/config.xml

@@ -1,52 +1,45 @@
 <?xml version="1.0" encoding="utf-8"?>
-
 <Configuration xmlns:http="http://www.w3.org/2001/XMLSchema-instance">
-    <WebSetting>
-        <ListenAddress value="0.0.0.0:8080"/>
-        <DebugMode value="1"/>
-    </WebSetting>
-
-    <LogSetting>
-        <LogPath value="log"/>
-        <LogLevel value="5"/>
-    </LogSetting>
-
-    <DbSetting>
-        <DbDriver  value="oci8"/>
-        <DbAddress value="192.168.31.117"/>
-        <DbName    value="orcl"/>
-        <DbPort    value="1521"/>
-        <DbUser    value="mtp2_test82"/>
-        <DbPwd     value="muchinfo"/>
-    </DbSetting>
-
-    <RedisSetting>
-        <Address   value="192.168.30.182"/>
-        <Port      value="5007"/>
-        <Timeout   value="3"/>
-        <ConnNum   value="1"/>
-        <DbNum     value="0"/>
-        <Pwd       value=""/>
-    </RedisSetting>
-
-    <MqSetting>
-        <Url       value="amqp://guest:guest@192.168.30.182:5020/test"/>
-        <Exchange  value="entry"/>
-    </MqSetting>
-
-    <MongoDBSetting>
-        <HostName   value="192.168.30.182"/>
-        <Port       value="5025"/>
-        <DBName     value="HistoryQuote"/>
-        <Username   value="quote_test01"/>
-        <Password   value="123456"/>
-    </MongoDBSetting>
-
-    <MySQLSetting>
-        <Host       value="192.168.30.140"/>
-        <Port       value="3306"/>
-        <DBName     value="historyquote_test166"/>
-        <Username   value="quote_test166"/>
-        <Password   value="123456"/>
-    </MySQLSetting>
+  <WebSetting>
+    <ListenAddress value="0.0.0.0:8080"/>
+    <DebugMode value="1"/>
+  </WebSetting>
+  <LogSetting>
+    <LogPath value="/home/pub/mtp2.0/log/queryservice"/>
+    <LogLevel value="5"/>
+  </LogSetting>
+  <DbSetting>
+    <DbDriver value="oci8"/>
+    <DbAddress value="192.168.31.117"/>
+    <DbName value="orcl"/>
+    <DbPort value="1521"/>
+    <DbUser value="mtp2_test104"/>
+    <DbPwd value="muchinfo"/>
+  </DbSetting>
+  <RedisSetting>
+    <Address value="192.168.31.104"/>
+    <Port value="5007"/>
+    <Timeout value="3"/>
+    <ConnNum value="1"/>
+    <DbNum value="0"/>
+    <Pwd value=""/>
+  </RedisSetting>
+  <MqSetting>
+    <Url value="amqp://guest:guest@192.168.31.104:5020/test"/>
+    <Exchange value="entry"/>
+  </MqSetting>
+  <MongoDBSetting>
+    <HostName value="192.168.31.104"/>
+    <Port value="5025"/>
+    <DBName value="HistoryQuote"/>
+    <Username value="quote_test01"/>
+    <Password value="123456"/>
+  </MongoDBSetting>
+  <MySQLSetting>
+    <Host value="192.168.30.113"/>
+    <Port value="3306"/>
+    <DBName value="historyquote_test104"/>
+    <Username value="quote_test104"/>
+    <Password value="123456"/>
+  </MySQLSetting>
 </Configuration>

+ 1 - 1
controllers/common/table.go

@@ -110,7 +110,7 @@ func QueryTableDefine(c *gin.Context) {
 		// 表数据
 		queryTableDefineRsp.Tabledefine = tableDefines[i]
 		// 获取列表数据
-		tablecolumnconfigs, err := models.GetClientTableColumns(v.Tablekey)
+		tablecolumnconfigs, err := models.GetClientTableColumns(v.Tablekey, int(v.Tabletype))
 		if err != nil {
 			logger.GetLogger().Errorf("QueryTableDefine failed: %s", err.Error())
 			appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)

+ 2 - 2
models/common.go

@@ -471,14 +471,14 @@ func GetClientTableDefines(tableKey string, tableType int) ([]Tabledefine, error
 
 // GetClientTableColumns 获取客户端指定表的列头信息
 // tableKey 列表Key
-func GetClientTableColumns(tableKey string) ([]Tablecolumnconfig, error) {
+func GetClientTableColumns(tableKey string, tableType int) ([]Tablecolumnconfig, error) {
 	engine := db.GetEngine()
 
 	// 获取列表数据
 	tablecolumnconfigs := make([]Tablecolumnconfig, 0)
 	// 这里的表名必须要大写 (Oracle的表名都是大写)
 	if err := engine.Join("INNER", "TABLEDEFINE", "TABLEDEFINE.TableKey = TABLECOLUMNCONFIG.TableKey").
-		Where("TABLEDEFINE.TableType = 2 and TABLEDEFINE.TableKey = ?", tableKey).Find(&tablecolumnconfigs); err != nil {
+		Where("TABLEDEFINE.TableType = ?", tableType).And("TABLEDEFINE.TableKey = ?", tableKey).Find(&tablecolumnconfigs); err != nil {
 		return nil, err
 	}