1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.mybatis.generator.internal;
17
18 import org.mybatis.generator.api.DAOMethodNameCalculator;
19 import org.mybatis.generator.api.IntrospectedTable;
20 import org.mybatis.generator.internal.rules.Rules;
21
22
23
24
25
26 public class DefaultDAOMethodNameCalculator implements DAOMethodNameCalculator {
27
28
29
30
31 public DefaultDAOMethodNameCalculator() {
32 super();
33 }
34
35 public String getInsertMethodName(IntrospectedTable introspectedTable) {
36 return "insert";
37 }
38
39
40
41
42
43
44
45
46 public String getUpdateByPrimaryKeyWithoutBLOBsMethodName(
47 IntrospectedTable introspectedTable) {
48 Rules rules = introspectedTable.getRules();
49
50 if (!rules.generateUpdateByPrimaryKeyWithBLOBs()) {
51 return "updateByPrimaryKey";
52 } else if (rules.generateRecordWithBLOBsClass()) {
53 return "updateByPrimaryKey";
54 } else {
55 return "updateByPrimaryKeyWithoutBLOBs";
56 }
57 }
58
59
60
61
62
63
64
65
66 public String getUpdateByPrimaryKeyWithBLOBsMethodName(
67 IntrospectedTable introspectedTable) {
68 Rules rules = introspectedTable.getRules();
69
70 if (!rules.generateUpdateByPrimaryKeyWithoutBLOBs()) {
71 return "updateByPrimaryKey";
72 } else if (rules.generateRecordWithBLOBsClass()) {
73 return "updateByPrimaryKey";
74 } else {
75 return "updateByPrimaryKeyWithBLOBs";
76 }
77 }
78
79 public String getDeleteByExampleMethodName(
80 IntrospectedTable introspectedTable) {
81 return "deleteByExample";
82 }
83
84 public String getDeleteByPrimaryKeyMethodName(
85 IntrospectedTable introspectedTable) {
86 return "deleteByPrimaryKey";
87 }
88
89
90
91
92
93
94 public String getSelectByExampleWithoutBLOBsMethodName(
95 IntrospectedTable introspectedTable) {
96 Rules rules = introspectedTable.getRules();
97
98 if (!rules.generateSelectByExampleWithBLOBs()) {
99 return "selectByExample";
100 } else {
101 return "selectByExampleWithoutBLOBs";
102 }
103 }
104
105
106
107
108
109
110 public String getSelectByExampleWithBLOBsMethodName(
111 IntrospectedTable introspectedTable) {
112 Rules rules = introspectedTable.getRules();
113
114 if (!rules.generateSelectByExampleWithoutBLOBs()) {
115 return "selectByExample";
116 } else {
117 return "selectByExampleWithBLOBs";
118 }
119 }
120
121 public String getSelectByPrimaryKeyMethodName(
122 IntrospectedTable introspectedTable) {
123 return "selectByPrimaryKey";
124 }
125
126 public String getUpdateByPrimaryKeySelectiveMethodName(
127 IntrospectedTable introspectedTable) {
128 return "updateByPrimaryKeySelective";
129 }
130
131 public String getCountByExampleMethodName(
132 IntrospectedTable introspectedTable) {
133 return "countByExample";
134 }
135
136 public String getUpdateByExampleSelectiveMethodName(
137 IntrospectedTable introspectedTable) {
138 return "updateByExampleSelective";
139 }
140
141 public String getUpdateByExampleWithBLOBsMethodName(
142 IntrospectedTable introspectedTable) {
143 Rules rules = introspectedTable.getRules();
144
145 if (!rules.generateUpdateByExampleWithoutBLOBs()) {
146 return "updateByExample";
147 } else if (rules.generateRecordWithBLOBsClass()) {
148 return "updateByExample";
149 } else {
150 return "updateByExampleWithBLOBs";
151 }
152 }
153
154 public String getUpdateByExampleWithoutBLOBsMethodName(
155 IntrospectedTable introspectedTable) {
156 Rules rules = introspectedTable.getRules();
157
158 if (!rules.generateUpdateByExampleWithBLOBs()) {
159 return "updateByExample";
160 } else if (rules.generateRecordWithBLOBsClass()) {
161 return "updateByExample";
162 } else {
163 return "updateByExampleWithoutBLOBs";
164 }
165 }
166
167 public String getInsertSelectiveMethodName(
168 IntrospectedTable introspectedTable) {
169 return "insertSelective";
170 }
171 }