mirror of https://gitee.com/makejava/EasyCode.git
commit
402fb3a2ca
|
@ -24,6 +24,10 @@ public class TableInfo {
|
||||||
* 表名(首字母大写)
|
* 表名(首字母大写)
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
/**
|
||||||
|
* 表名前缀(首字母大写)
|
||||||
|
*/
|
||||||
|
private String preName;
|
||||||
/**
|
/**
|
||||||
* 注释
|
* 注释
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -117,6 +117,10 @@ public class CodeGenerateServiceImpl implements CodeGenerateService {
|
||||||
TemplateUtils.addGlobalConfig(templates);
|
TemplateUtils.addGlobalConfig(templates);
|
||||||
// 生成代码
|
// 生成代码
|
||||||
for (TableInfo tableInfo : tableInfoList) {
|
for (TableInfo tableInfo : tableInfoList) {
|
||||||
|
// 表名去除前缀
|
||||||
|
if (tableInfo.getName().startsWith(tableInfo.getPreName())) {
|
||||||
|
tableInfo.setName(tableInfo.getName().replace(tableInfo.getPreName(), ""));
|
||||||
|
}
|
||||||
// 构建参数
|
// 构建参数
|
||||||
Map<String, Object> param = getDefaultParam();
|
Map<String, Object> param = getDefaultParam();
|
||||||
// 其他参数
|
// 其他参数
|
||||||
|
|
|
@ -148,6 +148,8 @@ public class TableInfoServiceImpl implements TableInfoService {
|
||||||
tableInfo.setSavePackageName(tableInfoConfig.getSavePackageName());
|
tableInfo.setSavePackageName(tableInfoConfig.getSavePackageName());
|
||||||
// 选择的保存路径
|
// 选择的保存路径
|
||||||
tableInfo.setSavePath(tableInfoConfig.getSavePath());
|
tableInfo.setSavePath(tableInfoConfig.getSavePath());
|
||||||
|
// 选择的表名前缀
|
||||||
|
tableInfo.setPreName(tableInfoConfig.getPreName());
|
||||||
|
|
||||||
// 没有列时不处理
|
// 没有列时不处理
|
||||||
if (CollectionUtil.isEmpty(tableInfoConfig.getFullColumn())) {
|
if (CollectionUtil.isEmpty(tableInfoConfig.getFullColumn())) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="10" left="10" bottom="10" right="10"/>
|
<margin top="10" left="10" bottom="10" right="10"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<xy x="48" y="54" width="436" height="297"/>
|
<xy x="48" y="54" width="436" height="319"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
</grid>
|
</grid>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
<grid id="e3588" layout-manager="GridLayoutManager" row-count="7" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="e3588" layout-manager="GridLayoutManager" row-count="8" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
<grid id="7831c" binding="templatePanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="7831c" binding="templatePanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="3" column="1" row-span="4" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
<grid row="4" column="1" row-span="4" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
|
@ -133,7 +133,7 @@
|
||||||
</grid>
|
</grid>
|
||||||
<component id="91ae2" class="javax.swing.JLabel">
|
<component id="91ae2" class="javax.swing.JLabel">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="3" column="0" row-span="4" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="4" column="0" row-span="4" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text resource-bundle="string" key="label.template"/>
|
<text resource-bundle="string" key="label.template"/>
|
||||||
|
@ -141,7 +141,7 @@
|
||||||
</component>
|
</component>
|
||||||
<component id="9a8d1" class="javax.swing.JCheckBox" binding="allCheckBox" default-binding="true">
|
<component id="9a8d1" class="javax.swing.JCheckBox" binding="allCheckBox" default-binding="true">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="4" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text resource-bundle="string" key="label.all"/>
|
<text resource-bundle="string" key="label.all"/>
|
||||||
|
@ -149,12 +149,12 @@
|
||||||
</component>
|
</component>
|
||||||
<vspacer id="98aa7">
|
<vspacer id="98aa7">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="6" column="2" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
<grid row="7" column="2" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</vspacer>
|
</vspacer>
|
||||||
<component id="5e5a1" class="javax.swing.JCheckBox" binding="unifiedConfig">
|
<component id="5e5a1" class="javax.swing.JCheckBox" binding="unifiedConfig">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="4" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text resource-bundle="string" key="label.unified.config"/>
|
<text resource-bundle="string" key="label.unified.config"/>
|
||||||
|
@ -162,12 +162,29 @@
|
||||||
</component>
|
</component>
|
||||||
<component id="af94e" class="javax.swing.JCheckBox" binding="titleConfig">
|
<component id="af94e" class="javax.swing.JCheckBox" binding="titleConfig">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="6" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="禁止提示"/>
|
<text value="禁止提示"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
|
<component id="caddc" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<labelFor value="81a34"/>
|
||||||
|
<text resource-bundle="string" key="label.removePre"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="81a34" class="javax.swing.JTextField" binding="preField">
|
||||||
|
<constraints>
|
||||||
|
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
</children>
|
</children>
|
||||||
|
|
|
@ -18,10 +18,7 @@ import com.sjhy.plugin.entity.Template;
|
||||||
import com.sjhy.plugin.entity.TemplateGroup;
|
import com.sjhy.plugin.entity.TemplateGroup;
|
||||||
import com.sjhy.plugin.service.CodeGenerateService;
|
import com.sjhy.plugin.service.CodeGenerateService;
|
||||||
import com.sjhy.plugin.service.TableInfoService;
|
import com.sjhy.plugin.service.TableInfoService;
|
||||||
import com.sjhy.plugin.tool.CacheDataUtils;
|
import com.sjhy.plugin.tool.*;
|
||||||
import com.sjhy.plugin.tool.CurrGroupUtils;
|
|
||||||
import com.sjhy.plugin.tool.ModuleUtils;
|
|
||||||
import com.sjhy.plugin.tool.StringUtils;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
@ -64,6 +61,10 @@ public class SelectSavePath extends JDialog {
|
||||||
* 路径字段
|
* 路径字段
|
||||||
*/
|
*/
|
||||||
private JTextField pathField;
|
private JTextField pathField;
|
||||||
|
/**
|
||||||
|
* 前缀字段
|
||||||
|
*/
|
||||||
|
private JTextField preField;
|
||||||
/**
|
/**
|
||||||
* 包选择按钮
|
* 包选择按钮
|
||||||
*/
|
*/
|
||||||
|
@ -206,11 +207,11 @@ public class SelectSavePath extends JDialog {
|
||||||
if (!StringUtils.isEmpty(basePath) && savePath.startsWith(basePath)) {
|
if (!StringUtils.isEmpty(basePath) && savePath.startsWith(basePath)) {
|
||||||
savePath = savePath.replace(basePath, ".");
|
savePath = savePath.replace(basePath, ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存配置
|
// 保存配置
|
||||||
TableInfo tableInfo = tableInfoService.getTableInfoAndConfig(cacheDataUtils.getSelectDbTable());
|
TableInfo tableInfo = tableInfoService.getTableInfoAndConfig(cacheDataUtils.getSelectDbTable());
|
||||||
tableInfo.setSavePath(savePath);
|
tableInfo.setSavePath(savePath);
|
||||||
tableInfo.setSavePackageName(packageField.getText());
|
tableInfo.setSavePackageName(packageField.getText());
|
||||||
|
tableInfo.setPreName(NameUtils.getInstance().firstUpperCase(preField.getText()));
|
||||||
Module module = getSelectModule();
|
Module module = getSelectModule();
|
||||||
if (module != null) {
|
if (module != null) {
|
||||||
tableInfo.setSaveModelName(module.getName());
|
tableInfo.setSaveModelName(module.getName());
|
||||||
|
|
|
@ -9,6 +9,7 @@ label.module=&Module:
|
||||||
label.ok=&OK
|
label.ok=&OK
|
||||||
label.package=&Package:
|
label.package=&Package:
|
||||||
label.path=&Path:
|
label.path=&Path:
|
||||||
|
label.removePre=&RemovePre:
|
||||||
label.template=Template:
|
label.template=Template:
|
||||||
label.template.group=&\u6A21\u677F\u7EC4\uFF1A
|
label.template.group=&\u6A21\u677F\u7EC4\uFF1A
|
||||||
label.type.mapper=&\u7C7B\u578B\u6620\u5C04\u7EC4\uFF1A
|
label.type.mapper=&\u7C7B\u578B\u6620\u5C04\u7EC4\uFF1A
|
||||||
|
|
Loading…
Reference in New Issue