1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
package com.nis.util;
import java.util.Map;
import com.nis.util.SqlHelper.KeywordsType;
public abstract class SQLUtils {
protected Map<KeywordsType, String> keywords;
/**
* @Description 创建表
* @Author rui
* @Date 2019/7/31
* @Param tableName:表名 fields:字段及其字段约束 字段名--字段约束
* @Return
* @Exception
*/
public abstract String createTable(String tableName, Map<String,String> fields);
/**
* @Description 根据表名查询表是否存在数据库
* @Author rui
* @Date 2019/7/31
* @Param tableName:表名
* @Return
* @Exception
*/
public abstract String queryTables(String tableName);
/**
* @Description 添加索引
* @Author rui
* @Date 2019/7/31
* @Param tableName:表名 indexs:索引名称及要添加索引的字段名称数组
* @Return
* @Exception
*/
public abstract String addIndexs(String tableName,Map<String,String[]> indexs);
/**
* @Description 删除索引
* @Author rui
* @Date 2019/7/31
* @Param tableName:表名 indexNames :索引名称数组
* @Return
* @Exception
*/
public abstract String delIndexs(String tableName,String ... indexNames);
/**
* @Description 删除表
* @Author rui
* @Date 2019/7/31
* @Param tableName:表名
* @Return
* @Exception
*/
public abstract String dropTable(String tableName);
/**
* @Description 添加表字段
* @Author rui
* @Date 2019/7/31
* @Param tableName:表名 fields:字段及其字段约束 字段名--字段约束
* @Return
* @Exception
*/
public abstract String addFields(String tableName,Map<String,String> fields);
/**
* @Description 删除表字段
* @Author rui
* @Date 2019/7/31
* @Param tableName:表名 fields:字段名称数组
* @Return
* @Exception
*/
public abstract String delFields(String tableName,String ... fields);
/**
* @Description 修改字段类型及长度
* @Author rui
* @Date 2019/7/31
* @Param tableName:表名 fields:字段及其字段约束 字段名--字段约束
* @Return
* @Exception
*/
public abstract String modifyFields(String tableName,Map<String,String> fields);
/**
* @Description 生成字段约束
* @Author rui
* @Date 2019/7/31
* @Param key :字段的类型 dataLenth 字段长度,
*@Param decimal类型默认及最大长度65 整数类型 mysql默认及最大长度20 postgresql默认及最大64 oracle默认及最大38
* @Param limit 只对decimal类型生效,默认2
* @Return
* @Exception
*/
public abstract String getRestrict(KeywordsType key, Integer dataLenth, Integer limit);
}
|