示例中从前端传入了数据源信息
实际使用的时候请采用更加安全合理的方式
并注意在返回响应时去掉数据源相关信息
不同的表进行批量增删改示例
示例中采用了注释+切面的方式,使saveBatch方法在统一数据源下,可以根据事务进行回滚
请求示例
[
{
"method": "post",
"data": {
"CZKTEST40": {
"business_code": "f15afbd7-5f82-413d-85a6-d2054d60061a",
"item_code": 1,
"id": "010",
"@dsUrl": "jdbc:mysql://10.133.92.80:3306/erp_dev_demo?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true",
"@dsUserName": "root",
"@dsPassword": "Mysql@2020"
}
}
},
{
"method": "post",
"data": {
"CZKTEST40": {
"business_code": "f15afbd7-5f82-413d-85a6-d2054d60061a",
"item_code": 1,
"id": "020",
"@dsUrl": "jdbc:mysql://10.133.92.80:3306/erp_dev_demo?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true",
"@dsUserName": "root",
"@dsPassword": "Mysql@2020"
}
}
}
]
响应示例
[
{
"msg": "success",
"CZKTEST40": {
"msg": "success",
"code": 200,
"@dsPassword": "Mysql@2020",
"@dsUserName": "root",
"count": 1,
"id": "010",
"ok": true,
"@dsUrl": "jdbc:mysql://10.133.92.80:3306/erp_dev_demo?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true"
},
"code": 200,
"ok": true
},
{
"msg": "success",
"CZKTEST40": {
"msg": "success",
"code": 200,
"@dsPassword": "Mysql@2020",
"@dsUserName": "root",
"count": 1,
"id": "020",
"ok": true,
"@dsUrl": "jdbc:mysql://10.133.92.80:3306/erp_dev_demo?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true"
},
"code": 200,
"ok": true
}
]