提交 | 用户 | 时间
|
1ac2bc
|
1 |
package cn.stylefeng.guns.base.db.dao.sqls; |
懒 |
2 |
|
|
3 |
/** |
|
4 |
* 异构sql获取 |
|
5 |
* |
|
6 |
* @author fengshuonan |
|
7 |
* @date 2019-07-16-13:13 |
|
8 |
*/ |
|
9 |
public abstract class AbstractSql { |
|
10 |
|
|
11 |
/** |
|
12 |
* 获取异构sql |
|
13 |
* |
|
14 |
* @author fengshuonan |
|
15 |
* @Date 2019-07-16 13:14 |
|
16 |
*/ |
|
17 |
public String getSql(String jdbcUrl) { |
|
18 |
if (jdbcUrl.contains("oracle")) { |
|
19 |
return oracle(); |
|
20 |
} else if (jdbcUrl.contains("postgresql")) { |
|
21 |
return pgSql(); |
|
22 |
} else if (jdbcUrl.contains("sqlserver")) { |
|
23 |
return sqlServer(); |
|
24 |
} else { |
|
25 |
return mysql(); |
|
26 |
} |
|
27 |
} |
|
28 |
|
|
29 |
protected abstract String mysql(); |
|
30 |
|
|
31 |
protected abstract String sqlServer(); |
|
32 |
|
|
33 |
protected abstract String pgSql(); |
|
34 |
|
|
35 |
protected abstract String oracle(); |
|
36 |
|
|
37 |
} |