|
@@ -24,17 +24,13 @@
|
|
|
* *********************************************************************************************************************
|
|
|
*/
|
|
|
|
|
|
-package com.persagy.service.postgresql.controllers
|
|
|
+package com.persagy.service.mysql.controllers
|
|
|
|
|
|
import com.persagy.service.SObjectService
|
|
|
-import com.persagy.service.models.requests.SQueryRequest
|
|
|
-import com.persagy.service.models.responses.SQueryResponse
|
|
|
-import com.persagy.service.postgresql.models.SColumn
|
|
|
-import com.persagy.service.postgresql.models.STable
|
|
|
+import com.persagy.service.mysql.models.SColumn
|
|
|
+import com.persagy.service.mysql.models.STable
|
|
|
import io.swagger.annotations.Api
|
|
|
-import io.swagger.annotations.ApiImplicitParam
|
|
|
import io.swagger.annotations.ApiOperation
|
|
|
-import org.springframework.beans.factory.annotation.Autowired
|
|
|
import org.springframework.web.bind.annotation.*
|
|
|
|
|
|
/**
|
|
@@ -73,16 +69,34 @@ class SDatabaseDocController {
|
|
|
*/
|
|
|
@ApiOperation(value="查询字段信息", notes="")
|
|
|
@RequestMapping(value = ["/column-list"], method = [RequestMethod.GET, RequestMethod.POST])
|
|
|
- fun columnList(schema: String, table: String): List<Any> {
|
|
|
+ fun columnList(schema: String, table: String): ArrayList<SColumn> {
|
|
|
val builder = columnService.select("schemaName" to schema, "tableName" to table)
|
|
|
-// builder.tableName =
|
|
|
-// "(SELECT *,\n" +
|
|
|
-// " (SELECT \"description\" FROM \"pg_description\"\n" +
|
|
|
-// " JOIN \"pg_class\" ON \"pg_description\".\"objoid\" = \"pg_class\".\"oid\"\n" +
|
|
|
-// " JOIN \"pg_namespace\" ON \"pg_class\".\"relnamespace\" = \"pg_namespace\".\"oid\"\n" +
|
|
|
-// "WHERE \"relname\" = \"t\".\"table_name\" and \"nspname\"= \"t\".\"table_schema\" and \"objsubid\" = \"t\".\"ordinal_position\")\n" +
|
|
|
-// "FROM \"information_schema\".\"columns\" t) ct"
|
|
|
+ builder.tableName =
|
|
|
+ "(SELECT *,\n" +
|
|
|
+ " (SELECT \"description\" FROM \"pg_description\"\n" +
|
|
|
+ " JOIN \"pg_class\" ON \"pg_description\".\"objoid\" = \"pg_class\".\"oid\"\n" +
|
|
|
+ " JOIN \"pg_namespace\" ON \"pg_class\".\"relnamespace\" = \"pg_namespace\".\"oid\"\n" +
|
|
|
+ "WHERE \"relname\" = \"t\".\"table_name\" and \"nspname\"= \"t\".\"table_schema\" and \"objsubid\" = \"t\".\"ordinal_position\")\n" +
|
|
|
+ "FROM \"information_schema\".\"columns\" t) ct"
|
|
|
return builder.exec()
|
|
|
//return mapper.columnList(schema, table)
|
|
|
} // Function columnList()
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询表、字段信息
|
|
|
+ */
|
|
|
+ @ApiOperation(value="查询字段信息", notes="")
|
|
|
+ @RequestMapping(value = ["/table-info"], method = [RequestMethod.GET, RequestMethod.POST])
|
|
|
+ fun tableInfo(schema: String, table: String): STable {
|
|
|
+ val sTable = STable()
|
|
|
+ sTable.schemaName = schema
|
|
|
+ sTable.tableName = table
|
|
|
+ sTable.columnList = columnList(schema, table)
|
|
|
+ return sTable
|
|
|
+ } // Function
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
} // Class SDatabaseDocController
|