# 接口设计 - 数据源
## 新增数据源
##### 请求路径
`/Connector/inputDataConnector`
##### 请求方式
`HTTP - POST`
##### 请求参数
| 字段名 | 类型 | 说明 |
| --- | --- | --- |
| dataName | String | 数据源名称 |
| note | String | 数据源说明 |
| loadObject | String | 数据对象[sql] |
| type | enum : ["dataBase", "file"] | 类型 |
| dbConfig | Object | 数据库设置 |
| columnConfig | Array | 列数据 |
| connectorGroup | Number | 所属分组id |

##### 请求示例
```json
{
    "dataName": "文档测试",
    "note": "这个应该可以为空",
    "loadObject": "select * from bench",
    "type": "database",
    "createBy": "admin",
    "dbConfig": {
        "id": "22",
        "addrass": "192.168.253.6",
        "port": "1521",
        "databaseType": "oracle",
        "dataName": "orcl",
        "userName": "UAS",
        "passWord": "select!#%*("
    },
    "columnConfig": [{
        "columnName": "BC_CODE",
        "columnLable": "编号",
        "dataType": "VARCHAR2",
        "columnType": "categorical",
        "isGroup": "1",
        "isSubsection": "0",
        "isOpen": "1",
        "remarks": "编号"
    }, {
        "columnName": "BC_DESC",
        "columnLable": "工作台说明",
        "dataType": "VARCHAR2",
        "columnType": "categorical",
        "isGroup": "1",
        "isSubsection": "0",
        "isOpen": "1",
        "remarks": "工作台说明"
    }, {
        "columnName": "BC_DETNO",
        "columnLable": "序号",
        "dataType": "NUMBER",
        "columnType": "scale",
        "isGroup": "0",
        "isSubsection": "1",
        "isOpen": "1",
        "remarks": "序号"
    }],
    "connectorGroup": "-1"
}
```
##### 返回结果
```json
{
    "data": {
        "code": 200,
        "msg": "成功",
        "data": 71
    }
}
```
##### 详细说明
___
## 修改数据源
##### 请求路径
`/Connector/updateData`
##### 请求方式
`HTTP - POST`
##### 请求参数
| 字段名 | 类型 | 说明 |
| --- | --- | --- |
| dataId | Number | 数据源ID |
| dataName | String | 数据源名称 |
| note | String | 数据源说明 |
| loadObject | String | 数据对象[sql] |
| type | enum : ["dataBase", "file"] | 类型 |
| dbConfig | Object | 数据库设置 |
| columnConfig | Array | 列数据 |
| connectorGroup | Number | 所属分组id |

##### 请求示例
```json
{
    "dataId": 71,
    "dataName": "文档测试1",
    "note": "这个应该可以为空",
    "loadObject": "select * from bench",
    "type": "database",
    "createBy": "admin",
    "connectorGroup": "-1",
    "dbConfig": {
        "id": "11",
        "addrass": "192.168.253.6",
        "port": "1521",
        "databaseType": "oracle",
        "dataName": "orcl",
        "userName": "UAS",
        "passWord": "select!#%*("
    },
    "columnConfig": [{
        "columnName": "BC_CODE",
        "columnLable": "编号",
        "dataType": "VARCHAR2",
        "columnType": "categorical",
        "isGroup": "1",
        "isSubsection": "0",
        "isOpen": "1",
        "remarks": "编号"
    }, {
        "columnName": "BC_DESC",
        "columnLable": "工作台说明",
        "dataType": "VARCHAR2",
        "columnType": "categorical",
        "isGroup": "1",
        "isSubsection": "0",
        "isOpen": "1",
        "remarks": "工作台说明"
    }, {
        "columnName": "BC_DETNO",
        "columnLable": "序号",
        "dataType": "NUMBER",
        "columnType": "scale",
        "isGroup": "0",
        "isSubsection": "1",
        "isOpen": "1",
        "remarks": "序号"
    }]
}
```
##### 返回结果
```json
{
    "data": {
        "code": 200,
        "msg": "成功",
        "data": null
    }
}
```
##### 详细说明
___
## 删除数据源
##### 请求路径
`/Connector/delDataConnector`
##### 请求方式
`HTTP - POST`
##### 请求参数
[ 数据源ID ]

##### 请求示例
```json
[71]
```
##### 返回结果
```json
{
    "data": {
        "code": 200,
        "msg": "成功",
        "data": null
    }
}
```
##### 详细说明
___
## 获取数据源列表
##### 请求路径
`/Connector/getListDataConnector`
##### 请求方式
`HTTP - POST`
##### 请求参数
无 
##### 请求示例
##### 返回结果
```json
{
    "code": 200,
    "msg": "成功",
    "data": [
        {
            "dataId": 43,
            "dataName": "commonuse",
            "note": "1",
            "type": "database",
            "dataTag": "null",
            "dbConfig": "{\"name\":null,\"addrass\":\"10.1.1.168\",\"port\":\"1521\",\"databaseType\":\"oracle\",\"dataName\":\"orcl\",\"userName\":\"YITOA_DATACENTER\",\"passWord\":\"select!#%*(\"}",
            "connectorGroup": 1,
            "usedNumber": 0,
            "createBy": "admin",
            "createDate": "2018-08-02 09:31:53.0"
        },
        {
            "dataId": 50,
            "dataName": "bench_flowchart",
            "note": "1",
            "type": "database",
            "dataTag": "null",
            "dbConfig": "{\"name\":null,\"addrass\":\"10.1.1.168\",\"port\":\"1521\",\"databaseType\":\"oracle\",\"dataName\":\"orcl\",\"userName\":\"YITOA_DATACENTER\",\"passWord\":\"select!#%*(\"}",
            "connectorGroup": -1,
            "usedNumber": 0,
            "createBy": "admin",
            "createDate": "2018-08-02 10:13:59.0"
        },
        {
            "dataId": 49,
            "dataName": "commonuse2",
            "note": "1",
            "type": "database",
            "dataTag": "null",
            "dbConfig": "{\"name\":null,\"addrass\":\"10.1.1.168\",\"port\":\"1521\",\"databaseType\":\"oracle\",\"dataName\":\"orcl\",\"userName\":\"YITOA_DATACENTER\",\"passWord\":\"select!#%*(\"}",
            "connectorGroup": -1,
            "usedNumber": 0,
            "createBy": "admin",
            "createDate": "2018-08-02 10:11:09.0"
        },
        {
            "dataId": 71,
            "dataName": "文档测试1",
            "note": "这个应该可以为空",
            "type": "database",
            "dataTag": "null",
            "dbConfig": "{\"name\":null,\"addrass\":\"192.168.253.6\",\"port\":\"1521\",\"databaseType\":\"oracle\",\"dataName\":\"orcl\",\"userName\":\"UAS\",\"passWord\":\"select!#%*(\"}",
            "connectorGroup": -1,
            "usedNumber": 0,
            "createBy": "admin",
            "createDate": "2018-08-08 15:05:48.0"
        },
        {
            "dataId": 62,
            "dataName": "PROJECT",
            "note": "Y",
            "type": "database",
            "dataTag": "null",
            "dbConfig": "{\"name\":null,\"addrass\":\"192.168.253.6\",\"port\":\"1521\",\"databaseType\":\"oracle\",\"dataName\":\"orcl\",\"userName\":\"UAS\",\"passWord\":\"select!#%*(\"}",
            "connectorGroup": 20,
            "usedNumber": 0,
            "createBy": "admin",
            "createDate": "2018-08-07 15:16:45.0"
        },
        {
            "dataId": 55,
            "dataName": "销售订单",
            "note": "1",
            "type": "database",
            "dataTag": "null",
            "dbConfig": "{\"name\":null,\"addrass\":\"192.168.253.6\",\"port\":\"1521\",\"databaseType\":\"oracle\",\"dataName\":\"orcl\",\"userName\":\"UAS\",\"passWord\":\"select!#%*(\"}",
            "connectorGroup": 1,
            "usedNumber": 0,
            "createBy": "admin",
            "createDate": "2018-08-06 15:20:29.0"
        }
    ]
}
```
##### 详细说明
___
## 获得单个数据源详细数据
##### 请求路径
`/Connector/getDataConnector`
##### 请求方式
`HTTP - POST`
##### 请求参数

code  

##### 请求示例
```json
50
```
##### 返回结果
```json
{
    "code": 200,
    "msg": "成功",
    "data": {
        "dataId": 50,
        "dataName": "bench_flowchart",
        "tableName": null,
        "dbConfig": "{\"name\":null,\"addrass\":\"10.1.1.168\",\"port\":\"1521\",\"databaseType\":\"oracle\",\"dataName\":\"orcl\",\"userName\":\"YITOA_DATACENTER\",\"passWord\":\"select!#%*(\"}",
        "loadObject": "select * from bench_flowchart",
        "connectorGroup": -1,
        "note": "1",
        "columnConfig": "[{\"columnName\":\"ARROW1_\",\"columnLable\":\"起点箭头(line)\",\"columnType\":\"scale\",\"dataType\":\"NUMBER\",\"isGroup\":\"0\",\"isSubsection\":\"1\",\"isOpen\":\"1\",\"remarks\":\"起点箭头(line)正负表示方向，大小表示长度\"},{\"columnName\":\"ARROW2_\",\"columnLable\":\"终点箭头(line)\",\"columnType\":\"scale\",\"dataType\":\"NUMBER\",\"isGroup\":\"0\",\"isSubsection\":\"1\",\"isOpen\":\"1\",\"remarks\":\"终点箭头(line)正负表示方向，大小表示长度\"},{\"columnName\":\"BC_ID\",\"columnLable\":\"工作台ID\",\"columnType\":\"categorical\",\"dataType\":\"VARCHAR2\",\"isGroup\":\"1\",\"isSubsection\":\"0\",\"isOpen\":\"1\",\"remarks\":\"工作台ID\"},{\"columnName\":\"BG_COLOR\",\"columnLable\":\"背景色\",\"columnType\":\"categorical\",\"dataType\":\"VARCHAR2\",\"isGroup\":\"1\",\"isSubsection\":\"0\",\"isOpen\":\"1\",\"remarks\":\"背景色\"},{\"columnName\":\"COLOR_\",\"columnLable\":\"颜色\",\"columnType\":\"categorical\",\"dataType\":\"VARCHAR2\",\"isGroup\":\"1\",\"isSubsection\":\"0\",\"isOpen\":\"1\",\"remarks\":\"颜色\"},{\"columnName\":\"DOT_\",\"columnLable\":\"虚线值\",\"columnType\":\"scale\",\"dataType\":\"NUMBER\",\"isGroup\":\"0\",\"isSubsection\":\"1\",\"isOpen\":\"1\",\"remarks\":\"虚线值\"},{\"columnName\":\"FONT_SIZE\",\"columnLable\":\"字体大小\",\"columnType\":\"categorical\",\"dataType\":\"VARCHAR2\",\"isGroup\":\"1\",\"isSubsection\":\"0\",\"isOpen\":\"1\",\"remarks\":\"字体大小\"},{\"columnName\":\"HEIGHT_\",\"columnLable\":\"组件高度\",\"columnType\":\"scale\",\"dataType\":\"NUMBER\",\"isGroup\":\"0\",\"isSubsection\":\"1\",\"isOpen\":\"1\",\"remarks\":\"组件高度\"},{\"columnName\":\"ID_\",\"columnLable\":\"ID\",\"columnType\":\"scale\",\"dataType\":\"NUMBER\",\"isGroup\":\"0\",\"isSubsection\":\"1\",\"isOpen\":\"1\",\"remarks\":\"ID\"},{\"columnName\":\"ITEMS_\",\"columnLable\":\"\",\"columnType\":\"string\",\"dataType\":\"CLOB\",\"isGroup\":\"0\",\"isSubsection\":\"0\",\"isOpen\":\"1\",\"remarks\":null},{\"columnName\":\"POINTS_\",\"columnLable\":\"坐标点集\",\"columnType\":\"categorical\",\"dataType\":\"VARCHAR2\",\"isGroup\":\"1\",\"isSubsection\":\"0\",\"isOpen\":\"1\",\"remarks\":\"坐标点集\"},{\"columnName\":\"TABNAME_\",\"columnLable\":\"标签名\",\"columnType\":\"categorical\",\"dataType\":\"VARCHAR2\",\"isGroup\":\"1\",\"isSubsection\":\"0\",\"isOpen\":\"1\",\"remarks\":\"标签名\"},{\"columnName\":\"TEXT_\",\"columnLable\":\"组件内容\",\"columnType\":\"categorical\",\"dataType\":\"VARCHAR2\",\"isGroup\":\"1\",\"isSubsection\":\"0\",\"isOpen\":\"1\",\"remarks\":\"组件内容\"},{\"columnName\":\"TYPE_\",\"columnLable\":\"组件类型(node/\",\"columnType\":\"categorical\",\"dataType\":\"VARCHAR2\",\"isGroup\":\"1\",\"isSubsection\":\"0\",\"isOpen\":\"1\",\"remarks\":\"组件类型(node/line)\"},{\"columnName\":\"WIDTH_\",\"columnLable\":\"组件宽度\",\"columnType\":\"scale\",\"dataType\":\"NUMBER\",\"isGroup\":\"0\",\"isSubsection\":\"1\",\"isOpen\":\"1\",\"remarks\":\"组件宽度\"},{\"columnName\":\"X2_\",\"columnLable\":\"终止位置x(line\",\"columnType\":\"scale\",\"dataType\":\"NUMBER\",\"isGroup\":\"0\",\"isSubsection\":\"1\",\"isOpen\":\"1\",\"remarks\":\"终止位置x(line)\"},{\"columnName\":\"X_\",\"columnLable\":\"组件位置x\",\"columnType\":\"scale\",\"dataType\":\"NUMBER\",\"isGroup\":\"0\",\"isSubsection\":\"1\",\"isOpen\":\"1\",\"remarks\":\"组件位置x\"},{\"columnName\":\"Y2_\",\"columnLable\":\"终止位置y(line\",\"columnType\":\"scale\",\"dataType\":\"NUMBER\",\"isGroup\":\"0\",\"isSubsection\":\"1\",\"isOpen\":\"1\",\"remarks\":\"终止位置y(line)\"},{\"columnName\":\"Y_\",\"columnLable\":\"组件位置y\",\"columnType\":\"scale\",\"dataType\":\"NUMBER\",\"isGroup\":\"0\",\"isSubsection\":\"1\",\"isOpen\":\"1\",\"remarks\":\"组件位置y\"}]",
        "dataTag": "null",
        "usedNumber": 0,
        "type": "database",
        "createBy": "admin",
        "createDate": "2018-08-02 10:13:59.0",
        "updateDate": null
    }
}
```
##### 详细说明
___
## 根据sql请求列数据信息
##### 请求路径
`/Connector/implementSql`
##### 请求方式
`HTTP - POST`
##### 请求参数
```json
{
    "id": "数据连接id",
    "strSql": "请求列的sql"
}
```
##### 请求示例
```json
{
	"id": "23",
	"strSql": "select * from Bench"
}
```
##### 返回结果
```json
{
    "code": 200,
    "msg": "成功",
    "data": [
        {
            "columnName": "BC_CODE",
            "columnType": "String",
        },
        {
            "columnName": "BC_DESC",
            "columnType": "String",
        },
        {
            "columnName": "BC_DETNO",
            "columnType": "BigDecimal",
        },
        {
            "columnName": "BC_ICON",
            "columnType": "String",
        },
        {
            "columnName": "BC_ID",
            "columnType": "BigDecimal",
        },
        {
            "columnName": "BC_TITLE",
            "columnType": "String",
        },
        {
            "columnName": "BC_URLCOND",
            "columnType": "String",
        },
        {
            "columnName": "BC_USED",
            "columnType": "BigDecimal",
        }
    ]
}
```
___

## 获得数据源下的列
##### 请求路径
`/DataBase/getColumnData`
##### 请求方式
`HTTP - POST`
##### 请求参数
数据源id
##### 请求示例
23
##### 返回结果
```json
{
    "code": 200,
    "msg": "成功",
    "data": [
        {
            "columnName": "BC_CODE",
            "columnRaname": "BC_CODE",
            "columnType": "String",
            "isGroup": "1",
            "isFilter": "1",
            "isSubsection": "1"
        }
    ]
}
```
___

## 数据源移交
##### 请求路径
`/Connector/changeDbOrder`
##### 请求方式
`HTTP - POST`
##### 请求参数
| 字段名 | 类型 | 说明 |
| --- | --- | --- |
| userId | Number | 用户id |
| id | Number | 数据源id |
##### 请求示例
```json
{
    "userId": "23",
    "id": "157"
}
```
##### 返回结果
```json
{
    "code": 200,
    "msg": "成功",
    "data": [
        {
            "columnName": "BC_CODE",
            "columnRaname": "BC_CODE",
            "columnType": "String",
            "isGroup": "1",
            "isFilter": "1",
            "isSubsection": "1"
        }
    ]
}
```
___
## 获得数据源所有分组/子分组
##### 请求路径
`/Connector/getConnectorGroup`
##### 请求方式
`HTTP - POST`
##### 请求参数
无
##### 请求示例
```json
null
```
##### 返回结果
```json
{
    "code": 200,
    "msg": "成功",
    "data": [
        {
            "id": 1,
            "groupName": "默认分组",
            "groupIndex": 0,
            "fatherId": -1,
            "createBy": "zhuth",
            "createDate": "2018-07-25T22:41:16.000+0000",
            "updataDate": null
        },
        {
            "id": 2,
            "groupName": "默认子分组11",
            "groupIndex": 0,
            "fatherId": 1,
            "createBy": "zhuth",
            "createDate": "2018-07-25T22:49:24.000+0000",
            "updataDate": null
        },
        {
            "id": 3,
            "groupName": "我的分组",
            "groupIndex": 1,
            "fatherId": -1,
            "createBy": "zhuth",
            "createDate": "2018-07-25T23:03:10.000+0000",
            "updataDate": null
        },
        {
            "id": 19,
            "groupName": "默认子分组22",
            "groupIndex": 1,
            "fatherId": 1,
            "createBy": "zhuth",
            "createDate": "2018-07-27T03:39:17.000+0000",
            "updataDate": null
        },
        {
            "id": 41,
            "groupName": "我的子分组2",
            "groupIndex": 1,
            "fatherId": 3,
            "createBy": "zhuth",
            "createDate": "2018-07-28T02:52:16.000+0000",
            "updataDate": null
        },
        {
            "id": 20,
            "groupName": "我的子分组1",
            "groupIndex": 0,
            "fatherId": 3,
            "createBy": "zhuth",
            "createDate": "2018-07-27T07:18:41.000+0000",
            "updataDate": null
        },
        {
            "id": 32,
            "groupName": "默认子分组33",
            "groupIndex": 2,
            "fatherId": 1,
            "createBy": "zhuth",
            "createDate": "2018-07-27T08:06:43.000+0000",
            "updataDate": null
        },
        {
            "id": 42,
            "groupName": "我的子分组3",
            "groupIndex": 2,
            "fatherId": 3,
            "createBy": "zhuth",
            "createDate": "2018-07-28T02:52:18.000+0000",
            "updataDate": null
        }
    ]
}
```
##### 详细说明

___
## 新增数据源分组/子分组
##### 请求路径
`/Connector/setConnectorGroup`
##### 请求方式
`HTTP - POST`
##### 请求参数

| 字段名 | 类型 | 说明 |
| --- | --- | --- |
| fatherId | Number | 父级分组ID |
| groupName | String| 组名 |
| groupIndex | Number | 顺序号 |

##### 请求示例
```json
{
    "fatherId": "-1",
    "groupName": "新分组",
    "groupIndex": 2
}
```
##### 返回结果
```json
{
    "data": {
        "code": 200,
        "msg": "成功",
        "data": 71
    }
}
```
##### 详细说明
如果是顶级分组（没有父级分组），则父级分组ID设置为-1

___
## 修改数据源分组信息
##### 请求路径
`/Connector/updataDataConnectorGroup`
##### 请求方式
`HTTP - POST`
##### 请求参数

| 字段名 | 类型 | 说明 |
|--- | --- | --- |
| Id | Number | 分组ID |
| fatherId | Number | 父级分组ID |
| groupName | String | 组名 |
| groupIndex | Number | 顺序号 |

##### 请求示例
```json
{
    "id": "2",
    "fatherId": "1",
    "groupName": "默认子分组11",
    "groupIndex": 0,
}
```
##### 返回结果
```json
{
    "data": {
        "code": 200,
        "msg": "成功",
        "data": null
    }
}
```
##### 详细说明
___
## 设置数据源所属分组
##### 请求路径
`/Connector/updateConnectConfigGroup`
##### 请求方式
`HTTP - POST`
##### 请求参数

| 字段名 | 类型 | 说明 |
| --- | --- | --- |
| Id | Number | 数据源ID |
| GroupID | Number | 目标分组ID |

##### 请求示例
```json
{
    "id": 71,
    "groupId": "1"
}
```
##### 返回结果
```json
{
    "data": {
        "code": 200,
        "msg": "成功",
        "data": null
    }
}
```
##### 详细说明
___
## 批量修改数据源分组信息
##### 请求路径
`/Connector/updataConnectorGroup`
##### 请求方式
`HTTP - POST`
##### 请求参数

| 字段名 | 类型 | 说明 |
| --- | --- | --- |
| fatherId | Number | 父级分组ID |
| groupName | String | 组名 |
| groupIndex | Number | 顺序号 |

##### 请求示例
```json
[{
    "id": "19",
    "groupName": "默认子分组22",
    "groupIndex": 0,
    "fatherId": "1",
    "createBy": "zhuth"
}, {
    "id": "2",
    "groupName": "默认子分组11",
    "groupIndex": 1,
    "fatherId": "1",
    "createBy": "zhuth"
}, {
    "id": "32",
    "groupName": "默认子分组33",
    "groupIndex": 2,
    "fatherId": "1",
    "createBy": "zhuth"
}]
```
##### 返回结果
```json
{
    "data": {
        "code": 200,
        "msg": "成功",
        "data": null
    }
}
```
##### 详细说明
___
## 删除数据源分组/子分组
##### 请求路径
`/Connector/delDataConnectorGroup`
##### 请求方式
`HTTP - POST`
##### 请求参数

group.code 分组ID

##### 请求示例
```json
71
```
##### 返回结果
```json
{
    "data": {
        "code": 200,
        "msg": "成功",
        "data": null
    }
}
```
##### 详细说明
因为分组是有序的，所以在请求执行删除操作时一般需要同步请求批量更新操作。