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