Skip to content

Commit 389f3e1

Browse files
committed
feat:支持新项目模版colaSingleMvp
1 parent 768e410 commit 389f3e1

File tree

5 files changed

+30
-7
lines changed

5 files changed

+30
-7
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ repositories {
3939
}
4040

4141
dependencies {
42-
implementation("com.wd.paas:wd-generator-core:4.0.1-RC05") {
42+
implementation("com.wd.paas:wd-generator-core:4.1.0-RC01") {
4343
exclude(group = "org.apache.velocity", module = "velocity")
4444
exclude(group = "org.apache.velocity", module = "velocity-engine-core")
4545
}

src/main/java/com/wk/paas/service/GenerateCodeService.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import com.wk.paas.window.setting.BindAppInfoSettings;
1919
import com.wk.paas.window.setting.CodeGenerateConfiguration;
2020
import com.wk.paas.window.setting.LoginAccountInfoSettings;
21-
import org.apache.commons.collections.CollectionUtils;
2221
import org.apache.commons.lang3.StringUtils;
2322

2423
import javax.swing.*;
@@ -61,7 +60,6 @@ public void execute() {
6160

6261
String outputPathText = config.getOutPath();
6362
boolean isInitCode = config.isInitCodeRadioButton();
64-
boolean isColaSingle = config.isColaSingleRadioButton();
6563
boolean isInitProjectStruct = config.isInitProjectStructCheckBox();
6664

6765
// 重写应用信息
@@ -73,7 +71,7 @@ public void execute() {
7371
GenerateOperationTypeEnum executeType = isInitCode ? GenerateOperationTypeEnum.INIT_CODE : GenerateOperationTypeEnum.UPDATE_CODE;
7472

7573
// 项目架构
76-
ProjectTemplateType projectType = isColaSingle ? ProjectTemplateType.COLA_SINGLE : ProjectTemplateType.COLA;
74+
ProjectTemplateType projectType = getProjectTemplateType(config);
7775

7876
// 实时解析DSL
7977
AppDSLBuilder appDSLBuilder = new AppDSLBuilder();
@@ -98,6 +96,18 @@ public void execute() {
9896
}
9997
}
10098

99+
private static ProjectTemplateType getProjectTemplateType(CodeGenerateConfiguration config) {
100+
if (config.isColaRadioButton()) {
101+
return ProjectTemplateType.COLA;
102+
} else if (config.isColaSingleRadioButton()) {
103+
return ProjectTemplateType.COLA_SINGLE;
104+
} else if (config.isColaSingleMvpRadioButton()) {
105+
return ProjectTemplateType.COLA_SINGLE_MVP;
106+
} else {
107+
throw new IllegalArgumentException("未知的项目架构类型");
108+
}
109+
}
110+
101111
private String buildAppDSLJson(JSONObject applicationJson, CodeGenerateConfiguration config) {
102112

103113
LoginAccountInfoSettings instance = LoginAccountInfoSettings.getInstance();

src/main/java/com/wk/paas/window/SelectElementDialog.form

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@
306306
</hspacer>
307307
</children>
308308
</grid>
309-
<grid id="ec92e" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
309+
<grid id="ec92e" layout-manager="GridLayoutManager" row-count="1" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
310310
<margin top="0" left="0" bottom="0" right="0"/>
311311
<constraints>
312312
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -341,9 +341,17 @@
341341
<text value="COLA-单体架构"/>
342342
</properties>
343343
</component>
344-
<hspacer id="d2792">
344+
<component id="3208a" class="javax.swing.JRadioButton" binding="colaSingleMvpRadioButton">
345345
<constraints>
346-
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
346+
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
347+
</constraints>
348+
<properties>
349+
<text value="COLA-单体架构-MVP"/>
350+
</properties>
351+
</component>
352+
<hspacer id="7e6e2">
353+
<constraints>
354+
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
347355
</constraints>
348356
</hspacer>
349357
</children>

src/main/java/com/wk/paas/window/SelectElementDialog.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class SelectElementDialog extends JDialog {
6161
private JCheckBox isInitProjectStructCheckBox;
6262
private JRadioButton colaRadioButton;
6363
private JRadioButton colaSingleRadioButton;
64+
private JRadioButton colaSingleMvpRadioButton;
6465
private JButton saveButton;
6566
private JButton bindProjectButton;
6667

@@ -181,6 +182,7 @@ public SelectElementDialog(Project project) {
181182
ButtonGroup buttonGroup2 = new ButtonGroup();
182183
buttonGroup2.add(colaRadioButton);
183184
buttonGroup2.add(colaSingleRadioButton);
185+
buttonGroup2.add(colaSingleMvpRadioButton);
184186

185187
buttonOK.addActionListener(e -> onOK());
186188
buttonCancel.addActionListener(e -> onCancel());
@@ -293,6 +295,7 @@ private void displayConfig(Project project) {
293295
updateCodeRadioButton.setSelected(config.isUpdateCodeRadioButton());
294296
colaRadioButton.setSelected(config.isColaRadioButton());
295297
colaSingleRadioButton.setSelected(config.isColaSingleRadioButton());
298+
colaSingleMvpRadioButton.setSelected(config.isColaSingleMvpRadioButton());
296299
Optional.of(config.isInitProjectStructCheckBox()).ifPresent(x -> isInitProjectStructCheckBox.setSelected(x));
297300
Optional.ofNullable(config.getOutPath()).ifPresent(x -> textFieldOutputPath.setText(x));
298301

@@ -405,6 +408,7 @@ private void onSave() {
405408
config.setUpdateCodeRadioButton(updateCodeRadioButton.isSelected());
406409
config.setColaRadioButton(colaRadioButton.isSelected());
407410
config.setColaSingleRadioButton(colaSingleRadioButton.isSelected());
411+
config.setColaSingleMvpRadioButton(colaSingleMvpRadioButton.isSelected());
408412
config.setInitProjectStructCheckBox(isInitProjectStructCheckBox.isSelected());
409413
config.setOutPath(textFieldOutputPath.getText());
410414

src/main/java/com/wk/paas/window/setting/CodeGenerateConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class CodeGenerateConfiguration implements PersistentStateComponent<CodeG
2020
private boolean updateCodeRadioButton;
2121
private boolean colaRadioButton;
2222
private boolean colaSingleRadioButton;
23+
private boolean colaSingleMvpRadioButton;
2324
private boolean isInitProjectStructCheckBox;
2425
private String outPath;
2526

0 commit comments

Comments
 (0)