Commit 0d81c59affe04504d90dcf86884ed88ff409ea0b
1 parent
99177deb
Exists in
master
modify gitignore
Showing
60 changed files
with
2195 additions
and
2 deletions
Show diff stats
.gitignore
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +<component name="libraryTable"> | ||
2 | + <library name="lib"> | ||
3 | + <CLASSES> | ||
4 | + <root url="jar://$PROJECT_DIR$/lib/mysql-connector-java-5.1.26-bin.jar!/" /> | ||
5 | + <root url="jar://$PROJECT_DIR$/lib/freemarker-2.3.15.jar!/" /> | ||
6 | + <root url="jar://$PROJECT_DIR$/lib/commons-lang-2.6.jar!/" /> | ||
7 | + </CLASSES> | ||
8 | + <JAVADOC /> | ||
9 | + <SOURCES /> | ||
10 | + </library> | ||
11 | +</component> | ||
0 | \ No newline at end of file | 12 | \ No newline at end of file |
@@ -0,0 +1,6 @@ | @@ -0,0 +1,6 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | ||
4 | + <output url="file://$PROJECT_DIR$/out" /> | ||
5 | + </component> | ||
6 | +</project> | ||
0 | \ No newline at end of file | 7 | \ No newline at end of file |
@@ -0,0 +1,8 @@ | @@ -0,0 +1,8 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="ProjectModuleManager"> | ||
4 | + <modules> | ||
5 | + <module fileurl="file://$PROJECT_DIR$/code-generater.iml" filepath="$PROJECT_DIR$/code-generater.iml" /> | ||
6 | + </modules> | ||
7 | + </component> | ||
8 | +</project> | ||
0 | \ No newline at end of file | 9 | \ No newline at end of file |
@@ -0,0 +1,345 @@ | @@ -0,0 +1,345 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="ChangeListManager"> | ||
4 | + <list default="true" id="3efc7ab8-4392-46f3-b152-36346d230d70" name="Default Changelist" comment=""> | ||
5 | + <change afterPath="$PROJECT_DIR$/.idea/libraries/lib.xml" afterDir="false" /> | ||
6 | + <change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" /> | ||
7 | + <change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" /> | ||
8 | + <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" /> | ||
9 | + <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | ||
10 | + <change afterPath="$PROJECT_DIR$/code-generater.iml" afterDir="false" /> | ||
11 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/ControllerTemplate.ftl" afterDir="false" /> | ||
12 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/DAOTemplate.ftl" afterDir="false" /> | ||
13 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/EntityTemplate.ftl" afterDir="false" /> | ||
14 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/HtmlTemplate.ftl" afterDir="false" /> | ||
15 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/JsTemplate.ftl" afterDir="false" /> | ||
16 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/POTemplate.ftl" afterDir="false" /> | ||
17 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/ServiceImplTemplate.ftl" afterDir="false" /> | ||
18 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/ServiceTemplate.ftl" afterDir="false" /> | ||
19 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/Temp.ftl" afterDir="false" /> | ||
20 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/createTableTemplate.ftl" afterDir="false" /> | ||
21 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/model/bussiness/ControllerModel.class" afterDir="false" /> | ||
22 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/model/bussiness/EnvironmentModel.class" afterDir="false" /> | ||
23 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/model/bussiness/ServiceModel.class" afterDir="false" /> | ||
24 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/model/bussiness/ViewModel.class" afterDir="false" /> | ||
25 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/model/createTable/ColumnModel.class" afterDir="false" /> | ||
26 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/model/createTable/TableModel.class" afterDir="false" /> | ||
27 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/model/dao/BaseModel.class" afterDir="false" /> | ||
28 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/model/dao/DaoModel.class" afterDir="false" /> | ||
29 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/model/dao/FunctionModel.class" afterDir="false" /> | ||
30 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/model/po/ColumnModel.class" afterDir="false" /> | ||
31 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/model/po/PoModel.class" afterDir="false" /> | ||
32 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/base/template/model/po/TableModel.class" afterDir="false" /> | ||
33 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/business/Constants.class" afterDir="false" /> | ||
34 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/business/GenerateCS.class" afterDir="false" /> | ||
35 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/business/GenerateController.class" afterDir="false" /> | ||
36 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/business/GenerateService.class" afterDir="false" /> | ||
37 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/business/GenerateVCSDP.class" afterDir="false" /> | ||
38 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/business/GenerateView.class" afterDir="false" /> | ||
39 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/business/Utils.class" afterDir="false" /> | ||
40 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/business/util/TempVelocity.class" afterDir="false" /> | ||
41 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/db/Constants.class" afterDir="false" /> | ||
42 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/db/GenerateDao.class" afterDir="false" /> | ||
43 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/db/GenerateDaoPO.class" afterDir="false" /> | ||
44 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/db/GenerateEntity.class" afterDir="false" /> | ||
45 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/db/GeneratePO.class" afterDir="false" /> | ||
46 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/db/MainGenerateEntity.class" afterDir="false" /> | ||
47 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/db/TableColumn.class" afterDir="false" /> | ||
48 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/db/Tools.class" afterDir="false" /> | ||
49 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/tools/StringUtil.class" afterDir="false" /> | ||
50 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/ui/EntityGenWindow$1.class" afterDir="false" /> | ||
51 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/ui/EntityGenWindow$2.class" afterDir="false" /> | ||
52 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/ui/EntityGenWindow$3.class" afterDir="false" /> | ||
53 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/ui/EntityGenWindow$4.class" afterDir="false" /> | ||
54 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/ui/EntityGenWindow$5.class" afterDir="false" /> | ||
55 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/ui/EntityGenWindow.class" afterDir="false" /> | ||
56 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/com/taover/ui/UiUtils.class" afterDir="false" /> | ||
57 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/default.properties" afterDir="false" /> | ||
58 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/erp.default.properties" afterDir="false" /> | ||
59 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/evaluate.default.properties" afterDir="false" /> | ||
60 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/print.default.properties" afterDir="false" /> | ||
61 | + <change afterPath="$PROJECT_DIR$/out/production/code-generater/schedule.default.properties" afterDir="false" /> | ||
62 | + <change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" /> | ||
63 | + <change beforePath="$PROJECT_DIR$/src/com/taover/ui/EntityGenWindow.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/taover/ui/EntityGenWindow.java" afterDir="false" /> | ||
64 | + <change beforePath="$PROJECT_DIR$/src/com/taover/ui/UiUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/taover/ui/UiUtils.java" afterDir="false" /> | ||
65 | + </list> | ||
66 | + <ignored path="$PROJECT_DIR$/out/" /> | ||
67 | + <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> | ||
68 | + <option name="SHOW_DIALOG" value="false" /> | ||
69 | + <option name="HIGHLIGHT_CONFLICTS" value="true" /> | ||
70 | + <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> | ||
71 | + <option name="LAST_RESOLUTION" value="IGNORE" /> | ||
72 | + </component> | ||
73 | + <component name="DefaultGradleProjectSettings"> | ||
74 | + <option name="testRunner" value="GRADLE" /> | ||
75 | + <option name="delegatedBuild" value="true" /> | ||
76 | + </component> | ||
77 | + <component name="FileEditorManager"> | ||
78 | + <leaf> | ||
79 | + <file pinned="false" current-in-tab="false"> | ||
80 | + <entry file="file://$PROJECT_DIR$/src/com/taover/ui/EntityGenWindow.java"> | ||
81 | + <provider selected="true" editor-type-id="text-editor"> | ||
82 | + <state relative-caret-position="255"> | ||
83 | + <caret line="111" column="51" lean-forward="true" selection-start-line="111" selection-start-column="51" selection-end-line="111" selection-end-column="51" /> | ||
84 | + <folding> | ||
85 | + <element signature="e#2981#2989#0" expanded="true" /> | ||
86 | + </folding> | ||
87 | + </state> | ||
88 | + </provider> | ||
89 | + </entry> | ||
90 | + </file> | ||
91 | + <file pinned="false" current-in-tab="true"> | ||
92 | + <entry file="file://$PROJECT_DIR$/.gitignore"> | ||
93 | + <provider selected="true" editor-type-id="text-editor"> | ||
94 | + <state relative-caret-position="132"> | ||
95 | + <caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" /> | ||
96 | + </state> | ||
97 | + </provider> | ||
98 | + </entry> | ||
99 | + </file> | ||
100 | + <file pinned="false" current-in-tab="false"> | ||
101 | + <entry file="file://$PROJECT_DIR$/src/com/taover/ui/UiUtils.java"> | ||
102 | + <provider selected="true" editor-type-id="text-editor"> | ||
103 | + <state relative-caret-position="-17"> | ||
104 | + <caret line="17" column="28" selection-start-line="17" selection-start-column="28" selection-end-line="17" selection-end-column="28" /> | ||
105 | + <folding> | ||
106 | + <element signature="e#407#408#0" expanded="true" /> | ||
107 | + <element signature="e#461#462#0" expanded="true" /> | ||
108 | + </folding> | ||
109 | + </state> | ||
110 | + </provider> | ||
111 | + </entry> | ||
112 | + </file> | ||
113 | + <file pinned="false" current-in-tab="false"> | ||
114 | + <entry file="file://$PROJECT_DIR$/src/com/taover/db/Tools.java"> | ||
115 | + <provider selected="true" editor-type-id="text-editor"> | ||
116 | + <state relative-caret-position="-17"> | ||
117 | + <caret line="50" column="25" selection-start-line="50" selection-start-column="25" selection-end-line="50" selection-end-column="25" /> | ||
118 | + </state> | ||
119 | + </provider> | ||
120 | + </entry> | ||
121 | + </file> | ||
122 | + </leaf> | ||
123 | + </component> | ||
124 | + <component name="FindInProjectRecents"> | ||
125 | + <findStrings> | ||
126 | + <find>Tools.getPath()</find> | ||
127 | + </findStrings> | ||
128 | + <replaceStrings> | ||
129 | + <replace>UiUtils.getProjectRoot()</replace> | ||
130 | + </replaceStrings> | ||
131 | + </component> | ||
132 | + <component name="Git.Settings"> | ||
133 | + <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> | ||
134 | + </component> | ||
135 | + <component name="IdeDocumentHistory"> | ||
136 | + <option name="CHANGED_PATHS"> | ||
137 | + <list> | ||
138 | + <option value="$PROJECT_DIR$/src/com/taover/ui/UiUtils.java" /> | ||
139 | + <option value="$PROJECT_DIR$/src/com/taover/ui/EntityGenWindow.java" /> | ||
140 | + <option value="$PROJECT_DIR$/.gitignore" /> | ||
141 | + </list> | ||
142 | + </option> | ||
143 | + </component> | ||
144 | + <component name="ProjectFrameBounds" extendedState="6"> | ||
145 | + <option name="x" value="260" /> | ||
146 | + <option name="y" value="20" /> | ||
147 | + <option name="width" value="1400" /> | ||
148 | + <option name="height" value="1000" /> | ||
149 | + </component> | ||
150 | + <component name="ProjectView"> | ||
151 | + <navigator proportions="" version="1"> | ||
152 | + <foldersAlwaysOnTop value="true" /> | ||
153 | + </navigator> | ||
154 | + <panes> | ||
155 | + <pane id="ProjectPane"> | ||
156 | + <subPane> | ||
157 | + <expand> | ||
158 | + <path> | ||
159 | + <item name="code-generater" type="b2602c69:ProjectViewProjectNode" /> | ||
160 | + <item name="code-generater" type="462c0819:PsiDirectoryNode" /> | ||
161 | + </path> | ||
162 | + <path> | ||
163 | + <item name="code-generater" type="b2602c69:ProjectViewProjectNode" /> | ||
164 | + <item name="code-generater" type="462c0819:PsiDirectoryNode" /> | ||
165 | + <item name="out" type="462c0819:PsiDirectoryNode" /> | ||
166 | + </path> | ||
167 | + <path> | ||
168 | + <item name="code-generater" type="b2602c69:ProjectViewProjectNode" /> | ||
169 | + <item name="code-generater" type="462c0819:PsiDirectoryNode" /> | ||
170 | + <item name="out" type="462c0819:PsiDirectoryNode" /> | ||
171 | + <item name="production" type="462c0819:PsiDirectoryNode" /> | ||
172 | + </path> | ||
173 | + <path> | ||
174 | + <item name="code-generater" type="b2602c69:ProjectViewProjectNode" /> | ||
175 | + <item name="code-generater" type="462c0819:PsiDirectoryNode" /> | ||
176 | + <item name="out" type="462c0819:PsiDirectoryNode" /> | ||
177 | + <item name="production" type="462c0819:PsiDirectoryNode" /> | ||
178 | + <item name="code-generater" type="462c0819:PsiDirectoryNode" /> | ||
179 | + </path> | ||
180 | + <path> | ||
181 | + <item name="code-generater" type="b2602c69:ProjectViewProjectNode" /> | ||
182 | + <item name="code-generater" type="462c0819:PsiDirectoryNode" /> | ||
183 | + <item name="src" type="462c0819:PsiDirectoryNode" /> | ||
184 | + </path> | ||
185 | + <path> | ||
186 | + <item name="code-generater" type="b2602c69:ProjectViewProjectNode" /> | ||
187 | + <item name="code-generater" type="462c0819:PsiDirectoryNode" /> | ||
188 | + <item name="src" type="462c0819:PsiDirectoryNode" /> | ||
189 | + <item name="taover" type="462c0819:PsiDirectoryNode" /> | ||
190 | + </path> | ||
191 | + <path> | ||
192 | + <item name="code-generater" type="b2602c69:ProjectViewProjectNode" /> | ||
193 | + <item name="code-generater" type="462c0819:PsiDirectoryNode" /> | ||
194 | + <item name="src" type="462c0819:PsiDirectoryNode" /> | ||
195 | + <item name="taover" type="462c0819:PsiDirectoryNode" /> | ||
196 | + <item name="ui" type="462c0819:PsiDirectoryNode" /> | ||
197 | + </path> | ||
198 | + </expand> | ||
199 | + <select /> | ||
200 | + </subPane> | ||
201 | + </pane> | ||
202 | + <pane id="Scope" /> | ||
203 | + <pane id="PackagesPane" /> | ||
204 | + </panes> | ||
205 | + </component> | ||
206 | + <component name="PropertiesComponent"> | ||
207 | + <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" /> | ||
208 | + <property name="WebServerToolWindowFactoryState" value="false" /> | ||
209 | + <property name="aspect.path.notification.shown" value="true" /> | ||
210 | + <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" /> | ||
211 | + <property name="nodejs_npm_path_reset_for_default_project" value="true" /> | ||
212 | + <property name="settings.editor.selected.configurable" value="reference.settingsdialog.IDE.editor.colors" /> | ||
213 | + </component> | ||
214 | + <component name="RunDashboard"> | ||
215 | + <option name="ruleStates"> | ||
216 | + <list> | ||
217 | + <RuleState> | ||
218 | + <option name="name" value="ConfigurationTypeDashboardGroupingRule" /> | ||
219 | + </RuleState> | ||
220 | + <RuleState> | ||
221 | + <option name="name" value="StatusDashboardGroupingRule" /> | ||
222 | + </RuleState> | ||
223 | + </list> | ||
224 | + </option> | ||
225 | + </component> | ||
226 | + <component name="RunManager"> | ||
227 | + <configuration name="EntityGenWindow" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> | ||
228 | + <option name="MAIN_CLASS_NAME" value="com.taover.ui.EntityGenWindow" /> | ||
229 | + <module name="code-generater" /> | ||
230 | + <extension name="coverage"> | ||
231 | + <pattern> | ||
232 | + <option name="PATTERN" value="com.taover.ui.*" /> | ||
233 | + <option name="ENABLED" value="true" /> | ||
234 | + </pattern> | ||
235 | + </extension> | ||
236 | + <method v="2"> | ||
237 | + <option name="Make" enabled="true" /> | ||
238 | + </method> | ||
239 | + </configuration> | ||
240 | + <recent_temporary> | ||
241 | + <list> | ||
242 | + <item itemvalue="Application.EntityGenWindow" /> | ||
243 | + </list> | ||
244 | + </recent_temporary> | ||
245 | + </component> | ||
246 | + <component name="SvnConfiguration"> | ||
247 | + <configuration /> | ||
248 | + </component> | ||
249 | + <component name="TaskManager"> | ||
250 | + <task active="true" id="Default" summary="Default task"> | ||
251 | + <changelist id="3efc7ab8-4392-46f3-b152-36346d230d70" name="Default Changelist" comment="" /> | ||
252 | + <created>1557914467884</created> | ||
253 | + <option name="number" value="Default" /> | ||
254 | + <option name="presentableId" value="Default" /> | ||
255 | + <updated>1557914467884</updated> | ||
256 | + <workItem from="1557914479970" duration="1392000" /> | ||
257 | + </task> | ||
258 | + <servers /> | ||
259 | + </component> | ||
260 | + <component name="TimeTrackingManager"> | ||
261 | + <option name="totallyTimeSpent" value="1392000" /> | ||
262 | + </component> | ||
263 | + <component name="ToolWindowManager"> | ||
264 | + <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" /> | ||
265 | + <editor active="true" /> | ||
266 | + <layout> | ||
267 | + <window_info id="Image Layers" /> | ||
268 | + <window_info id="Designer" /> | ||
269 | + <window_info id="UI Designer" /> | ||
270 | + <window_info id="Capture Tool" /> | ||
271 | + <window_info id="Favorites" side_tool="true" /> | ||
272 | + <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25" /> | ||
273 | + <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> | ||
274 | + <window_info anchor="bottom" id="Messages" weight="0.329718" /> | ||
275 | + <window_info anchor="bottom" id="Docker" show_stripe_button="false" /> | ||
276 | + <window_info anchor="bottom" id="Database Changes" /> | ||
277 | + <window_info anchor="bottom" id="Version Control" /> | ||
278 | + <window_info active="true" anchor="bottom" id="Terminal" visible="true" weight="0.329718" /> | ||
279 | + <window_info anchor="bottom" id="Event Log" side_tool="true" /> | ||
280 | + <window_info anchor="bottom" id="Message" order="0" /> | ||
281 | + <window_info anchor="bottom" id="Find" order="1" /> | ||
282 | + <window_info anchor="bottom" id="Run" order="2" weight="0.329718" /> | ||
283 | + <window_info anchor="bottom" id="Debug" order="3" weight="0.3991323" /> | ||
284 | + <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> | ||
285 | + <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> | ||
286 | + <window_info anchor="bottom" id="TODO" order="6" /> | ||
287 | + <window_info anchor="right" id="Palette" /> | ||
288 | + <window_info anchor="right" id="Theme Preview" /> | ||
289 | + <window_info anchor="right" id="Maven" /> | ||
290 | + <window_info anchor="right" id="Capture Analysis" /> | ||
291 | + <window_info anchor="right" id="Palette	" /> | ||
292 | + <window_info anchor="right" id="Database" /> | ||
293 | + <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> | ||
294 | + <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> | ||
295 | + <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> | ||
296 | + </layout> | ||
297 | + </component> | ||
298 | + <component name="TypeScriptGeneratedFilesManager"> | ||
299 | + <option name="version" value="1" /> | ||
300 | + </component> | ||
301 | + <component name="editorHistoryManager"> | ||
302 | + <entry file="file://$PROJECT_DIR$/code-generater.iml"> | ||
303 | + <provider selected="true" editor-type-id="text-editor"> | ||
304 | + <state relative-caret-position="57"> | ||
305 | + <caret line="3" column="22" lean-forward="true" selection-start-line="3" selection-start-column="22" selection-end-line="3" selection-end-column="22" /> | ||
306 | + </state> | ||
307 | + </provider> | ||
308 | + </entry> | ||
309 | + <entry file="file://$PROJECT_DIR$/src/com/taover/db/Tools.java"> | ||
310 | + <provider selected="true" editor-type-id="text-editor"> | ||
311 | + <state relative-caret-position="-17"> | ||
312 | + <caret line="50" column="25" selection-start-line="50" selection-start-column="25" selection-end-line="50" selection-end-column="25" /> | ||
313 | + </state> | ||
314 | + </provider> | ||
315 | + </entry> | ||
316 | + <entry file="file://$PROJECT_DIR$/src/com/taover/ui/UiUtils.java"> | ||
317 | + <provider selected="true" editor-type-id="text-editor"> | ||
318 | + <state relative-caret-position="-17"> | ||
319 | + <caret line="17" column="28" selection-start-line="17" selection-start-column="28" selection-end-line="17" selection-end-column="28" /> | ||
320 | + <folding> | ||
321 | + <element signature="e#407#408#0" expanded="true" /> | ||
322 | + <element signature="e#461#462#0" expanded="true" /> | ||
323 | + </folding> | ||
324 | + </state> | ||
325 | + </provider> | ||
326 | + </entry> | ||
327 | + <entry file="file://$PROJECT_DIR$/src/com/taover/ui/EntityGenWindow.java"> | ||
328 | + <provider selected="true" editor-type-id="text-editor"> | ||
329 | + <state relative-caret-position="255"> | ||
330 | + <caret line="111" column="51" lean-forward="true" selection-start-line="111" selection-start-column="51" selection-end-line="111" selection-end-column="51" /> | ||
331 | + <folding> | ||
332 | + <element signature="e#2981#2989#0" expanded="true" /> | ||
333 | + </folding> | ||
334 | + </state> | ||
335 | + </provider> | ||
336 | + </entry> | ||
337 | + <entry file="file://$PROJECT_DIR$/.gitignore"> | ||
338 | + <provider selected="true" editor-type-id="text-editor"> | ||
339 | + <state relative-caret-position="132"> | ||
340 | + <caret line="6" lean-forward="true" selection-start-line="6" selection-end-line="6" /> | ||
341 | + </state> | ||
342 | + </provider> | ||
343 | + </entry> | ||
344 | + </component> | ||
345 | +</project> | ||
0 | \ No newline at end of file | 346 | \ No newline at end of file |
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<module type="JAVA_MODULE" version="4"> | ||
3 | + <component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
4 | + <exclude-output /> | ||
5 | + <content url="file://$MODULE_DIR$"> | ||
6 | + <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
7 | + </content> | ||
8 | + <orderEntry type="inheritedJdk" /> | ||
9 | + <orderEntry type="sourceFolder" forTests="false" /> | ||
10 | + <orderEntry type="library" name="lib" level="project" /> | ||
11 | + </component> | ||
12 | +</module> | ||
0 | \ No newline at end of file | 13 | \ No newline at end of file |
out/production/code-generater/com/taover/base/template/ControllerTemplate.ftl
0 → 100644
@@ -0,0 +1,149 @@ | @@ -0,0 +1,149 @@ | ||
1 | +package ${packageInfo}; | ||
2 | + | ||
3 | +import java.text.SimpleDateFormat; | ||
4 | +import java.util.Date; | ||
5 | +import java.util.List; | ||
6 | +import java.util.Map; | ||
7 | + | ||
8 | +import javax.annotation.Resource; | ||
9 | +import javax.servlet.http.HttpServletRequest; | ||
10 | + | ||
11 | +import org.apache.commons.logging.Log; | ||
12 | +import org.apache.commons.logging.LogFactory; | ||
13 | + | ||
14 | +import org.springframework.beans.propertyeditors.CustomDateEditor; | ||
15 | +import org.springframework.stereotype.Controller; | ||
16 | +import org.springframework.ui.Model; | ||
17 | +import org.springframework.web.bind.WebDataBinder; | ||
18 | +import org.springframework.web.bind.annotation.InitBinder; | ||
19 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
20 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
21 | +import org.springframework.web.bind.annotation.RequestParam; | ||
22 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
23 | + | ||
24 | +import com.taover.base.ResultInfo; | ||
25 | +import ${poPackageInfo}.${poClassName}; | ||
26 | +import ${serviceImplPackageInfo}.${serviceImplClassName}; | ||
27 | +import com.taover.tools.CustomTimestampEditor; | ||
28 | + | ||
29 | +@Controller | ||
30 | +@RequestMapping("/${classUrlPath}") | ||
31 | +public class ${controllerClassName} { | ||
32 | + @Resource | ||
33 | + private ${serviceImplClassName} ${serviceImplFieldName}; | ||
34 | + | ||
35 | + Log log = LogFactory.getLog(this.getClass()); | ||
36 | + | ||
37 | + /** | ||
38 | + * 绑定日期参数 | ||
39 | + * @param request | ||
40 | + * @param binder | ||
41 | + */ | ||
42 | + @InitBinder | ||
43 | + protected void init(HttpServletRequest request, WebDataBinder binder){ | ||
44 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | ||
45 | + dateFormat.setLenient(false); | ||
46 | + binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false)); | ||
47 | + SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
48 | + datetimeFormat.setLenient(false); | ||
49 | + binder.registerCustomEditor(java.sql.Timestamp.class,new CustomTimestampEditor(datetimeFormat, true)); | ||
50 | + } | ||
51 | + | ||
52 | + @RequestMapping(value="/add", method=RequestMethod.POST) | ||
53 | + @ResponseBody | ||
54 | + public ResultInfo add( | ||
55 | + ${poClassName} ${poFieldName}, | ||
56 | + Model model, | ||
57 | + HttpServletRequest request){ | ||
58 | + ResultInfo result = new ResultInfo(); | ||
59 | + try{ | ||
60 | + result = this.${serviceImplFieldName}.add(${poFieldName}); | ||
61 | + }catch(Exception e){ | ||
62 | + result.setResultId("failure"); | ||
63 | + result.setResultMessage("系统报错,添加失败!"); | ||
64 | + log.error("系统报错,添加失败!"); | ||
65 | + } | ||
66 | + return result; | ||
67 | + } | ||
68 | + | ||
69 | + @RequestMapping(value="/delete") | ||
70 | + @ResponseBody | ||
71 | + public ResultInfo delete( | ||
72 | + @RequestParam(value="id", required=false) Integer id, | ||
73 | + Model model, | ||
74 | + HttpServletRequest request){ | ||
75 | + //创建返回对象 | ||
76 | + ResultInfo result = new ResultInfo(); | ||
77 | + | ||
78 | + //参数检验 | ||
79 | + if(id==null || id<0){ | ||
80 | + result.setResultId("failure"); | ||
81 | + result.setResultMessage("删除失败,缺少主键信息或者主键错误!"); | ||
82 | + //添加失败,将提交的对象信息放入 data.node | ||
83 | + result.addData("node", id); | ||
84 | + return result; | ||
85 | + } | ||
86 | + | ||
87 | + try{ | ||
88 | + result = this.${serviceImplFieldName}.delete(id); | ||
89 | + }catch(Exception e){ | ||
90 | + result.setResultId("failure"); | ||
91 | + result.setResultMessage("系统报错,删除失败!"); | ||
92 | + log.error("系统报错,删除失败!"); | ||
93 | + } | ||
94 | + return result; | ||
95 | + } | ||
96 | + | ||
97 | + @RequestMapping(value="/update", method=RequestMethod.POST) | ||
98 | + @ResponseBody | ||
99 | + public ResultInfo update( | ||
100 | + ${poClassName} ${poFieldName}, | ||
101 | + Model model, | ||
102 | + HttpServletRequest request){ | ||
103 | + //创建返回对象 | ||
104 | + ResultInfo result = new ResultInfo(); | ||
105 | + | ||
106 | + try{ | ||
107 | + result = this.${serviceImplFieldName}.update(${poFieldName}); | ||
108 | + }catch(Exception e){ | ||
109 | + result.setResultId("failure"); | ||
110 | + result.setResultMessage("系统报错,更新失败!"); | ||
111 | + log.error("系统报错,更新失败!"); | ||
112 | + } | ||
113 | + return result; | ||
114 | + } | ||
115 | + | ||
116 | + | ||
117 | + /** | ||
118 | + * 分页条件查询 | ||
119 | + * @param page | ||
120 | + * @param pageSize | ||
121 | + * @return | ||
122 | + */ | ||
123 | + @RequestMapping(value = "/query") | ||
124 | + @ResponseBody | ||
125 | + public Map<String, Object> query( | ||
126 | + @RequestParam(value="sort", required=false) String sort, | ||
127 | + @RequestParam(value="order", required=false) String order, | ||
128 | + @RequestParam(value="page", required=false) Integer page, | ||
129 | + @RequestParam(value="rows", required=false) Integer pageSize, | ||
130 | + HttpServletRequest request) { | ||
131 | + //参数检验 | ||
132 | + if(page == null){ | ||
133 | + page = 1; | ||
134 | + } | ||
135 | + if(pageSize == null){ | ||
136 | + pageSize = 20; | ||
137 | + } | ||
138 | + if("".equals(sort)){ | ||
139 | + sort = "id"; | ||
140 | + order = "desc"; | ||
141 | + } | ||
142 | + | ||
143 | + //调用Service层查询方法 | ||
144 | + List<Object[]> arrayCondition = null; | ||
145 | + Map<String, Object> result = this.${serviceImplFieldName}.query${poClassName}List(arrayCondition, sort, order, page, pageSize); | ||
146 | + return result; | ||
147 | + } | ||
148 | + | ||
149 | +} |
out/production/code-generater/com/taover/base/template/DAOTemplate.ftl
0 → 100644
@@ -0,0 +1,777 @@ | @@ -0,0 +1,777 @@ | ||
1 | +//${tableName} | ||
2 | +<#--包名 --> | ||
3 | +package ${packages} | ||
4 | + | ||
5 | +<#-- 所有的引入--> | ||
6 | +<#list imports as ilist> | ||
7 | +<#if ilist?exists>${ilist}<#else><#rt></#if> | ||
8 | +</#list> | ||
9 | +import java.math.BigDecimal; | ||
10 | + | ||
11 | +/** | ||
12 | + <#if version?exists> | ||
13 | + * @version ${version} | ||
14 | + </#if> | ||
15 | + */ | ||
16 | +@Repository | ||
17 | +<#--类, 还是接口 名称, 继承的类, 实现的接口 --> | ||
18 | +public class ${beanName}Dao { | ||
19 | +<#--变量 --> | ||
20 | + @Resource | ||
21 | + private JdbcTemplate jdbcegroceryRead; | ||
22 | + @Resource | ||
23 | + private JdbcTemplate jdbcegroceryWrite; | ||
24 | + | ||
25 | + Log logger = LogFactory.getLog(this.getClass()); | ||
26 | + | ||
27 | + | ||
28 | + /** | ||
29 | + * 根据Request Map 生成PO对象 | ||
30 | + */ | ||
31 | + public ${beanName}PO get${beanName}POFromRequest(Map<String, Object> map) throws Exception { | ||
32 | + ${beanName}PO po = new ${beanName}PO(); | ||
33 | + <#if reqParameterToPOMap?exists> | ||
34 | + <#list reqParameterToPOMap?keys as poKey> | ||
35 | + po.set${reqParameterToPOMap[poKey]}; | ||
36 | + </#list> | ||
37 | + </#if> | ||
38 | + return po; | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * 按主键查询 | ||
43 | + */ | ||
44 | + public ${beanName}PO findPOByID(${pkType} id) { | ||
45 | + return findPOByID(id, true, false); | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * 按主键查询 | ||
50 | + * isLock 是否锁定, 默认不锁 | ||
51 | + * fromWriteDB 是否从写库读写,默认从读库查询 | ||
52 | + */ | ||
53 | + public ${beanName}PO findPOByID(${pkType} id, boolean isLock, boolean fromWriteDB) { | ||
54 | + Date starttime = new Date(); | ||
55 | + StringBuffer sql = new StringBuffer("SELECT ${column_list_str} FROM ${tableName}"); | ||
56 | + StringBuffer pql = new StringBuffer(sql.toString()); | ||
57 | + sql.append(" WHERE ${pkColumName} = ?"); | ||
58 | + pql.append(" WHERE ${pkColumName} = " + id); | ||
59 | + if (isLock) { | ||
60 | + sql.append(" FOR UPDATE"); | ||
61 | + pql.append(" FOR UPDATE"); | ||
62 | + } | ||
63 | + List<${beanName}PO> resultList = null; | ||
64 | + try { | ||
65 | + resultList = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).query(sql.toString(), new DAORowMapper<${beanName}PO>(${beanName}PO.class), id); | ||
66 | + if (resultList == null || resultList.size() == 0) { | ||
67 | + return null; | ||
68 | + } | ||
69 | + return resultList.get(0); | ||
70 | + } catch (Exception e) { | ||
71 | + LogUtils.error("error:findPOByID", logger, e, pql.toString(), id); | ||
72 | + } finally { | ||
73 | + Date endtime = new Date(); | ||
74 | + if(false)LogUtils.info("info:", logger, | ||
75 | + "${beanName}Dao.findPOByID(" + id + ", " + isLock + ", " + ", " + fromWriteDB + ")\n" | ||
76 | + + "返回数据条数:" + (resultList==null?0:resultList.size()) | ||
77 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒(" | ||
78 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
79 | + + "*-*" | ||
80 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
81 | + + ")"); | ||
82 | + } | ||
83 | + return null; | ||
84 | + } | ||
85 | + | ||
86 | + /** | ||
87 | + * 根据条件List<Object[]>查询 | ||
88 | + * Object[]数组长度是3 | ||
89 | + * Object[], 第一个参数是列名,第二个参数是操作符,第三个参数是查询条件的值。 | ||
90 | + */ | ||
91 | + public List<${beanName}PO> findListByCondition(List<Object[]> condition) { | ||
92 | + return findListByCondition(condition,null, false); | ||
93 | + } | ||
94 | + | ||
95 | + /** | ||
96 | + * 根据条件List<Object[]>查询 | ||
97 | + * Object[]数组长度是3 | ||
98 | + * Object[], 第一个参数是列名,第二个参数是操作符,第三个参数是查询条件的值。 | ||
99 | + */ | ||
100 | + public List<${beanName}PO> findListByCondition(List<Object[]> condition,String sortCondition, boolean fromWriteDB) { | ||
101 | + if (StringUtil.isAutowired(condition)) { | ||
102 | + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); | ||
103 | + return null; | ||
104 | + } | ||
105 | + Date starttime = new Date(); | ||
106 | + StringBuffer sql = new StringBuffer("SELECT ${column_list_str} FROM ${tableName}"); | ||
107 | + StringBuffer pql = new StringBuffer(sql.toString()); | ||
108 | + List<Object> list = new ArrayList<Object>(); | ||
109 | + JdbcUtil.appendWhereCondition(sql, pql, list, condition); | ||
110 | + if(!StringUtils.isEmpty(sortCondition)){ | ||
111 | + sql.append(" " + sortCondition + " "); | ||
112 | + pql.append(" " + sortCondition + " "); | ||
113 | + } | ||
114 | + List<${beanName}PO> resultList = null; | ||
115 | + try { | ||
116 | + resultList = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).query(sql.toString(), new DAORowMapper<${beanName}PO>(${beanName}PO.class), list.toArray()); | ||
117 | + return resultList; | ||
118 | + } catch (Exception e) { | ||
119 | + LogUtils.error("error:", logger, e, pql.toString(), null); | ||
120 | + } finally { | ||
121 | + Date endtime = new Date(); | ||
122 | + if(false)LogUtils.info("info", logger, | ||
123 | + "${beanName}Dao.findListByCondition(" + condition.toString() + ", " + fromWriteDB + ")\n" | ||
124 | + + "fromWriteDB:" + fromWriteDB | ||
125 | + + "执行SQL:" + pql.toString() + "\n" | ||
126 | + + "返回条数:" + (resultList==null?0:resultList.size()) + "\n" | ||
127 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒(" | ||
128 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
129 | + + "*-*" | ||
130 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
131 | + + ")"); | ||
132 | + | ||
133 | + } | ||
134 | + return null; | ||
135 | + } | ||
136 | + | ||
137 | + /** | ||
138 | + * 根据条件sql查询 | ||
139 | + * sqlCondition 为where 后面的条件。 | ||
140 | + */ | ||
141 | + public List<${beanName}PO> findListBySql(String sqlCondition) { | ||
142 | + return findListBySql(sqlCondition, false); | ||
143 | + } | ||
144 | + | ||
145 | + /** | ||
146 | + * 根据条件sql查询 | ||
147 | + * sqlCondition 为where 后面的条件。 | ||
148 | + */ | ||
149 | + public List<${beanName}PO> findListBySql(String sqlCondition,boolean fromWriteDB) { | ||
150 | + if (StringUtil.isAutowired(sqlCondition)) { | ||
151 | + LogUtils.error("error", logger, new Exception("请求条件异常,无效请求!"), null, null); | ||
152 | + return null; | ||
153 | + } | ||
154 | + Date starttime = new Date(); | ||
155 | + | ||
156 | + StringBuffer sql = new StringBuffer("SELECT ${column_list_str} FROM ${tableName} WHERE " + sqlCondition); | ||
157 | + List<${beanName}PO> resultList = null; | ||
158 | + try { | ||
159 | + resultList = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).query(sql.toString(), new DAORowMapper<${beanName}PO>(${beanName}PO.class)); | ||
160 | + return resultList; | ||
161 | + } catch (Exception e) { | ||
162 | + LogUtils.error("error:", logger, e, sql.toString(), null); | ||
163 | + } finally { | ||
164 | + Date endtime = new Date(); | ||
165 | + if(false)LogUtils.info("info", logger, | ||
166 | + "${beanName}Dao.findListBySql(" + sqlCondition + ", " + fromWriteDB + ")\n" | ||
167 | + + "fromWriteDB:" + fromWriteDB + "\n" | ||
168 | + + "执行SQL:" + sql.toString() + "\n" | ||
169 | + + "返回条数:" + (resultList==null?0:resultList.size()) + "\n" | ||
170 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒(" | ||
171 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
172 | + + "*-*" | ||
173 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
174 | + + ")"); | ||
175 | + } | ||
176 | + return null; | ||
177 | + } | ||
178 | + | ||
179 | + /** | ||
180 | + * 按条件分页查询 | ||
181 | + * Object[]数组长度是3 | ||
182 | + * Object[], 第一个参数是列名,第二个参数是操作符,第三个参数是查询条件的值。 | ||
183 | + */ | ||
184 | + public Map<String, Object> findPageByCondition(List<Object[]> condition,int page, int pageSize) { | ||
185 | + return findPageByCondition(condition, null , page, pageSize, false); | ||
186 | + } | ||
187 | + | ||
188 | + /** | ||
189 | + * 按条件分页查询 | ||
190 | + * Object[]数组长度是3 | ||
191 | + * Object[]第一个参数是列名,第二个参数是操作符,第三个参数是查询条件的值。 | ||
192 | + * boolean isUseCache, 是否用缓存,默认用。 | ||
193 | + * boolean isAddCache, 是否添加缓存,默认添加。 | ||
194 | + */ | ||
195 | + public Map<String, Object> findPageByCondition(List<Object[]> condition,String sortCondition, int page, int pageSize, boolean fromWriteDB) { | ||
196 | + if (StringUtil.isAutowired(condition)) { | ||
197 | + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); | ||
198 | + return null; | ||
199 | + } | ||
200 | + Date starttime = new Date(); | ||
201 | + <#if dbType = "mysql"> | ||
202 | + StringBuffer sql = new StringBuffer("SELECT ${column_list_str} FROM ${tableName}"); | ||
203 | + StringBuffer pql = new StringBuffer(sql.toString()); | ||
204 | + <#else> | ||
205 | + StringBuffer sql = new StringBuffer("SELECT ${column_list_str}, ROWNUM RN FROM ${tableName}"); | ||
206 | + StringBuffer pql = new StringBuffer(sql.toString()); | ||
207 | + </#if> | ||
208 | + StringBuffer sqlCount = new StringBuffer("SELECT COUNT(1) FROM ${tableName}"); | ||
209 | + | ||
210 | + List<Object> count_list = new ArrayList<Object>(); | ||
211 | + List<Object> page_list = new ArrayList<Object>(); | ||
212 | + JdbcUtil.appendWhereConditionForCount(sqlCount, condition); | ||
213 | + JdbcUtil.appendWhereCondition(sql, pql, count_list, condition); | ||
214 | + for (int i = 0; i < count_list.size(); i++) | ||
215 | + page_list.add(count_list.get(i)); | ||
216 | + | ||
217 | + <#if dbType == "mysql"> | ||
218 | + page_list.add((page - 1) * pageSize); | ||
219 | + page_list.add(pageSize); | ||
220 | + | ||
221 | + if(!StringUtils.isEmpty(sortCondition)){ | ||
222 | + sql.append(" " + sortCondition + " "); | ||
223 | + pql.append(" " + sortCondition + " "); | ||
224 | + } | ||
225 | + | ||
226 | + String pageSql = sql.toString() + " limit ?, ?"; | ||
227 | + String pagePql = pql.toString() + " limit " + (page -1) * pageSize + ", " + pageSize; | ||
228 | + | ||
229 | + <#else> | ||
230 | + String pageSql = null; | ||
231 | + String pagePql = null; | ||
232 | + if (page_list.size() == 0) { | ||
233 | + | ||
234 | + pageSql = "SELECT * FROM (" + sql.toString() + " AND ROWNUM <= ?" + ") A WHERE A.RN >= ?"; | ||
235 | + pagePql = "SELECT * FROM (" + pql.toString() + " AND ROWNUM <= " + page * pageSize + ") A WHERE A.RN >= " + ((page -1) * pageSize + 1); | ||
236 | + } else { | ||
237 | + pageSql = "SELECT * FROM (" + sql.toString() + " AND ROWNUM <= ?" + ") A WHERE A.RN >= ?"; | ||
238 | + pagePql = "SELECT * FROM (" + pql.toString() + " AND ROWNUM <= " + page * pageSize + ") A WHERE A.RN >= " + ((page -1) * pageSize + 1); | ||
239 | + } | ||
240 | + page_list.add(page * pageSize); | ||
241 | + page_list.add((page - 1) * pageSize + 1); | ||
242 | + </#if> | ||
243 | + List<${beanName}PO> resultList = null; | ||
244 | + try { | ||
245 | + int totalPages = 0; | ||
246 | + int totalRows = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).queryForInt(sqlCount.toString(), count_list.toArray()) ; | ||
247 | + if (totalRows % pageSize == 0) { | ||
248 | + totalPages = totalRows / pageSize; | ||
249 | + } else { | ||
250 | + totalPages = (totalRows / pageSize) + 1; | ||
251 | + } | ||
252 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
253 | + resultMap.put("page", page); | ||
254 | + resultMap.put("total", totalRows); | ||
255 | + resultList = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).query( pageSql.toString(), new DAORowMapper<${beanName}PO>(${beanName}PO.class), page_list.toArray()); | ||
256 | + resultMap.put("rows", resultList); | ||
257 | + return resultMap; | ||
258 | + } catch (Exception e) { | ||
259 | + LogUtils.error("error:", logger, e, pagePql.toString(), page_list.toArray()); | ||
260 | + } finally { | ||
261 | + Date endtime = new Date(); | ||
262 | + if(false)LogUtils.info("info:", logger, | ||
263 | + "${beanName}Dao.findPageByCondition(" + condition.toString() + ", " + page + ", " + pageSize + ", " + fromWriteDB + ")\n" | ||
264 | + + "执行SQL:" + pagePql.toString() + "\n" | ||
265 | + + "返回条数:" + (resultList==null?0:resultList.size()) + "\n" | ||
266 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒(" | ||
267 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
268 | + + "*-*" | ||
269 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
270 | + + ")"); | ||
271 | + } | ||
272 | + return null; | ||
273 | + } | ||
274 | + | ||
275 | + /** | ||
276 | + * 按sql分页查询, sqlCondition为where 后条件sql | ||
277 | + */ | ||
278 | + public Map<String, Object> findPageBySql(String sqlCondition, int page, int pageSize) { | ||
279 | + return findPageBySql(sqlCondition, page, pageSize, false); | ||
280 | + } | ||
281 | + | ||
282 | + /** | ||
283 | + * 按sql分页查询, sqlCondition为where 后条件sql | ||
284 | + */ | ||
285 | + public Map<String, Object> findPageBySql(String sqlCondition, int page, int pageSize,boolean fromWriteDB) { | ||
286 | + if (StringUtil.isAutowired(sqlCondition)) { | ||
287 | + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); | ||
288 | + return null; | ||
289 | + } | ||
290 | + Date starttime = new Date(); | ||
291 | + | ||
292 | + <#if dbType = "mysql"> | ||
293 | + StringBuffer sql = new StringBuffer("SELECT ${column_list_str} FROM ${tableName} WHERE " + sqlCondition ); | ||
294 | + StringBuffer sqlCount = new StringBuffer("SELECT count(1) from ${tableName} WHERE " + sqlCondition); | ||
295 | + String pageSql = sql.toString() + " limit ?, ?"; | ||
296 | + String pagePql = sql.toString() + " limit " + ((page -1) * pageSize) + ", " + (page * pageSize); | ||
297 | + List<Object> page_list = new ArrayList<Object>(); | ||
298 | + page_list.add((page - 1) * pageSize); | ||
299 | + page_list.add(page * pageSize); | ||
300 | + <#else> | ||
301 | + StringBuffer sql = new StringBuffer("SELECT ${column_list_str}, ROWNUM RN FROM ${tableName} WHERE " + sqlCondition); | ||
302 | + StringBuffer sqlCount = new StringBuffer("SELECT count(1) from ${tableName} WHERE " + sqlCondition); | ||
303 | + String pageSql = null; | ||
304 | + String pagePql = null; | ||
305 | + | ||
306 | + pageSql = "SELECT * FROM (" + sql.toString() + " AND ROWNUM <= ?" + ") A WHERE A.RN >= ?"; | ||
307 | + pagePql = "SELECT * FROM (" + sql.toString() + " AND ROWNUM <= " + page * pageSize + ") A WHERE A.RN >= " + ((page -1) * pageSize + 1); | ||
308 | + | ||
309 | + | ||
310 | + List<Object> page_list = new ArrayList<Object>(); | ||
311 | + page_list.add(page * pageSize); | ||
312 | + page_list.add((page - 1) * pageSize + 1); | ||
313 | + </#if> | ||
314 | + | ||
315 | + | ||
316 | + List<${beanName}PO> resultList = null; | ||
317 | + try { | ||
318 | + | ||
319 | + int totalPages = 0; | ||
320 | + int totalRows = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).queryForInt(sqlCount.toString()); | ||
321 | + if (totalRows % pageSize == 0) { | ||
322 | + totalPages = totalRows / pageSize; | ||
323 | + } else { | ||
324 | + totalPages = (totalRows / pageSize) + 1; | ||
325 | + } | ||
326 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
327 | + resultMap.put("page", page); | ||
328 | + resultMap.put("total", totalRows); | ||
329 | + resultList = (fromWriteDB ? jdbcegroceryWrite : jdbcegroceryRead).query(pageSql.toString(), new DAORowMapper<${beanName}PO>(${beanName}PO.class), page_list.toArray()); | ||
330 | + resultMap.put("rows", resultList); | ||
331 | + return resultMap; | ||
332 | + } catch (Exception e) { | ||
333 | + LogUtils.error("error:", logger, e, pagePql.toString(), null); | ||
334 | + } finally { | ||
335 | + Date endtime = new Date(); | ||
336 | + if(false)LogUtils.info("info:", logger, | ||
337 | + "${beanName}Dao.findPageBySql(" + sqlCondition + ", " + page + ", " + pageSize + ", " + fromWriteDB + ")\n" | ||
338 | + + "fromWriteDB:" +fromWriteDB + "\n" | ||
339 | + + "执行SQL:" + pagePql.toString() + "\n" | ||
340 | + + "返回条数:" + (resultList==null?0:resultList.size()) + "\n" | ||
341 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒(" | ||
342 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
343 | + + "*-*" | ||
344 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
345 | + + ")"); | ||
346 | + } | ||
347 | + return null; | ||
348 | + } | ||
349 | + | ||
350 | + /** | ||
351 | + * 添加 | ||
352 | + */ | ||
353 | + public int add${beanName}PO(${beanName}PO ${beanName}) { | ||
354 | + if (null == ${beanName}) { | ||
355 | + LogUtils.error("error:", logger, new Exception("请求条件异常,${beanName}不能为空!"), null, null); | ||
356 | + return -1; | ||
357 | + } | ||
358 | + Date starttime = new Date(); | ||
359 | + <#-- | ||
360 | + if (${beanName}.get${pkBeanName}() == null) { | ||
361 | + ${beanName}.set${pkBeanName}(this.find${beanName}POSeqNextVal()); | ||
362 | + } | ||
363 | + --> | ||
364 | + <#if columnList?exists> | ||
365 | + <#list columnList as clist> | ||
366 | + <#if clist.seqName?exists> | ||
367 | + if (${beanName}.get${pkBeanName}() == null) { | ||
368 | + ${beanName}.set${clist.columnUName}(this.find${beanName}POSeqNextVal()); | ||
369 | + } | ||
370 | + </#if> | ||
371 | + </#list> | ||
372 | + </#if> | ||
373 | + StringBuffer sql = new StringBuffer("INSERT INTO ${tableName}(" + "${column_list_str}" + ") VALUES ("); | ||
374 | + StringBuffer sqlI = new StringBuffer("INSERT INTO ${tableName}("); | ||
375 | + StringBuffer sqlC = new StringBuffer(") VALUES ("); | ||
376 | + StringBuffer pql = new StringBuffer(sql.toString()); | ||
377 | + List<Object> list = new ArrayList<Object>(); | ||
378 | + <#if columnList?exists> | ||
379 | + <#list columnList as clist> | ||
380 | + if(${beanName}.get${clist.columnUName}() != null){ | ||
381 | + sqlI.append("${clist.columnName},"); | ||
382 | + sqlC.append(" ?, "); | ||
383 | + pql.append(${beanName}.get${clist.columnUName}() + ", "); | ||
384 | + list.add(${beanName}.get${clist.columnUName}()); | ||
385 | + } | ||
386 | + | ||
387 | + </#list> | ||
388 | + </#if> | ||
389 | + | ||
390 | + int count = 0; | ||
391 | + try { | ||
392 | + jdbcegroceryWrite.update(StringUtil.removeLast(StringUtil.removeLast(sqlI.toString())+sqlC.toString()) + ")", list.toArray()); | ||
393 | + count = jdbcegroceryWrite.queryForInt("SELECT LAST_INSERT_ID()"); | ||
394 | + return count; | ||
395 | + } catch (Exception e) { | ||
396 | + LogUtils.error("error:", logger, e, StringUtil.removeLast(pql.toString()) + ")", null); | ||
397 | + } finally { | ||
398 | + Date endtime = new Date(); | ||
399 | + LogUtils.info("info:", logger, | ||
400 | + "${beanName}Dao.add${beanName}PO (${beanName}PO ${beanName})\n" | ||
401 | + + "执行SQL:" + StringUtil.removeLast(pql.toString()) + ")" + "\n" | ||
402 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" | ||
403 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
404 | + + "*-*" | ||
405 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
406 | + + ")"); | ||
407 | + } | ||
408 | + return -1; | ||
409 | + } | ||
410 | + /** | ||
411 | + * 批量添加 | ||
412 | + */ | ||
413 | + public int add${beanName}POList(List<${beanName}PO> ${beanName}list) { | ||
414 | + Date starttime = new Date(); | ||
415 | + int count = 0; | ||
416 | + for (${beanName}PO ${beanName} : ${beanName}list) { | ||
417 | + count += add${beanName}PO(${beanName}); | ||
418 | + } | ||
419 | + Date endtime = new Date(); | ||
420 | + LogUtils.info("info:", logger, | ||
421 | + "${beanName}Dao.add${beanName}POList(List<${beanName}PO> ${beanName}list)\n" | ||
422 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" | ||
423 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
424 | + + "*-*" | ||
425 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
426 | + + ")"); | ||
427 | + return count; | ||
428 | + } | ||
429 | + /** | ||
430 | + * 按ID删除 | ||
431 | + */ | ||
432 | + public int delete${beanName}POByID(${pkType} id) { | ||
433 | + Date starttime = new Date(); | ||
434 | + StringBuffer sql = new StringBuffer("DELETE FROM ${tableName} WHERE"); | ||
435 | + StringBuffer pql = new StringBuffer(sql.toString()); | ||
436 | + pql.append(" ${pkColumName} = " + id); | ||
437 | + sql.append(" ${pkColumName} = ?"); | ||
438 | + int count = 0; | ||
439 | + try { | ||
440 | + count = jdbcegroceryWrite.update(sql.toString(), id); | ||
441 | + return count; | ||
442 | + } catch (Exception e) { | ||
443 | + LogUtils.error("error:", logger, e, pql.toString(), null); | ||
444 | + } finally { | ||
445 | + Date endtime = new Date(); | ||
446 | + LogUtils.info("info:", logger, | ||
447 | + "${beanName}Dao.delete${beanName}POByID(${pkType} id)\n" | ||
448 | + + "执行SQL:" + pql.toString() + "\n" | ||
449 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" | ||
450 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
451 | + + "*-*" | ||
452 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
453 | + + ")"); | ||
454 | + } | ||
455 | + return -1; | ||
456 | + } | ||
457 | + /** | ||
458 | + * 删除按List<Object[]>条件 | ||
459 | + * Object[]数组长度是3 | ||
460 | + * Object[], 第一个参数是列名,第二个参数是操作符,第三个参数是查询条件的值。 | ||
461 | + */ | ||
462 | + public int delete${beanName}POByCondition(List<Object[]> condition) { | ||
463 | + if (null == condition || condition.size() == 0) { | ||
464 | + LogUtils.error("error:", logger, new Exception("请求条件异常,请求条件List<Object[]> condition不能为空!"), null, null); | ||
465 | + return -1; | ||
466 | + } | ||
467 | + if (StringUtil.isAutowired(condition)) { | ||
468 | + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); | ||
469 | + return -1; | ||
470 | + } | ||
471 | + Date starttime = new Date(); | ||
472 | + List<Object> list = new ArrayList<Object>(); | ||
473 | + StringBuffer sql = new StringBuffer("DELETE FROM ${tableName}"); | ||
474 | + StringBuffer pql = new StringBuffer(sql.toString()); | ||
475 | + JdbcUtil.appendWhereCondition(sql, pql, list, condition); | ||
476 | + int count = 0; | ||
477 | + try { | ||
478 | + count = jdbcegroceryWrite.update( sql.toString(), list.toArray()); | ||
479 | + return count; | ||
480 | + } catch (Exception e) { | ||
481 | + LogUtils.error("error:", logger, e, pql.toString(), null); | ||
482 | + } finally { | ||
483 | + Date endtime = new Date(); | ||
484 | + LogUtils.info("cacheinfo:", logger, | ||
485 | + "${beanName}Dao.delete${beanName}POByCondition(List<Object[]> condition)\n" | ||
486 | + + "执行SQL:" + pql.toString() + "\n" | ||
487 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" | ||
488 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
489 | + + "*-*" | ||
490 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
491 | + + ")"); | ||
492 | + } | ||
493 | + return -1; | ||
494 | + } | ||
495 | + | ||
496 | + /** | ||
497 | + * 删除按condition条件 | ||
498 | + * 建议使用delete${beanName}POByCondition(List<Object[]> condition), 如果remove${beanName}POByCondition(List<Object[]> condition)满足不了where条件可以使用此方法。 | ||
499 | + * condition为where后面的条件,condition不能为空。 | ||
500 | + */ | ||
501 | + public int delete${beanName}POBySql(String sqlCondition) { | ||
502 | + if (StringUtil.isEmpty(sqlCondition)) { | ||
503 | + LogUtils.error("error:", logger, new Exception("请求条件异常,请求条件String sqlCondition不能为空!"), null, null); | ||
504 | + return -1; | ||
505 | + } | ||
506 | + if (StringUtil.isAutowired(sqlCondition)) { | ||
507 | + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); | ||
508 | + return -1; | ||
509 | + } | ||
510 | + Date starttime = new Date(); | ||
511 | + | ||
512 | + StringBuffer sql = new StringBuffer("DELETE FROM ${tableName} WHERE "); | ||
513 | + int count = 0; | ||
514 | + try { | ||
515 | + count = jdbcegroceryWrite.update( sql.toString() + sqlCondition); | ||
516 | + return count; | ||
517 | + } catch (Exception e) { | ||
518 | + LogUtils.error("error:", logger, e, sql.toString() + sqlCondition, null); | ||
519 | + } finally { | ||
520 | + Date endtime = new Date(); | ||
521 | + LogUtils.info("info", logger, | ||
522 | + "${beanName}Dao.delete${beanName}POBySql(String sqlCondition)\n" | ||
523 | + + "执行SQL:" + sql.toString() + sqlCondition + "\n" | ||
524 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" | ||
525 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
526 | + + "*-*" | ||
527 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
528 | + + ")"); | ||
529 | + } | ||
530 | + return -1; | ||
531 | + } | ||
532 | + | ||
533 | + /** | ||
534 | + * 根据list对象逐个删除。 | ||
535 | + */ | ||
536 | + public int delete${beanName}POList(List<${beanName}PO> ${beanName}list) { | ||
537 | + int count = 0; | ||
538 | + for (${beanName}PO ${beanName} : ${beanName}list) { | ||
539 | + count += delete${beanName}POByID(${beanName}.get${pkBeanName}()); | ||
540 | + } | ||
541 | + return count; | ||
542 | + } | ||
543 | + | ||
544 | + /** | ||
545 | + * 根据对象ID修改。 | ||
546 | + */ | ||
547 | + public int update${beanName}PO(${beanName}PO ${beanName}) { | ||
548 | + if (null == ${beanName} || null == ${beanName}.get${pkBeanName}()) { | ||
549 | + LogUtils.error("error:", logger, new Exception("请求条件异常,请求对象和对象ID不能为空!"), null, null); | ||
550 | + return -1; | ||
551 | + } | ||
552 | + Date starttime = new Date(); | ||
553 | + StringBuffer sql = new StringBuffer("UPDATE ${tableName} SET"); | ||
554 | + StringBuffer pql = new StringBuffer(sql.toString()); | ||
555 | + List<Object> list = new ArrayList<Object>(); | ||
556 | + <#if columnList?exists> | ||
557 | + <#list columnList as clist> | ||
558 | + <#if clist.seqName?exists> | ||
559 | + <#else> | ||
560 | + <#if clist.columnJAVAType = "Long" || clist.columnJAVAType = "Integer" || clist.columnJAVAType = "Short" || clist.columnJAVAType = "Float" || clist.columnJAVAType = "Double"> | ||
561 | + boolean ${clist.columnUName}IsZero = false; | ||
562 | + Object variation${clist.columnUName} = ${beanName}.getVariation${clist.columnUName}(); | ||
563 | + if (variation${clist.columnUName} instanceof BigDecimal) { | ||
564 | + ${clist.columnUName}IsZero = (((BigDecimal)variation${clist.columnUName}).compareTo(BigDecimal.ZERO) == 0); | ||
565 | + } else { | ||
566 | + Long l${clist.columnUName} = Long.parseLong(String.valueOf(variation${clist.columnUName})); | ||
567 | + ${clist.columnUName}IsZero = (l${clist.columnUName} == 0); | ||
568 | + } | ||
569 | + if (!${clist.columnUName}IsZero) { | ||
570 | + sql.append(" ${clist.columnName} = ${clist.columnName} + ?, "); | ||
571 | + pql.append(" ${clist.columnName} = ${clist.columnName} + " + ${beanName}.getVariation${clist.columnUName}() + ","); | ||
572 | + list.add(${beanName}.getVariation${clist.columnUName}()); | ||
573 | + } else { | ||
574 | + sql.append(" ${clist.columnName} = ?, "); | ||
575 | + pql.append(" ${clist.columnName} = " + ${beanName}.get${clist.columnUName}() + ","); | ||
576 | + list.add(${beanName}.get${clist.columnUName}()); | ||
577 | + } | ||
578 | + <#elseif clist.columnJAVAType = "java.math.BigDecimal"> | ||
579 | + if (${beanName}.getVariation${clist.columnUName}().compareTo(BigDecimal.ZERO) != 0) { | ||
580 | + sql.append(" ${clist.columnName} = ${clist.columnName} + ?, "); | ||
581 | + pql.append(" ${clist.columnName} = ${clist.columnName} + " + ${beanName}.getVariation${clist.columnUName}() + ","); | ||
582 | + list.add(${beanName}.getVariation${clist.columnUName}()); | ||
583 | + } else { | ||
584 | + sql.append(" ${clist.columnName} = ?, "); | ||
585 | + pql.append(" ${clist.columnName} = " + ${beanName}.get${clist.columnUName}() + ","); | ||
586 | + list.add(${beanName}.get${clist.columnUName}()); | ||
587 | + } | ||
588 | + <#else> | ||
589 | + sql.append(" ${clist.columnName} = ?, "); | ||
590 | + pql.append(" ${clist.columnName} = " + ${beanName}.get${clist.columnUName}() + ","); | ||
591 | + list.add(${beanName}.get${clist.columnUName}()); | ||
592 | + </#if> | ||
593 | + </#if> | ||
594 | + </#list> | ||
595 | + </#if> | ||
596 | + | ||
597 | + String where = " WHERE ${pkColumName} = ?"; | ||
598 | + String pwhere = " WHERE ${pkColumName} = " + ${beanName}.get${pkBeanName}(); | ||
599 | + list.add(${beanName}.get${pkBeanName}()); | ||
600 | + int count = 0; | ||
601 | + try { | ||
602 | + count = jdbcegroceryWrite.update(StringUtil.removeLast(sql.toString()) + where, list.toArray()); | ||
603 | + return count; | ||
604 | + } catch (Exception e) { | ||
605 | + LogUtils.error("error:", logger, e, StringUtil.removeLast(pql.toString()) + pwhere, null); | ||
606 | + } finally { | ||
607 | + Date endtime = new Date(); | ||
608 | + LogUtils.info("info", logger, | ||
609 | + "${beanName}Dao.update${beanName}PO(${beanName}PO ${beanName})\n" | ||
610 | + + "执行SQL:" + StringUtil.removeLast(pql.toString()) + pwhere + "\n" | ||
611 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" | ||
612 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
613 | + + "*-*" | ||
614 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
615 | + + ")"); | ||
616 | + } | ||
617 | + return -1; | ||
618 | + } | ||
619 | + | ||
620 | + /** | ||
621 | + * 根据ID修改指定的值 | ||
622 | + */ | ||
623 | + public int update${beanName}FieldById(List<Object[]> changeList, ${pkType} id) { | ||
624 | + if (null == id) { | ||
625 | + LogUtils.error("error:", logger, new Exception("请求条件异常,请求对象和对象ID不能为空!"), null, null); | ||
626 | + return -1; | ||
627 | + } | ||
628 | + Date starttime =new Date(); | ||
629 | + StringBuffer sql = new StringBuffer("UPDATE ${tableName} SET"); | ||
630 | + StringBuffer pql = new StringBuffer(sql.toString()); | ||
631 | + List<Object> list = new ArrayList<Object>(); | ||
632 | + Map<Object,Object> map = new HashMap<Object,Object>(); | ||
633 | + for (int i = 0, iLen = changeList.size(); i < iLen; i++) { | ||
634 | + String name = (String) changeList.get(i)[0]; | ||
635 | + Object value = changeList.get(i)[1]; | ||
636 | + String variationOpt = "="; | ||
637 | + if (changeList.get(i).length > 2) | ||
638 | + variationOpt = (String)changeList.get(i)[2]; | ||
639 | + if (variationOpt.equals("=")) { | ||
640 | + sql.append(" " + name + " = ?,"); | ||
641 | + list.add(value); | ||
642 | + if (value == null) { | ||
643 | + pql.append(" " + name + "=null,"); | ||
644 | + } else { | ||
645 | + pql.append(" " + name + "=\"" + value.toString() + "\","); | ||
646 | + } | ||
647 | + map.put(name, value); | ||
648 | + } else { | ||
649 | + sql.append(" " + name + " = " + name + " + ?,"); | ||
650 | + list.add(value); | ||
651 | + pql.append(" " + name + " = " + name + " + " + value.toString() + ","); | ||
652 | + <#--会有问题 暂留 | ||
653 | + map.put(name, value);--> | ||
654 | + } | ||
655 | + } | ||
656 | + | ||
657 | + String where = " WHERE ${pkColumName}=?"; | ||
658 | + String pwhere = " WHERE ${pkColumName}=\"" + id + "\""; | ||
659 | + list.add(id); | ||
660 | + int count = 0; | ||
661 | + try { | ||
662 | + count = jdbcegroceryWrite.update(StringUtil.removeLast(sql.toString()) + where, list.toArray()); | ||
663 | + return count; | ||
664 | + } catch (Exception e) { | ||
665 | + LogUtils.error("error:", logger, e, StringUtil.removeLast(pql.toString()) + pwhere, null); | ||
666 | + } finally { | ||
667 | + Date endtime = new Date(); | ||
668 | + LogUtils.info("info", logger, | ||
669 | + "${beanName}Dao.update${beanName}PO(List<Object[]> changeList, ${pkType} id)\n" | ||
670 | + + "执行SQL:" + StringUtil.removeLast(pql.toString()) + pwhere + "\n" | ||
671 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" | ||
672 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
673 | + + "*-*" | ||
674 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
675 | + + ")"); | ||
676 | + } | ||
677 | + return -1; | ||
678 | + } | ||
679 | + | ||
680 | + /** | ||
681 | + * 批量修改。 | ||
682 | + */ | ||
683 | + public int update${beanName}POList(List<${beanName}PO> ${beanName}list) { | ||
684 | + int count = 0; | ||
685 | + for (${beanName}PO ${beanName} : ${beanName}list) { | ||
686 | + count += update${beanName}PO(${beanName}); | ||
687 | + } | ||
688 | + return count; | ||
689 | + } | ||
690 | + | ||
691 | + /** | ||
692 | + * List<Object[]> updateObj 要修改成的值,数组长度为2,第一个值为列名,第二个值是要改成的值。 | ||
693 | + * List<Object[]> condition 修改的条件, 数组长度是3, 第一个参数是列名,第二个参数是操作符,第三个参数是查询条件的值。 | ||
694 | + */ | ||
695 | + public int update${beanName}POByCondition(List<Object[]> updateObj, List<Object[]> condition) { | ||
696 | + if (null == updateObj || updateObj.size() == 0) { | ||
697 | + LogUtils.error("error:", logger, new Exception("请求条件异常,请求条件List<Object[]> updateObj不能为空!"), null, null); | ||
698 | + return -1; | ||
699 | + } | ||
700 | + if (null == condition || condition.size() == 0) { | ||
701 | + LogUtils.error("error:", logger, new Exception("请求条件异常,请求条件List<Object[]> condition不能为空!"), null, null); | ||
702 | + return -1; | ||
703 | + } | ||
704 | + if (StringUtil.isAutowired(condition)) { | ||
705 | + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); | ||
706 | + return -1; | ||
707 | + } | ||
708 | + Date starttime = new Date(); | ||
709 | + StringBuffer sql = new StringBuffer("UPDATE ${tableName} SET"); | ||
710 | + StringBuffer pql = new StringBuffer(sql.toString()); | ||
711 | + List<Object> list = new ArrayList<Object>(); | ||
712 | + JdbcUtil.appendSql(sql, pql, list, updateObj); | ||
713 | + StringBuffer where = new StringBuffer(""); | ||
714 | + StringBuffer pwhere = new StringBuffer(""); | ||
715 | + JdbcUtil.appendWhereCondition(where, pwhere, list, condition); | ||
716 | + int count = 0; | ||
717 | + try { | ||
718 | + count = jdbcegroceryWrite.update(StringUtil.removeLast(sql.toString()) + where.toString(), list.toArray()); | ||
719 | + return count; | ||
720 | + } catch (Exception e) { | ||
721 | + LogUtils.error("error:", logger, e, StringUtil.removeLast(pql.toString())+pwhere.toString(), null, null); | ||
722 | + } finally { | ||
723 | + Date endtime = new Date(); | ||
724 | + LogUtils.info("info", logger, | ||
725 | + "${beanName}Dao.update${beanName}POByCondition(List<Object[]> updateObj, List<Object[]> condition)\n" | ||
726 | + + "执行SQL:" + StringUtil.removeLast(pql.toString())+pwhere.toString() + "\n" | ||
727 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" | ||
728 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
729 | + + "*-*" | ||
730 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
731 | + + ")"); | ||
732 | + } | ||
733 | + return -1; | ||
734 | + } | ||
735 | + | ||
736 | + /** | ||
737 | + * List<Object[]> updateObj 要修改成的值,数组长度为2,第一个值为列名,第二个值是要改成的值。 | ||
738 | + * String sqlCondition 修改的条件。 | ||
739 | + */ | ||
740 | + public int update${beanName}POBySql(List<Object[]> updateObj, String sqlCondition) { | ||
741 | + if (null == updateObj || updateObj.size() == 0) { | ||
742 | + LogUtils.error("error:", logger, new Exception("请求条件异常,请求条件List<Object[]> updateObj不能为空!"), null, null); | ||
743 | + return -1; | ||
744 | + } | ||
745 | + if (StringUtil.isEmpty(sqlCondition)) { | ||
746 | + LogUtils.error("error:", logger, new Exception("请求条件异常,请求条件sqlCondition不能为空!"), null, null); | ||
747 | + return -1; | ||
748 | + } | ||
749 | + if (StringUtil.isAutowired(sqlCondition)) { | ||
750 | + LogUtils.error("error:", logger, new Exception("请求条件异常,无效请求!"), null, null); | ||
751 | + return -1; | ||
752 | + } | ||
753 | + Date starttime = new Date(); | ||
754 | + StringBuffer sql = new StringBuffer("UPDATE ${tableName} SET"); | ||
755 | + StringBuffer pql = new StringBuffer(sql.toString()); | ||
756 | + List<Object> list = new ArrayList<Object>(); | ||
757 | + JdbcUtil.appendSql(sql, pql, list, updateObj); | ||
758 | + int count = 0; | ||
759 | + try { | ||
760 | + count = jdbcegroceryWrite.update(StringUtil.removeLast(sql.toString()) + " WHERE "+sqlCondition, list.toArray()); | ||
761 | + return count; | ||
762 | + } catch (Exception e) { | ||
763 | + LogUtils.error("error:", logger, e, StringUtil.removeLast(pql.toString()) + " WHERE " + sqlCondition, null, null); | ||
764 | + } finally { | ||
765 | + Date endtime = new Date(); | ||
766 | + LogUtils.info("info", logger, | ||
767 | + "${beanName}Dao.update${beanName}POBySql(List<Object[]> updateObj, String sqlCondition)\n" | ||
768 | + + "执行SQL:" + StringUtil.removeLast(pql.toString()) + " WHERE " + sqlCondition + "\n" | ||
769 | + + "方法执行时长:" + (endtime.getTime()-starttime.getTime()) + "毫秒, 影响记录数:" + count + "(" | ||
770 | + + StringUtil.dateToFormatStr(starttime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
771 | + + "*-*" | ||
772 | + + StringUtil.dateToFormatStr(endtime, "yyyy-MM-dd HH:mm:ss.SSS") | ||
773 | + + ")"); | ||
774 | + } | ||
775 | + return -1; | ||
776 | + } | ||
777 | +} | ||
0 | \ No newline at end of file | 778 | \ No newline at end of file |
out/production/code-generater/com/taover/base/template/EntityTemplate.ftl
0 → 100644
@@ -0,0 +1,51 @@ | @@ -0,0 +1,51 @@ | ||
1 | +<#--包名 --> | ||
2 | +package ${packages} | ||
3 | + | ||
4 | +import java.io.Serializable; | ||
5 | +import java.math.BigDecimal; | ||
6 | +import java.sql.Timestamp; | ||
7 | +import java.util.Date; | ||
8 | + | ||
9 | +import javax.persistence.Entity; | ||
10 | +import javax.persistence.Table; | ||
11 | +import javax.persistence.Id; | ||
12 | +import javax.persistence.Column; | ||
13 | + | ||
14 | +/** | ||
15 | + <#if version?exists> | ||
16 | + * @version ${version} | ||
17 | + </#if> | ||
18 | + */ | ||
19 | +@Entity | ||
20 | +@Table(name="${tablemodel.tableName}") | ||
21 | +public class ${name}Entity implements Serializable { | ||
22 | + | ||
23 | + <#--变量 ,get,set方法--> | ||
24 | +<#if tablemodel.columnlist?exists> | ||
25 | + <#list tablemodel.columnlist as clist> | ||
26 | + | ||
27 | + <#if clist.columnRemarks?exists> | ||
28 | + /** | ||
29 | + * ${clist.columnRemarks} | ||
30 | + */ | ||
31 | + </#if> | ||
32 | + <#if clist.primaryKey == true> | ||
33 | + @Id | ||
34 | + </#if> | ||
35 | + @Column(name="${clist.columnUName}") | ||
36 | + private ${clist.columnJAVAType} ${clist.columnName}; | ||
37 | + | ||
38 | + public ${clist.columnJAVAType} get${clist.columnMethodName}(){ | ||
39 | + return ${clist.columnName}; | ||
40 | + } | ||
41 | + public void set${clist.columnMethodName}(${clist.columnJAVAType} ${clist.columnName}){ | ||
42 | + this.${clist.columnName} = ${clist.columnName}; | ||
43 | + } | ||
44 | + </#list> | ||
45 | +</#if> | ||
46 | + | ||
47 | + @Override | ||
48 | + public String toString() { | ||
49 | + return "${name}Entity: ${toStringMethodBody}; | ||
50 | + } | ||
51 | + } | ||
0 | \ No newline at end of file | 52 | \ No newline at end of file |
out/production/code-generater/com/taover/base/template/HtmlTemplate.ftl
0 → 100644
@@ -0,0 +1,88 @@ | @@ -0,0 +1,88 @@ | ||
1 | +<div class="easyui-layout" data-options="fit:true"> | ||
2 | + <div region="center"> | ||
3 | + <table id="${controllerPathMap}_list"></table> | ||
4 | + </div> | ||
5 | + | ||
6 | + <div class="easyui-tabs" region="south" style="height:200px;"> | ||
7 | + <div title="操作记录"> | ||
8 | + <table class="easyui-datagrid" data-options="fitColumns:true,fit:true,border:false"> | ||
9 | + <thead> | ||
10 | + <tr> | ||
11 | + <th data-options="field:'itemMan',width:10">操作人</th> | ||
12 | + <th data-options="field:'itemName',width:10">操作名称</th> | ||
13 | + <th data-options="field:'itemDate',width:10">操作日期</th> | ||
14 | + <th data-options="field:'itemNote',width:10">操作备注</th> | ||
15 | + </tr> | ||
16 | + </thead> | ||
17 | + </table> | ||
18 | + </div> | ||
19 | + </div> | ||
20 | +</div> | ||
21 | + | ||
22 | +<div id="${controllerPathMap}_toolbar" class="grid-toolbar"> | ||
23 | + <form id="${controllerPathMap}_toolbarForm"> | ||
24 | + <div class="toolbar-form-item"> | ||
25 | + <span>店铺名称</span> | ||
26 | + <select name="shopName" class="easyui-combobox search_input"> | ||
27 | + <option value="">全部</option> | ||
28 | + <option value="京东">京东店铺</option> | ||
29 | + <option value="淘宝">淘宝店铺</option> | ||
30 | + <option value="试吃">试吃店铺</option> | ||
31 | + <option value="爱">爱仕达</option> | ||
32 | + </select> | ||
33 | + </div> | ||
34 | + <div class="toolbar-form-item"> | ||
35 | + <span>状态</span> | ||
36 | + <select name="status" class="easyui-combobox search_input"> | ||
37 | + <option value="">全部</option> | ||
38 | + <option value="1">正常</option> | ||
39 | + <option value="0">停用</option> | ||
40 | + </select> | ||
41 | + </div> | ||
42 | + <span> | ||
43 | + <a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="${controllerPathMap}Page.searchObjects();">查询</a> | ||
44 | + </span> | ||
45 | + </form> | ||
46 | + <div> | ||
47 | + <a href="#" iconCls="icon-add" class="easyui-linkbutton" onclick="${controllerPathMap}Page.addObject();">添加</a> | ||
48 | + <a href="#" iconCls="icon-cancel" class="easyui-linkbutton" onclick="${controllerPathMap}Page.deleteObjects();">删除</a> | ||
49 | + </div> | ||
50 | +</div> | ||
51 | + | ||
52 | +<!-- | ||
53 | + 表单呈现样式: | ||
54 | + 数字类型--numberbox | ||
55 | + 文本类型--validatebox | ||
56 | + 日期类型--datetimebox | ||
57 | + 密码类型--passwordbox | ||
58 | + ...等等 | ||
59 | + 表单验证方式: | ||
60 | + 必填--requried | ||
61 | + 数字验证--numberbox[precision,min,max] | ||
62 | + 自定义验证--validType[url,email,length[0,100],remote['http://.../action.do','paramName']] | ||
63 | + --> | ||
64 | +<form id="${controllerPathMap}_add"> | ||
65 | + <table class="dialog-form-table"> | ||
66 | + <#list fields as tempField> | ||
67 | + <#if (tempField["name"]!="id")> | ||
68 | + <tr> | ||
69 | + <td><span>${tempField["cnName"]}:</span></td> | ||
70 | + <td><input type="text" name="${tempField["name"]!""}" class="easyui-${tempField["easyui"]!""} textbox" ${tempField["required"]!""} ${tempField["attr"]!""} /></td> | ||
71 | + </tr> | ||
72 | + </#if> | ||
73 | + </#list> | ||
74 | + </table> | ||
75 | +</form> | ||
76 | + | ||
77 | +<form id="${controllerPathMap}_edit"> | ||
78 | + <table class="dialog-form-table"> | ||
79 | + <#list fields as tempField> | ||
80 | + <tr> | ||
81 | + <td><span>${tempField["cnName"]}:</span></td> | ||
82 | + <td><input type="text" name="${tempField["name"]!""}" class="easyui-${tempField["easyui"]!""} textbox" ${tempField["required"]!""} ${tempField["attr"]!""} /></td> | ||
83 | + </tr> | ||
84 | + </#list> | ||
85 | + </table> | ||
86 | +</form> | ||
87 | + | ||
88 | +<script type="text/javascript" src="../js/${controllerPathMap}.js?v=1234"></script> |
out/production/code-generater/com/taover/base/template/JsTemplate.ftl
0 → 100644
@@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
1 | +$(function(){ | ||
2 | + var controllerPathMap = "${controllerPathMap}"; | ||
3 | + var addDialogId = controllerPathMap+"_add"; | ||
4 | + var editDialogId = controllerPathMap+"_edit"; | ||
5 | + var gridId = controllerPathMap+"_list"; | ||
6 | + var gridToolbarId = controllerPathMap+"_toolbar" | ||
7 | + var gridColumns = [{ | ||
8 | + field: 'selectedItem', | ||
9 | + checkbox: true | ||
10 | + }, | ||
11 | + <#list fields as tempField> | ||
12 | + <#if tempField["name"] != "id"> | ||
13 | + { | ||
14 | + field: '${tempField["name"]}', | ||
15 | + title: '${tempField["cnName"]}', | ||
16 | + sortable: true, | ||
17 | + }, | ||
18 | + </#if> | ||
19 | + </#list> | ||
20 | + { | ||
21 | + field : 'id', | ||
22 | + title : '操作', | ||
23 | + width : 10, | ||
24 | + formatter : function(value, rows, index){ | ||
25 | + return '<a style="color: green" onclick="${controllerPathMap}Page.editObject(' + index + ');">修改</a> | ' + | ||
26 | + '<a style="color: red" target="_self" onclick="${controllerPathMap}Page.deleteObject('+value+');">删除</a>'; | ||
27 | + }, | ||
28 | + }, | ||
29 | + ]; | ||
30 | + | ||
31 | + ${controllerPathMap}Page = tabInit(controllerPathMap, addDialogId, editDialogId, gridId, gridToolbarId, gridColumns); | ||
32 | +}); | ||
33 | + |
out/production/code-generater/com/taover/base/template/POTemplate.ftl
0 → 100644
@@ -0,0 +1,75 @@ | @@ -0,0 +1,75 @@ | ||
1 | +<#--包名 --> | ||
2 | +package ${packages} | ||
3 | +import java.util.HashMap; | ||
4 | +import java.util.Map; | ||
5 | +import java.io.Serializable; | ||
6 | +/** | ||
7 | + <#if version?exists> | ||
8 | + * @version ${version} | ||
9 | + </#if> | ||
10 | + */ | ||
11 | + | ||
12 | + public class ${name}PO implements Serializable { | ||
13 | + | ||
14 | + <#--变量 ,get,set方法--> | ||
15 | +<#if tablemodel.columnlist?exists> | ||
16 | + <#list tablemodel.columnlist as clist> | ||
17 | + private ${clist.columnJAVAType} ${clist.columnName}; | ||
18 | + | ||
19 | + <#if clist.columnRemarks?exists> | ||
20 | + /** | ||
21 | + * ${clist.columnRemarks} | ||
22 | + */ | ||
23 | + <#else> | ||
24 | + </#if> | ||
25 | + <#if clist.columnJAVAType = "java.sql.Timestamp" > | ||
26 | + @org.codehaus.jackson.map.annotate.JsonSerialize(using = com.taover.tools.DateTimeSerializer.class) | ||
27 | + </#if> | ||
28 | + <#if clist.columnJAVAType = "java.util.Date" > | ||
29 | + @org.codehaus.jackson.map.annotate.JsonSerialize(using = com.taover.tools.DateSerializer.class) | ||
30 | + </#if> | ||
31 | + public ${clist.columnJAVAType} get${clist.columnMethodName}(){ | ||
32 | + return ${clist.columnName}; | ||
33 | + } | ||
34 | + | ||
35 | + public void set${clist.columnMethodName}(${clist.columnJAVAType} ${clist.columnName}){ | ||
36 | + this.${clist.columnName} = ${clist.columnName}; | ||
37 | + } | ||
38 | + | ||
39 | + <#if clist.columnJAVAType = "Long" || clist.columnJAVAType = "java.math.BigDecimal" || clist.columnJAVAType = "Integer" || clist.columnJAVAType = "Short" || clist.columnJAVAType = "Float" || clist.columnJAVAType = "Double"> | ||
40 | + <#if clist.columnJAVAType = "Long"> | ||
41 | + private ${clist.columnJAVAType} variation${clist.columnMethodName} = 0L; | ||
42 | + </#if> | ||
43 | + <#if clist.columnJAVAType = "java.math.BigDecimal"> | ||
44 | + private ${clist.columnJAVAType} variation${clist.columnMethodName} = new java.math.BigDecimal(0.0); | ||
45 | + </#if> | ||
46 | + <#if clist.columnJAVAType = "Integer"> | ||
47 | + private ${clist.columnJAVAType} variation${clist.columnMethodName} = 0; | ||
48 | + </#if> | ||
49 | + <#if clist.columnJAVAType = "Short"> | ||
50 | + private ${clist.columnJAVAType} variation${clist.columnMethodName} = 0; | ||
51 | + </#if> | ||
52 | + <#if clist.columnJAVAType = "Double"> | ||
53 | + private ${clist.columnJAVAType} variation${clist.columnMethodName} = 0d; | ||
54 | + </#if> | ||
55 | + <#if clist.columnJAVAType = "Float"> | ||
56 | + private ${clist.columnJAVAType} variation${clist.columnMethodName} = 0f; | ||
57 | + </#if> | ||
58 | + public ${clist.columnJAVAType} getVariation${clist.columnMethodName}(){ | ||
59 | + return variation${clist.columnMethodName}; | ||
60 | + } | ||
61 | + | ||
62 | + public void setVariation${clist.columnMethodName}(${clist.columnJAVAType} variation${clist.columnName}){ | ||
63 | + this.variation${clist.columnMethodName} = variation${clist.columnName}; | ||
64 | + } | ||
65 | + | ||
66 | + </#if> | ||
67 | + | ||
68 | + </#list> | ||
69 | +</#if> | ||
70 | + | ||
71 | + @Override | ||
72 | + public String toString() { | ||
73 | + return "${name}PO: ${toStringMethodBody}; | ||
74 | + } | ||
75 | + } | ||
0 | \ No newline at end of file | 76 | \ No newline at end of file |
out/production/code-generater/com/taover/base/template/ServiceImplTemplate.ftl
0 → 100644
@@ -0,0 +1,291 @@ | @@ -0,0 +1,291 @@ | ||
1 | +package ${packageInfo}.impl; | ||
2 | + | ||
3 | +import java.util.ArrayList; | ||
4 | +import java.util.HashMap; | ||
5 | +import java.util.List; | ||
6 | +import java.util.Map; | ||
7 | + | ||
8 | +import javax.annotation.Resource; | ||
9 | + | ||
10 | +import org.apache.commons.lang.StringUtils; | ||
11 | +import org.springframework.stereotype.Service; | ||
12 | +import com.taover.base.ResultInfo; | ||
13 | + | ||
14 | +import ${poPackageInfo}.${beanClassName}Dao; | ||
15 | +import ${poPackageInfo}.${beanClassName}PO; | ||
16 | +import ${packageInfo}.${beanClassName}Service; | ||
17 | +import ${utilPackageInfo}.ObjectUtil; | ||
18 | + | ||
19 | +@Service | ||
20 | +public class ${beanClassName}ServiceImpl implements ${beanClassName}Service{ | ||
21 | + @Resource | ||
22 | + private ${beanClassName}Dao ${beanFieldName}Dao; | ||
23 | + | ||
24 | + @Override | ||
25 | + public ResultInfo add(${beanClassName}PO ${beanFieldName}PO){ | ||
26 | + //创建返回对象 | ||
27 | + ResultInfo result = new ResultInfo(); | ||
28 | + | ||
29 | + //调用Service方法 | ||
30 | + ${beanClassName}PO addResult = this.add${beanClassName}PO(${beanFieldName}PO); | ||
31 | + if(addResult == null){ | ||
32 | + result.setResultId("failure"); | ||
33 | + result.setResultMessage("添加失败!"); | ||
34 | + //添加失败,将提交的对象信息放入 data.node | ||
35 | + result.addData("node", ${beanFieldName}PO); | ||
36 | + }else{ | ||
37 | + result.setResultId("success"); | ||
38 | + result.setResultMessage("添加成功!"); | ||
39 | + //添加成功,将添加成功的对象信息放入 data.node | ||
40 | + result.addData("node", addResult); | ||
41 | + } | ||
42 | + return result; | ||
43 | + } | ||
44 | + | ||
45 | + @Override | ||
46 | + public ResultInfo delete(Integer id){ | ||
47 | + //创建返回对象 | ||
48 | + ResultInfo result = new ResultInfo(); | ||
49 | + | ||
50 | + //参数检验 | ||
51 | + if(id==null || id<0){ | ||
52 | + result.setResultId("failure"); | ||
53 | + result.setResultMessage("删除失败,缺少主键信息或者主键错误!"); | ||
54 | + //添加失败,将提交的对象信息放入 data.node | ||
55 | + result.addData("node", id); | ||
56 | + return result; | ||
57 | + } | ||
58 | + | ||
59 | + //调用Service方法 | ||
60 | + boolean deleteResult = this.delete${beanClassName}PO(id); | ||
61 | + if(!deleteResult){ | ||
62 | + result.setResultId("failure"); | ||
63 | + result.setResultMessage("删除失败!"); | ||
64 | + //添加失败,将id信息放入 data.node | ||
65 | + result.addData("node", id); | ||
66 | + }else{ | ||
67 | + result.setResultId("success"); | ||
68 | + result.setResultMessage("删除成功!"); | ||
69 | + //添加成功,将id信息放入 data.node | ||
70 | + result.addData("node", id); | ||
71 | + } | ||
72 | + return result; | ||
73 | + } | ||
74 | + | ||
75 | + @Override | ||
76 | + public ResultInfo update(${beanClassName}PO ${beanFieldName}PO){ | ||
77 | + //创建返回对象 | ||
78 | + ResultInfo result = new ResultInfo(); | ||
79 | + | ||
80 | + //参数检验 | ||
81 | + if(${beanFieldName}PO==null || ${beanFieldName}PO.getId()==null){ | ||
82 | + result.setResultId("failure"); | ||
83 | + result.setResultMessage("更新失败,缺少主键信息!"); | ||
84 | + //添加失败,将提交的对象信息放入 data.node | ||
85 | + result.addData("node", ${beanFieldName}PO); | ||
86 | + return result; | ||
87 | + } | ||
88 | + | ||
89 | + //调用Service方法 | ||
90 | + ${beanClassName}PO updateResult = this.update${beanClassName}PO(${beanFieldName}PO.getId(), ${beanFieldName}PO); | ||
91 | + if(updateResult == null){ | ||
92 | + result.setResultId("failure"); | ||
93 | + result.setResultMessage("更新失败!"); | ||
94 | + //添加失败,将提交的对象信息放入 data.node | ||
95 | + result.addData("node", ${beanFieldName}PO); | ||
96 | + }else{ | ||
97 | + result.setResultId("success"); | ||
98 | + result.setResultMessage("更新成功!"); | ||
99 | + //添加成功,将添加成功的对象信息放入 data.node | ||
100 | + result.addData("node", updateResult); | ||
101 | + } | ||
102 | + return result; | ||
103 | + } | ||
104 | + | ||
105 | + @Override | ||
106 | + public ${beanClassName}PO add${beanClassName}PO(${beanClassName}PO ${beanFieldName}PO) { | ||
107 | + //参数检验 | ||
108 | + if(${beanFieldName}PO == null){ | ||
109 | + return null; | ||
110 | + } | ||
111 | + ${beanFieldName}PO.setId(null); | ||
112 | + | ||
113 | + //调用DAO方法添加实体 | ||
114 | + int result = this.${beanFieldName}Dao.add${beanClassName}PO(${beanFieldName}PO); | ||
115 | + | ||
116 | + //依据SQL执行结果返回数据 | ||
117 | + if(result > 0){ | ||
118 | + ${beanFieldName}PO.setId(result); | ||
119 | + return ${beanFieldName}PO; | ||
120 | + }else{ | ||
121 | + return null; | ||
122 | + } | ||
123 | + } | ||
124 | + | ||
125 | + @Override | ||
126 | + public boolean delete${beanClassName}PO(Integer id) { | ||
127 | + //参数检验 | ||
128 | + if(id==null || id<=0){ | ||
129 | + return false; | ||
130 | + } | ||
131 | + | ||
132 | + //执行DAO删除方法 | ||
133 | + int result = this.${beanFieldName}Dao.delete${beanClassName}POByID(id); | ||
134 | + | ||
135 | + //依据SQL执行结果返回数据 | ||
136 | + if(result==0 || result==1){ | ||
137 | + return true; | ||
138 | + }else{ | ||
139 | + return false; | ||
140 | + } | ||
141 | + } | ||
142 | + | ||
143 | + @Override | ||
144 | + public ${beanClassName}PO update${beanClassName}PO(Integer id, ${beanClassName}PO ${beanFieldName}PO) { | ||
145 | + //参数检验 | ||
146 | + if(${beanFieldName}PO==null || id==null){ | ||
147 | + return null; | ||
148 | + } | ||
149 | + | ||
150 | + //获取数据库中的对应记录 | ||
151 | + ${beanClassName}PO dest = this.${beanFieldName}Dao.findPOByID(id); | ||
152 | + if(dest == null){ | ||
153 | + return null; | ||
154 | + } | ||
155 | + | ||
156 | + //将erpShopListPO中不为null的字段拷贝到dest中 | ||
157 | + ObjectUtil.fieldCopy(${beanFieldName}PO, dest, false, new String[]{"id"}, false); | ||
158 | + //执行DAO操作方法 | ||
159 | + int result = this.${beanFieldName}Dao.update${beanClassName}PO(dest); | ||
160 | + | ||
161 | + //依据SQL执行结果返回数据 | ||
162 | + if(result==1){ | ||
163 | + return dest; | ||
164 | + }else{ | ||
165 | + return null; | ||
166 | + } | ||
167 | + } | ||
168 | + | ||
169 | + @Override | ||
170 | + public Map<String, Object> query${beanClassName}POList(List<Object[]> arrayCondition, String sort, String order, int page, int pageSize) { | ||
171 | + //参数检验 | ||
172 | + if(page==0 || pageSize<=0){ | ||
173 | + return new HashMap<String, Object>(); | ||
174 | + } | ||
175 | + | ||
176 | + //参数解析 | ||
177 | + if(arrayCondition==null || arrayCondition.size()==0){ | ||
178 | + arrayCondition = new ArrayList<Object[]>(); | ||
179 | + arrayCondition.add(new Object[]{"1=1", null}); | ||
180 | + } | ||
181 | + | ||
182 | + //构造排序内容 | ||
183 | + String sortCondition = " "; | ||
184 | + if(!StringUtils.isEmpty(sort)){ | ||
185 | + sortCondition = " order by "; | ||
186 | + String[] sortArr = sort.split(","); | ||
187 | + if(StringUtils.isEmpty(order)){ | ||
188 | + sortCondition += sortArr[0]+" DESC "; | ||
189 | + for(int i=1; i<sortArr.length; ++i){ | ||
190 | + sortCondition += ","+sortArr[i]+" DESC "; | ||
191 | + } | ||
192 | + }else{ | ||
193 | + String[] orderArr = order.split(","); | ||
194 | + sortCondition += sortArr[0]+" "+orderArr[0]+" "; | ||
195 | + for(int i=1; i<sortArr.length; ++i){ | ||
196 | + if(i < orderArr.length){ | ||
197 | + sortCondition = ","+sortArr[i]+" "+orderArr[i]+" "; | ||
198 | + }else{ | ||
199 | + sortCondition = ","+sortArr[i]+" DESC "; | ||
200 | + } | ||
201 | + } | ||
202 | + } | ||
203 | + } | ||
204 | + | ||
205 | + | ||
206 | + //调用DAO查询 | ||
207 | + Map<String, Object> result = new HashMap<String, Object>(); | ||
208 | + if(page == -1){ | ||
209 | + List<${beanClassName}PO> ${beanFieldName}POList = this.${beanFieldName}Dao.findListByCondition(arrayCondition, sortCondition, false); | ||
210 | + result.put("page", 1); | ||
211 | + result.put("total", ${beanFieldName}POList.size()); | ||
212 | + result.put("rows", ${beanFieldName}POList); | ||
213 | + }else{ | ||
214 | + result = this.${beanFieldName}Dao.findPageByCondition(arrayCondition, sortCondition, page, pageSize, false); | ||
215 | + } | ||
216 | + | ||
217 | + return result; | ||
218 | + } | ||
219 | + | ||
220 | + @Override | ||
221 | + public Map<String, Object> query${beanClassName}POList(String sqlCondition, String sort, String order, int page, int pageSize) { | ||
222 | + //参数检验 | ||
223 | + if(page==0 || pageSize<=0){ | ||
224 | + return new HashMap<String, Object>(); | ||
225 | + } | ||
226 | + | ||
227 | + //参数解析 | ||
228 | + if(sqlCondition==null || sqlCondition.length()==0){ | ||
229 | + sqlCondition = " 1=1 "; | ||
230 | + } | ||
231 | + | ||
232 | + //构造排序内容 | ||
233 | + String sortCondition = ErpSQLUtil.getSortCondition(sort, order, null); | ||
234 | + sqlCondition += sortCondition; | ||
235 | + | ||
236 | + //调用DAO查询 | ||
237 | + Map<String, Object> result = new HashMap<String, Object>(); | ||
238 | + if(page == -1){ | ||
239 | + List<${beanClassName}PO> ${beanFieldName}POList = this.${beanFieldName}Dao.findListBySql(sqlCondition); | ||
240 | + result.put("page", 1); | ||
241 | + result.put("total", ${beanFieldName}POList.size()); | ||
242 | + result.put("rows", ${beanFieldName}POList); | ||
243 | + }else{ | ||
244 | + result = this.${beanFieldName}Dao.findPageBySql(sqlCondition, page, pageSize); | ||
245 | + } | ||
246 | + return result; | ||
247 | + } | ||
248 | + | ||
249 | + @Override | ||
250 | + public ${beanClassName}PO query${beanClassName}PO(Integer id) { | ||
251 | + //参数检验 | ||
252 | + if(id == null){ | ||
253 | + return null; | ||
254 | + } | ||
255 | + | ||
256 | + //调用DAO方法查询 | ||
257 | + return this.${beanFieldName}Dao.findPOByID(id); | ||
258 | + } | ||
259 | + | ||
260 | + @Override | ||
261 | + public ${beanClassName}PO query${beanClassName}PO(String sqlCondition) { | ||
262 | + //参数检验 | ||
263 | + if(sqlCondition==null || sqlCondition.length()==0){ | ||
264 | + return null; | ||
265 | + } | ||
266 | + | ||
267 | + //调用DAO方法 | ||
268 | + List<${beanClassName}PO> resultList = this.${beanFieldName}Dao.findListBySql(sqlCondition); | ||
269 | + if(resultList==null || resultList.size()==0){ | ||
270 | + return null; | ||
271 | + }else{ | ||
272 | + return resultList.get(0); | ||
273 | + } | ||
274 | + } | ||
275 | + | ||
276 | + @Override | ||
277 | + public ${beanClassName}PO query${beanClassName}PO(List<Object[]> arrayCondition) { | ||
278 | + //参数检验 | ||
279 | + if(arrayCondition==null || arrayCondition.size()==0){ | ||
280 | + return null; | ||
281 | + } | ||
282 | + | ||
283 | + //调用DAO方法 | ||
284 | + List<${beanClassName}PO> resultList = this.${beanFieldName}Dao.findListByCondition(arrayCondition); | ||
285 | + if(resultList==null || resultList.size()==0){ | ||
286 | + return null; | ||
287 | + }else{ | ||
288 | + return resultList.get(0); | ||
289 | + } | ||
290 | + } | ||
291 | +} |
out/production/code-generater/com/taover/base/template/ServiceTemplate.ftl
0 → 100644
@@ -0,0 +1,87 @@ | @@ -0,0 +1,87 @@ | ||
1 | +package ${packageInfo}; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | +import java.util.Map; | ||
5 | + | ||
6 | +import com.taover.base.ResultInfo; | ||
7 | + | ||
8 | +import ${poPackageInfo}.${beanClassName}PO; | ||
9 | + | ||
10 | +public interface ${beanClassName}Service { | ||
11 | + /** | ||
12 | + * 业务层添加接口 | ||
13 | + */ | ||
14 | + public ResultInfo add(${beanClassName}PO ${beanFieldName}PO); | ||
15 | + | ||
16 | + /** | ||
17 | + * 业务层删除接口 | ||
18 | + */ | ||
19 | + public ResultInfo delete(Integer id); | ||
20 | + | ||
21 | + /** | ||
22 | + * 业务层更新接口 | ||
23 | + */ | ||
24 | + public ResultInfo update(${beanClassName}PO ${beanFieldName}PO); | ||
25 | + | ||
26 | + /** | ||
27 | + * 增加${beanClassName}PO | ||
28 | + * @param ${beanFieldName}PO | ||
29 | + * @return 返回增加后的实体,如果为null代表添加失败 | ||
30 | + */ | ||
31 | + public ${beanClassName}PO add${beanClassName}PO(${beanClassName}PO ${beanFieldName}PO); | ||
32 | + | ||
33 | + /** | ||
34 | + * 依据${beanClassName}PO id删除记录 | ||
35 | + * @param id | ||
36 | + * @return 返回删除是否成功 | ||
37 | + */ | ||
38 | + public boolean delete${beanClassName}PO(Integer id); | ||
39 | + | ||
40 | + /** | ||
41 | + * 依据${beanClassName}PO id更新记录,修改除id以外的其他字段 | ||
42 | + * @param id | ||
43 | + * @param ${beanFieldName} | ||
44 | + * @return 返回修改后的实体,如果为null代表修改失败 | ||
45 | + */ | ||
46 | + public ${beanClassName}PO update${beanClassName}PO(Integer id, ${beanClassName}PO ${beanFieldName}PO); | ||
47 | + | ||
48 | + /** | ||
49 | + * 依据arrayCondition,sqlCondition查询记录列表 | ||
50 | + * @param arrayCondition List<Object[]>类型,如果为null,表示不存在该条件约束 | ||
51 | + * @param page int类型,如果-1代表查询所有记录,0代表不取数据,>0代表所取页码 | ||
52 | + * @param pageSize int类型,>0时,该值有效,否则查询无效 | ||
53 | + * @return 返回实体列表 | ||
54 | + */ | ||
55 | + public Map<String, Object> query${beanClassName}POList(List<Object[]> arrayCondition, String sort, String order, int page, int pageSize); | ||
56 | + | ||
57 | + /** | ||
58 | + * 依据arrayCondition,sqlCondition查询记录列表 | ||
59 | + * @param sqlCondition String类型,如果为null,表示不存在该条件约束 | ||
60 | + * @param page int类型,如果-1代表查询所有记录,0代表不取数据,>0代表所取页码 | ||
61 | + * @param pageSize int类型,>0时,该值有效,否则查询无效 | ||
62 | + * @return 返回实体列表 | ||
63 | + */ | ||
64 | + public Map<String, Object> query${beanClassName}POList(String sqlCondition, String sort, String order, int page, int pageSize); | ||
65 | + | ||
66 | + /** | ||
67 | + * 依据id查询单条记录 | ||
68 | + * @param id | ||
69 | + * @return 返回实体引用,如果未找到返回null | ||
70 | + */ | ||
71 | + public ${beanClassName}PO query${beanClassName}PO(Integer id); | ||
72 | + | ||
73 | + /** | ||
74 | + * 依据sqlCondition查询条件查询单条记录,如果存在多条记录,则取第一条 | ||
75 | + * @param sqlCondition | ||
76 | + * @return 返回实体引用,如果未找到返回null | ||
77 | + */ | ||
78 | + public ${beanClassName}PO query${beanClassName}PO(String sqlCondition); | ||
79 | + | ||
80 | + /** | ||
81 | + * 依据arrayCondition查询条件查询单条记录,如果存在多条记录,则取第一条 | ||
82 | + * @param arrayCondition | ||
83 | + * @return 返回实体引用,如果未找到返回null | ||
84 | + */ | ||
85 | + public ${beanClassName}PO query${beanClassName}PO(List<Object[]> arrayCondition); | ||
86 | + | ||
87 | +} |
out/production/code-generater/com/taover/base/template/Temp.ftl
0 → 100644
@@ -0,0 +1,8 @@ | @@ -0,0 +1,8 @@ | ||
1 | +//${cnFunc} | ||
2 | +//${enFunc} | ||
3 | +<#list propertyList as property > | ||
4 | +var ${property} = getNumberBoxValue('${property}', 0); | ||
5 | +</#list> | ||
6 | + | ||
7 | +var ${enFunc}; | ||
8 | +$('#${result}').numberbox('setValue', ${result}); | ||
0 | \ No newline at end of file | 9 | \ No newline at end of file |
out/production/code-generater/com/taover/base/template/createTableTemplate.ftl
0 → 100644
@@ -0,0 +1,31 @@ | @@ -0,0 +1,31 @@ | ||
1 | +-- Create table | ||
2 | +create table ${tableName} | ||
3 | +( | ||
4 | +<#list columnlist as clist> | ||
5 | + ${clist.columnName} ${clist.columnSQLType}<#if clist.columnSize?exists>${clist.columnSize}</#if><#if clist.columnDefaults?exists && clist.columnDefaults != '' && clist.columnDefaults != 'null'> default ${clist.columnDefaults}</#if><#if !clist.nullable> not null</#if><#if clist_has_next>,</#if> | ||
6 | +</#list> | ||
7 | +); | ||
8 | +<#if tableRemarks?exists> | ||
9 | +-- Add comments to the table | ||
10 | +comment on table ${tableName} is '${tableRemarks}'; | ||
11 | +</#if> | ||
12 | +-- Add comments to the columns | ||
13 | +<#list columnlist as clist> | ||
14 | + <#if clist.columnRemarks?exists && clist.columnRemarks != clist.columnName> | ||
15 | +comment on column ${tableName}.${clist.columnName} is '${clist.columnRemarks}'; | ||
16 | + </#if> | ||
17 | +</#list> | ||
18 | +<#if tablePk?exists> | ||
19 | +-- Create index | ||
20 | +CREATE UNIQUE INDEX PK_${tableName} ON ${tableName}(${tablePk}); | ||
21 | +ALTER TABLE ${tableName} ADD | ||
22 | + PRIMARY KEY (${tablePk}) | ||
23 | + USING INDEX PK_${tableName}; | ||
24 | +</#if> | ||
25 | +-- Create sequence | ||
26 | +create sequence SEQ_${tableName}<#if tableName?length lt 24>_PK</#if> | ||
27 | +minvalue 1 | ||
28 | +maxvalue 99999999999999999 | ||
29 | +start with 1 | ||
30 | +increment by 1 | ||
31 | +cache 20; |
out/production/code-generater/com/taover/base/template/model/bussiness/ControllerModel.class
0 → 100644
No preview for this file type
out/production/code-generater/com/taover/base/template/model/bussiness/EnvironmentModel.class
0 → 100644
No preview for this file type
out/production/code-generater/com/taover/base/template/model/bussiness/ServiceModel.class
0 → 100644
No preview for this file type
out/production/code-generater/com/taover/base/template/model/bussiness/ViewModel.class
0 → 100644
No preview for this file type
out/production/code-generater/com/taover/base/template/model/createTable/ColumnModel.class
0 → 100644
No preview for this file type
out/production/code-generater/com/taover/base/template/model/createTable/TableModel.class
0 → 100644
No preview for this file type
out/production/code-generater/com/taover/base/template/model/dao/BaseModel.class
0 → 100644
No preview for this file type
out/production/code-generater/com/taover/base/template/model/dao/DaoModel.class
0 → 100644
No preview for this file type
out/production/code-generater/com/taover/base/template/model/dao/FunctionModel.class
0 → 100644
No preview for this file type
out/production/code-generater/com/taover/base/template/model/po/ColumnModel.class
0 → 100644
No preview for this file type
out/production/code-generater/com/taover/base/template/model/po/PoModel.class
0 → 100644
No preview for this file type
out/production/code-generater/com/taover/base/template/model/po/TableModel.class
0 → 100644
No preview for this file type
No preview for this file type
No preview for this file type
out/production/code-generater/com/taover/business/GenerateController.class
0 → 100644
No preview for this file type
out/production/code-generater/com/taover/business/GenerateService.class
0 → 100644
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
out/production/code-generater/com/taover/business/util/TempVelocity.class
0 → 100644
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
@@ -0,0 +1,48 @@ | @@ -0,0 +1,48 @@ | ||
1 | +#顶层po、dao文件生成总目录 | ||
2 | +OutputPath=\\D:\\dblist\\ | ||
3 | +#OutputPath=\\D:\\workproject\\suan-taover-com\\src\\main\\java\\com\\taover\\db\\ | ||
4 | +#OutputPath=\\C:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\db\\ | ||
5 | +#数据库名 | ||
6 | +SchameName=songshuyun_stat | ||
7 | +#SchameName=taoverprinter | ||
8 | +CreateSchame=false | ||
9 | +#TableName=erp_shop,erp_warehouse,erp_express_template,erp_goods_express,erp_order,erp_order_goods,erp_order_statistics,erp_orderstat_goods,erp_distribution,erp_delivery,erp_delivery_goods,erp_delivery_statistics,erp_deliverystat_goods | ||
10 | +#TableName=erp_log_name,erp_order_log,erp_delivery_log,erp_base_log | ||
11 | +#TableName=chl_payment,chl_payment_goods,chl_payment_log,chl_payment_batch,chl_payment_batch_confirm,chl_payment_batch_notice,chl_payment_batch_overdue | ||
12 | +#chl_quotation_channel,chl_quotation_contact,chl_quotation_contact_recommend | ||
13 | +TableName=message_group_task | ||
14 | +#数据库库连接信息 | ||
15 | +User=tylife | ||
16 | +Password=lexi365 | ||
17 | +#Password=qwe123!@# | ||
18 | +DBLikeStr=% | ||
19 | +#数据库驱动类型 | ||
20 | +driver=com.mysql.jdbc.Driver | ||
21 | +#数据库连接url | ||
22 | +URL=jdbc\:mysql\://127.0.0.1\:3306/songshuyun_stat | ||
23 | +#URL=jdbc\:mysql\://localhost\:3306/taoverprinter | ||
24 | +#数据库类型 | ||
25 | +dbtype=mysql | ||
26 | +#数据库顶层包名 | ||
27 | +#packageName=com.taover.printer.db | ||
28 | +packageName=com.ssy.java.entity | ||
29 | + | ||
30 | +#----------------------------- | ||
31 | +# 生成 Controller和Service所需参数 - | ||
32 | +#----------------------------- | ||
33 | +#模块包全名,controller、service包名都会由此生成 | ||
34 | +modulePackageInfo=com.taover.settlement.chlpayment | ||
35 | +#modulePackageInfo=com.taover.printer | ||
36 | +#模块本地文件夹路径 | ||
37 | +moduleFilePath=\\D:\\workproject\\suan-taover-com\\src\\main\\java\\com\\taover\\settlement\\chlpayment\\ | ||
38 | +#moduleFilePath=\\C:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\ | ||
39 | +#db包,同上面的packageName | ||
40 | +dbPackageInfo=com.taover.db | ||
41 | +#dbPackageInfo=com.taover.printer.db | ||
42 | + | ||
43 | +#----------------------------- | ||
44 | +# 生成View的HTML、JS所需参数 - | ||
45 | +#----------------------------- | ||
46 | +#WebRoot的本地路径 | ||
47 | +WebRootPath=\\D:\\workproject\\suan-taover-com\\WebRoot\\ | ||
48 | +#WebRootPath=\\C:\\workproject\\printer-taover-com\\WebRoot\\ | ||
0 | \ No newline at end of file | 49 | \ No newline at end of file |
@@ -0,0 +1,44 @@ | @@ -0,0 +1,44 @@ | ||
1 | +#顶层po、dao文件生成总目录 | ||
2 | +OutputPath=\\D:\\workproject\\erp-taover-com\\src\\com\\taover\\erp\\db\\ | ||
3 | +#OutputPath=\\C:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\db\\ | ||
4 | +#数据库名 | ||
5 | +SchameName=erp | ||
6 | +#SchameName=taoverprinter | ||
7 | +CreateSchame=false | ||
8 | +#TableName=erp_shop,erp_warehouse,erp_express_template,erp_goods_express,erp_order,erp_order_goods,erp_order_statistics,erp_orderstat_goods,erp_distribution,erp_delivery,erp_delivery_goods,erp_delivery_statistics,erp_deliverystat_goods | ||
9 | +TableName=erp_delivery_goods | ||
10 | +#数据库库连接信息 | ||
11 | +User=tylife | ||
12 | +Password=lexi365 | ||
13 | +#Password=qwe123!@# | ||
14 | +DBLikeStr=% | ||
15 | +#数据库驱动类型 | ||
16 | +driver=com.mysql.jdbc.Driver | ||
17 | +#数据库连接url | ||
18 | +URL=jdbc\:mysql\://127.0.0.1\:3306/erp | ||
19 | +#URL=jdbc\:mysql\://localhost\:3306/taoverprinter | ||
20 | +#数据库类型 | ||
21 | +dbtype=mysql | ||
22 | +#数据库顶层包名 | ||
23 | +#packageName=com.taover.printer.db | ||
24 | +packageName=com.taover.erp.db | ||
25 | + | ||
26 | +#----------------------------- | ||
27 | +# 生成 Controller和Service所需参数 - | ||
28 | +#----------------------------- | ||
29 | +#模块包全名,controller、service包名都会由此生成 | ||
30 | +modulePackageInfo=com.taover.erp | ||
31 | +#modulePackageInfo=com.taover.printer | ||
32 | +#模块本地文件夹路径 | ||
33 | +moduleFilePath=\\D:\\workproject\\erp-taover-com\\src\\com\\taover\\erp\\ | ||
34 | +#moduleFilePath=\\C:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\ | ||
35 | +#db包,同上面的packageName | ||
36 | +dbPackageInfo=com.taover.erp.db | ||
37 | +#dbPackageInfo=com.taover.printer.db | ||
38 | + | ||
39 | +#----------------------------- | ||
40 | +# 生成View的HTML、JS所需参数 - | ||
41 | +#----------------------------- | ||
42 | +#WebRoot的本地路径 | ||
43 | +WebRootPath=\\D:\\workproject\\erp-taover-com\\WebRoot\\ | ||
44 | +#WebRootPath=\\C:\\workproject\\printer-taover-com\\WebRoot\\ |
out/production/code-generater/evaluate.default.properties
0 → 100644
@@ -0,0 +1,36 @@ | @@ -0,0 +1,36 @@ | ||
1 | +#顶层po、dao文件生成总目录 | ||
2 | +OutputPath=\\D:\\workproject\\taover-evaluate\\src\\com\\taover\\evaluate\\db\\ | ||
3 | +#数据库名 | ||
4 | +SchameName=evaluate | ||
5 | +CreateSchame=false | ||
6 | +TableName=eva_brand | ||
7 | +#如果文件存在,是否覆盖 | ||
8 | +coverWhenFileExists=false | ||
9 | +#数据库库连接信息 | ||
10 | +User=tylife | ||
11 | +Password=lexi365 | ||
12 | +DBLikeStr=% | ||
13 | +#数据库驱动类型 | ||
14 | +driver=com.mysql.jdbc.Driver | ||
15 | +#数据库连接url | ||
16 | +URL=jdbc\:mysql\://127.0.0.1\:3306/evaluate | ||
17 | +#数据库类型 | ||
18 | +dbtype=mysql | ||
19 | +#数据库顶层包名 | ||
20 | +packageName=com.taover.evaluate.db | ||
21 | + | ||
22 | +#----------------------------- | ||
23 | +# 生成 Controller和Service所需参数 - | ||
24 | +#----------------------------- | ||
25 | +#模块包全名,controller、service包名都会由此生成 | ||
26 | +modulePackageInfo=com.taover.evaluate | ||
27 | +#模块本地文件夹路径 | ||
28 | +moduleFilePath=\\D:\\workproject\\taover-evaluate\\src\\com\\taover\\evaluate\\ | ||
29 | +#db包,同上面的packageName | ||
30 | +dbPackageInfo=com.taover.evaluate.db | ||
31 | + | ||
32 | +#----------------------------- | ||
33 | +# 生成View的HTML、JS所需参数 - | ||
34 | +#----------------------------- | ||
35 | +#WebRoot的本地路径 | ||
36 | +WebRootPath=\\D:\\workproject\\taover-evaluate\\WebRoot\\ | ||
0 | \ No newline at end of file | 37 | \ No newline at end of file |
@@ -0,0 +1,37 @@ | @@ -0,0 +1,37 @@ | ||
1 | +#顶层po、dao文件生成总目录 | ||
2 | +OutputPath=\\D:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\db\\ | ||
3 | +#数据库名 | ||
4 | +SchameName=taoverprinter | ||
5 | +CreateSchame=false | ||
6 | +#TableName=erp_shop,erp_warehouse,erp_express_template,erp_goods_express,erp_order,erp_order_goods,erp_order_statistics,erp_orderstat_goods,erp_distribution,erp_delivery,erp_delivery_goods,erp_delivery_statistics,erp_deliverystat_goods | ||
7 | +#TableName=erp_order,erp_delivery | ||
8 | +TableName=dy_queue | ||
9 | +#数据库库连接信息 | ||
10 | +User=tylife | ||
11 | +Password=lexi365 | ||
12 | +#Password=qwe123!@# | ||
13 | +DBLikeStr=% | ||
14 | +#数据库驱动类型 | ||
15 | +driver=com.mysql.jdbc.Driver | ||
16 | +#数据库连接url | ||
17 | +URL=jdbc\:mysql\://localhost\:3306/taoverprinter | ||
18 | +#数据库类型 | ||
19 | +dbtype=mysql | ||
20 | +#数据库顶层包名 | ||
21 | +packageName=com.taover.printer.db | ||
22 | + | ||
23 | +#----------------------------- | ||
24 | +# 生成 Controller和Service所需参数 - | ||
25 | +#----------------------------- | ||
26 | +#模块包全名,controller、service包名都会由此生成 | ||
27 | +modulePackageInfo=com.taover.printer | ||
28 | +#模块本地文件夹路径 | ||
29 | +moduleFilePath=\\D:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\ | ||
30 | +#db包,同上面的packageName | ||
31 | +dbPackageInfo=com.taover.printer.db | ||
32 | + | ||
33 | +#----------------------------- | ||
34 | +# 生成View的HTML、JS所需参数 - | ||
35 | +#----------------------------- | ||
36 | +#WebRoot的本地路径 | ||
37 | +WebRootPath=\\C:\\workproject\\printer-taover-com\\WebRoot\\ | ||
0 | \ No newline at end of file | 38 | \ No newline at end of file |
out/production/code-generater/schedule.default.properties
0 → 100644
@@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
1 | +#顶层po、dao文件生成总目录 | ||
2 | +OutputPath=\\D:\\workproject\\soa-schedule\\src\\com\\taover\\erp\\db\\ | ||
3 | +#OutputPath=\\C:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\db\\ | ||
4 | +#数据库名 | ||
5 | +SchameName=tylife | ||
6 | +#SchameName=taoverprinter | ||
7 | +CreateSchame=false | ||
8 | +#TableName=erp_shop,erp_warehouse,erp_express_template,erp_goods_express,erp_order,erp_order_goods,erp_order_statistics,erp_orderstat_goods,erp_distribution,erp_delivery,erp_delivery_goods,erp_delivery_statistics,erp_deliverystat_goods | ||
9 | +#TableName=erp_log_name,erp_order_log,erp_delivery_log,erp_base_log | ||
10 | +TableName=ecs_users | ||
11 | +#数据库库连接信息 | ||
12 | +User=tylife | ||
13 | +Password=lexi365 | ||
14 | +#Password=qwe123!@# | ||
15 | +DBLikeStr=% | ||
16 | +#数据库驱动类型 | ||
17 | +driver=com.mysql.jdbc.Driver | ||
18 | +#数据库连接url | ||
19 | +URL=jdbc\:mysql\://127.0.0.1\:3306/tylife | ||
20 | +#URL=jdbc\:mysql\://localhost\:3306/taoverprinter | ||
21 | +#数据库类型 | ||
22 | +dbtype=mysql | ||
23 | +#数据库顶层包名 | ||
24 | +#packageName=com.taover.printer.db | ||
25 | +packageName=com.taover.erp.db | ||
26 | + | ||
27 | +#----------------------------- | ||
28 | +# 生成 Controller和Service所需参数 - | ||
29 | +#----------------------------- | ||
30 | +#模块包全名,controller、service包名都会由此生成 | ||
31 | +modulePackageInfo=com.taover.erp | ||
32 | +#modulePackageInfo=com.taover.printer | ||
33 | +#模块本地文件夹路径 | ||
34 | +moduleFilePath=\\D:\\workproject\\soa-schedule\\src\\com\\taover\\ | ||
35 | +#moduleFilePath=\\C:\\workproject\\printer-taover-com\\src\\com\\taover\\printer\\ | ||
36 | +#db包,同上面的packageName | ||
37 | +dbPackageInfo=com.taover.db | ||
38 | +#dbPackageInfo=com.taover.printer.db | ||
39 | + | ||
40 | +#----------------------------- | ||
41 | +# 生成View的HTML、JS所需参数 - | ||
42 | +#----------------------------- | ||
43 | +#WebRoot的本地路径 | ||
44 | +WebRootPath=\\D:\\workproject\\esoa-schedule\\WebRoot\\ | ||
45 | +#WebRootPath=\\C:\\workproject\\printer-taover-com\\WebRoot\\ | ||
0 | \ No newline at end of file | 46 | \ No newline at end of file |
src/com/taover/ui/EntityGenWindow.java
@@ -177,7 +177,7 @@ public class EntityGenWindow { | @@ -177,7 +177,7 @@ public class EntityGenWindow { | ||
177 | } | 177 | } |
178 | 178 | ||
179 | private void initPropCombobox(JComboBox comboBox){ | 179 | private void initPropCombobox(JComboBox comboBox){ |
180 | - String binDirPath = Tools.getPath(); | 180 | + String binDirPath = UiUtils.getProjectRoot(); |
181 | File binDir = new File(binDirPath); | 181 | File binDir = new File(binDirPath); |
182 | File[] sonFileArr = binDir.listFiles(); | 182 | File[] sonFileArr = binDir.listFiles(); |
183 | for(int i=0; i<sonFileArr.length; ++i){ | 183 | for(int i=0; i<sonFileArr.length; ++i){ |
@@ -192,7 +192,7 @@ public class EntityGenWindow { | @@ -192,7 +192,7 @@ public class EntityGenWindow { | ||
192 | @Override | 192 | @Override |
193 | public void actionPerformed(ActionEvent e) { | 193 | public void actionPerformed(ActionEvent e) { |
194 | String propertyName = ((JComboBox)e.getSource()).getSelectedItem().toString(); | 194 | String propertyName = ((JComboBox)e.getSource()).getSelectedItem().toString(); |
195 | - String binDir = Tools.getPath(); | 195 | + String binDir = UiUtils.getProjectRoot(); |
196 | Properties prop = new Properties(); | 196 | Properties prop = new Properties(); |
197 | try { | 197 | try { |
198 | FileInputStream fis = new FileInputStream(new File(binDir+File.separator+propertyName)); | 198 | FileInputStream fis = new FileInputStream(new File(binDir+File.separator+propertyName)); |
src/com/taover/ui/UiUtils.java
@@ -14,6 +14,10 @@ import com.taover.db.TableColumn; | @@ -14,6 +14,10 @@ import com.taover.db.TableColumn; | ||
14 | import com.taover.db.Tools; | 14 | import com.taover.db.Tools; |
15 | 15 | ||
16 | public class UiUtils { | 16 | public class UiUtils { |
17 | + public static String getProjectRoot(){ | ||
18 | + return UiUtils.class.getResource("/").getPath(); | ||
19 | + } | ||
20 | + | ||
17 | public static Connection getConnection(String driver, String user, String password, String url) { | 21 | public static Connection getConnection(String driver, String user, String password, String url) { |
18 | Connection conn = null; | 22 | Connection conn = null; |
19 | try { | 23 | try { |