1、继承多数据库

Former-commit-id: 143ebcc652b943130419ee5a72f3cb5acf02a785
master
wangbing 5 years ago
parent 1e0f2c8545
commit 298c13d927

@ -11,12 +11,24 @@ import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.Button;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TreeCell;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.control.cell.ChoiceBoxTableCell;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.scene.control.cell.TextFieldTreeCell;
import javafx.scene.input.*;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DragEvent;
import javafx.scene.input.Dragboard;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.TransferMode;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;
@ -27,10 +39,9 @@ import javafx.util.Callback;
import javafx.util.converter.DefaultStringConverter;
import javafx.util.converter.IntegerStringConverter;
import xyz.wbsite.dbtool.javafx.ctrl.DetailModuleController;
import xyz.wbsite.dbtool.javafx.ctrl.MainController;
import xyz.wbsite.dbtool.javafx.ctrl.DetailProjectController;
import xyz.wbsite.dbtool.javafx.ctrl.DetailTableController;
import xyz.wbsite.dbtool.javafx.view.DBCheckBoxTableCell;
import xyz.wbsite.dbtool.javafx.ctrl.MainController;
import xyz.wbsite.dbtool.javafx.enums.FieldType;
import xyz.wbsite.dbtool.javafx.manger.ManagerFactory;
import xyz.wbsite.dbtool.javafx.manger.ProjectManager;
@ -38,21 +49,20 @@ import xyz.wbsite.dbtool.javafx.po.Field;
import xyz.wbsite.dbtool.javafx.po.Module;
import xyz.wbsite.dbtool.javafx.po.Project;
import xyz.wbsite.dbtool.javafx.po.Table;
import xyz.wbsite.dbtool.javafx.tool.*;
import xyz.wbsite.dbtool.javafx.tool.Tool;
import xyz.wbsite.dbtool.javafx.view.DBCheckBoxTableCell;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
public class JavaFxApplication extends Application {
private ProjectManager dBmanger = ManagerFactory.getdBManager();
private ProjectManager dBmanger = ManagerFactory.getProjectManager();
private TreeView mdtree = null;
private Pane detail = null;
private TableView feilds = null;
private Button add = null;
private Button sub = null;
private CheckBox addSysFields = null;
private FXMLLoader mainloader;
private FXMLLoader projectdetailloader;
private FXMLLoader mddetailloader;
@ -125,14 +135,6 @@ public class JavaFxApplication extends Application {
}
});
addSysFields = mainController.getAddSysFields();
addSysFields.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
checkSysFields();
}
});
ContextMenu con = new ContextMenu(new MenuItem("新增"), new MenuItem("删除"), new MenuItem("向上调整"), new MenuItem("向下调整"));
con.setOnAction(new EventHandler<ActionEvent>() {
@Override
@ -442,6 +444,12 @@ public class JavaFxApplication extends Application {
currentProject.setProjectAuthor(newValue);
}
});
detailProjectController.getMultiDB().selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
currentProject.setMultiDB(newValue);
}
});
}
{//初始化表面板
@ -498,136 +506,26 @@ public class JavaFxApplication extends Application {
currentTable.setSearch(newValue);
}
});
detailTableController.getGetAll().selectedProperty().addListener(new ChangeListener<Boolean>() {
detailTableController.getHtml().selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
currentTable.setGetAll(newValue);
currentTable.setHtml(newValue);
}
});
detailTableController.getHtml().selectedProperty().addListener(new ChangeListener<Boolean>() {
detailTableController.getSys().selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
currentTable.setHtml(newValue);
currentTable.setSys(newValue);
loadingTable();
}
});
}
ManagerFactory.getReflashManager(this).start();
loadingProjectTree();
checkSysFields();
super.init();
}
private void checkSysFields() {
if (currentMD != null) {
boolean selected = addSysFields.isSelected();
removeSysFields(currentMD);
if (selected) {
bitchInsertSysFields(currentMD);
}
if (currentTable != null) {
loadingTable();
}
}
}
private void removeSysFields() {
for (Module md : dBmanger.getMds()) {
for (Table table : md.getTables()) {
Iterator<Field> iterator = table.getFields().iterator();
while (iterator.hasNext()) {
Field next = iterator.next();
if (next.getIsSystem()) {
iterator.remove();
}
}
}
}
}
private void removeSysFields(Module md) {
md.setHasSysFields(false);
for (Table table : md.getTables()) {
Iterator<Field> iterator = table.getFields().iterator();
while (iterator.hasNext()) {
Field next = iterator.next();
if (next.getIsSystem()) {
iterator.remove();
}
}
}
}
private void insertSysFields(Table table) {
Field id = new Field("ID");
id.setIsSystem(true);
id.setIsMust(true);
id.setIsPrimaryKey(true);
id.setFieldType(FieldType.Long);
id.setFieldLength(19);
id.setFieldComment("主键");
Field row_version = new Field("ROW_VERSION");
row_version.setIsSystem(true);
row_version.setIsMust(true);
row_version.setFieldType(FieldType.Long);
row_version.setFieldLength(19);
row_version.setFieldComment("行版本");
Field is_deleted = new Field("IS_DELETED");
is_deleted.setIsSystem(true);
is_deleted.setIsMust(true);
is_deleted.setDefaultValue("0");
is_deleted.setFieldType(FieldType.Boolean);
is_deleted.setFieldLength(1);
is_deleted.setFieldComment("是否已删除");
Field created_by = new Field("CREATE_BY");
created_by.setIsSystem(true);
created_by.setIsMust(true);
created_by.setFieldType(FieldType.Long);
created_by.setFieldLength(19);
created_by.setFieldComment("创建用户");
Field creation_time = new Field("CREATE_TIME");
creation_time.setIsSystem(true);
creation_time.setIsMust(true);
creation_time.setDefaultValue("NULL");
creation_time.setFieldType(FieldType.Date);
creation_time.setFieldComment("创建时间");
Field last_updated_by = new Field("LAST_UPDATE_BY");
last_updated_by.setIsSystem(true);
creation_time.setDefaultValue("NULL");
last_updated_by.setFieldType(FieldType.Long);
last_updated_by.setFieldLength(19);
last_updated_by.setFieldComment("最后更新用户");
Field last_update_time = new Field("LAST_UPDATE_TIME");
last_update_time.setIsSystem(true);
last_update_time.setFieldType(FieldType.Date);
last_update_time.setFieldComment("最后更新时间");
table.putFirstField(id);
table.putField(row_version);
table.putField(is_deleted);
table.putField(created_by);
table.putField(creation_time);
table.putField(last_updated_by);
table.putField(last_update_time);
}
private void bitchInsertSysFields() {
for (Module md : dBmanger.getMds()) {
md.getTables().forEach(this::insertSysFields);
}
}
private void bitchInsertSysFields(Module md) {
md.setHasSysFields(true);
md.getTables().forEach(this::insertSysFields);
}
private void addField() {
if (currentTable != null && feilds != null) {
List<Field> fields = currentTable.getFields();
@ -683,10 +581,6 @@ public class JavaFxApplication extends Application {
}
private void loadingModule() {
if (currentMD != null) {
addSysFields.setSelected(currentMD.isHasSysFields());
}
if (currentMD == null) {
return;
}
@ -710,6 +604,7 @@ public class JavaFxApplication extends Application {
detailProjectController.getProjectName().setText(currentProject.getProjectName());
detailProjectController.getProjectBasePackage().setText(currentProject.getProjectBasePackage());
detailProjectController.getProjectAuthor().setText(currentProject.getProjectAuthor());
detailProjectController.getMultiDB().setSelected(currentProject.getMultiDB());
if (gridPane != null) {
detail.getChildren().clear();
@ -724,11 +619,6 @@ public class JavaFxApplication extends Application {
*
*/
private void loadingTable() {
if (currentMD != null) {
addSysFields.setSelected(currentMD.isHasSysFields());
} else if (currentTable != null && currentTable.getdBhandle() != null) {
addSysFields.setSelected(currentTable.getdBhandle().isHasSysFields());
}
GridPane gridPane = tabledetailloader.getRoot();
if (currentTable != null) {
detailTableController.getTablename().setText(currentTable.getTableName());
@ -739,11 +629,10 @@ public class JavaFxApplication extends Application {
detailTableController.getFind().setSelected(currentTable.getFind());
detailTableController.getGet().setSelected(currentTable.getGet());
detailTableController.getSearch().setSelected(currentTable.getSearch());
detailTableController.getGetAll().setSelected(currentTable.getGetAll());
detailTableController.getHtml().setSelected(currentTable.getHtml());
detailTableController.getSys().setSelected(currentTable.getSys());
}
if (gridPane != null) {
detail.getChildren().clear();
detail.getChildren().add(gridPane);
@ -1293,9 +1182,6 @@ public class JavaFxApplication extends Application {
Module md = dBmanger.findDBByDBName((String) targetItem.getValue());
if (md != null) {
Table newTableName = dBmanger.getNewTableName(md);
if (addSysFields.isSelected()) {
insertSysFields(newTableName);
}
targetItem.getChildren().add(newTableName);
}
}
@ -1305,9 +1191,6 @@ public class JavaFxApplication extends Application {
System.out.println("对象:" + parent.getValue());
Module md = dBmanger.findDBByDBName((String) parent.getValue());
Table newTableName = dBmanger.getNewTableName(md);
if (addSysFields.isSelected()) {
insertSysFields(newTableName);
}
parent.getChildren().add(new TreeItem<>(newTableName.getTableName()));
break;
}
@ -1327,9 +1210,6 @@ public class JavaFxApplication extends Application {
System.out.println("模块:" + targetItem.getValue());
Module md = dBmanger.findDBByDBName((String) targetItem.getValue());
Table newTableName = dBmanger.getNewTableName(md);
if (addSysFields.isSelected()) {
insertSysFields(newTableName);
}
targetItem.getChildren().add(new TreeItem<>(newTableName.getTableName()));
}
break;

@ -1,6 +1,7 @@
package xyz.wbsite.dbtool.javafx.ctrl;
import javafx.fxml.FXML;
import javafx.scene.control.CheckBox;
import javafx.scene.control.TextField;
public class DetailProjectController {
@ -11,7 +12,16 @@ public class DetailProjectController {
private TextField projectBasePackage;
@FXML
private TextField projectAuthor;
@FXML
private CheckBox multiDB;
public CheckBox getMultiDB() {
return multiDB;
}
public void setMultiDB(CheckBox multiDB) {
this.multiDB = multiDB;
}
public TextField getProjectName() {
return projectName;

@ -24,9 +24,9 @@ public class DetailTableController {
@FXML
private CheckBox search;
@FXML
private CheckBox getAll;
@FXML
private CheckBox html;
@FXML
private CheckBox sys;
public CheckBox getCreate() {
return create;
@ -76,14 +76,6 @@ public class DetailTableController {
this.search = search;
}
public CheckBox getGetAll() {
return getAll;
}
public void setGetAll(CheckBox getAll) {
this.getAll = getAll;
}
public TextField getTablename() {
return tablename;
}
@ -107,4 +99,12 @@ public class DetailTableController {
public void setHtml(CheckBox html) {
this.html = html;
}
public CheckBox getSys() {
return sys;
}
public void setSys(CheckBox sys) {
this.sys = sys;
}
}

@ -5,7 +5,6 @@ import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.TableView;
import javafx.scene.control.TreeView;
import javafx.scene.layout.Pane;
@ -22,7 +21,7 @@ import xyz.wbsite.dbtool.javafx.tool.Dialog;
import java.io.File;
public class MainController {
private ProjectManager dBmanger = ManagerFactory.getdBManager();
private ProjectManager dBmanger = ManagerFactory.getProjectManager();
@FXML
private TreeView dbtree;
@ -34,8 +33,6 @@ public class MainController {
private Button add;
@FXML
private Button sub;
@FXML
private CheckBox addSysFields;
private JavaFxApplication main;
@ -67,14 +64,6 @@ public class MainController {
return sub;
}
public CheckBox getAddSysFields() {
return addSysFields;
}
public void setAddSysFields(CheckBox addSysFields) {
this.addSysFields = addSysFields;
}
public void setSub(Button sub) {
this.sub = sub;
}

@ -54,8 +54,6 @@ public class OptionApiController {
@FXML
private CheckBox get;
@FXML
private CheckBox getAll;
@FXML
private TableView apis;
@FXML
private List<Api> data = new ArrayList<>();
@ -178,14 +176,6 @@ public class OptionApiController {
return apis;
}
public CheckBox getGetAll() {
return getAll;
}
public void setGetAll(CheckBox getAll) {
this.getAll = getAll;
}
public void setApis(TableView apis) {
this.apis = apis;
}

@ -5,17 +5,17 @@ import xyz.wbsite.dbtool.javafx.JavaFxApplication;
public class ManagerFactory {
private static XmlManager xmlManager = null;
private static ReflashManager reflashManager =null;
private static ProjectManager dBManager;
private static ProjectManager projectManager;
private static FreeMarkerManager freeMarkerManager;
static {
xmlManager = new XmlManager();
dBManager = new ProjectManager();
projectManager = new ProjectManager();
freeMarkerManager = new FreeMarkerManager();
}
public static ProjectManager getdBManager() {
return dBManager;
public static ProjectManager getProjectManager() {
return projectManager;
}
public static FreeMarkerManager getFreeMarkerManager() {

@ -3,16 +3,41 @@ package xyz.wbsite.dbtool.javafx.manger;
import org.springframework.boot.system.ApplicationHome;
import xyz.wbsite.dbtool.javafx.enums.DataBase;
import xyz.wbsite.dbtool.javafx.enums.FieldType;
import xyz.wbsite.dbtool.javafx.manger.callable.*;
import xyz.wbsite.dbtool.javafx.po.*;
import xyz.wbsite.dbtool.javafx.manger.callable.AndroidCallable;
import xyz.wbsite.dbtool.javafx.manger.callable.ApiCallable;
import xyz.wbsite.dbtool.javafx.manger.callable.SBMDBCallable;
import xyz.wbsite.dbtool.javafx.manger.callable.SpringBootCallable;
import xyz.wbsite.dbtool.javafx.manger.callable.SpringMVCCallable;
import xyz.wbsite.dbtool.javafx.manger.callable.VueCallable;
import xyz.wbsite.dbtool.javafx.po.AbstractDBmapper;
import xyz.wbsite.dbtool.javafx.po.AndroidOption;
import xyz.wbsite.dbtool.javafx.po.Api;
import xyz.wbsite.dbtool.javafx.po.Field;
import xyz.wbsite.dbtool.javafx.po.Module;
import xyz.wbsite.dbtool.javafx.po.MySQLDBmapper;
import xyz.wbsite.dbtool.javafx.po.OracleDBmapper;
import xyz.wbsite.dbtool.javafx.po.Project;
import xyz.wbsite.dbtool.javafx.po.SBMDBOption;
import xyz.wbsite.dbtool.javafx.po.SQLiteDBmapper;
import xyz.wbsite.dbtool.javafx.po.Table;
import xyz.wbsite.dbtool.javafx.po.VueOption;
import xyz.wbsite.dbtool.javafx.tool.Dialog;
import java.io.File;
import java.io.FilenameFilter;
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class ProjectManager {
@ -101,14 +126,94 @@ public class ProjectManager {
table.setFind(true);
table.setGet(true);
table.setSearch(false);
table.setGetAll(false);
table.setSys(md.isHasSysFields());//获取是否默认添加系统字段
checkSysFields(table);// 检查或移除系统字段
md.putTable(table);
return table;
}
} while (true);
}
public void checkSysFields(Table table) {
if (table != null) {
if (table.getSys()) {
removeSysFields(table);
insertSysFields(table);
} else {
removeSysFields(table);
}
}
}
private void removeSysFields(Table table) {
Iterator<Field> iterator = table.getFields().iterator();
while (iterator.hasNext()) {
Field next = iterator.next();
if (next.getIsSystem()) {
iterator.remove();
}
}
}
private void insertSysFields(Table table) {
Field id = new Field("ID");
id.setIsSystem(true);
id.setIsMust(true);
id.setIsPrimaryKey(true);
id.setFieldType(FieldType.Long);
id.setFieldLength(19);
id.setFieldComment("主键");
Field row_version = new Field("ROW_VERSION");
row_version.setIsSystem(true);
row_version.setIsMust(true);
row_version.setFieldType(FieldType.Long);
row_version.setFieldLength(19);
row_version.setFieldComment("行版本");
Field is_deleted = new Field("IS_DELETED");
is_deleted.setIsSystem(true);
is_deleted.setIsMust(true);
is_deleted.setDefaultValue("0");
is_deleted.setFieldType(FieldType.Boolean);
is_deleted.setFieldLength(1);
is_deleted.setFieldComment("是否已删除");
Field created_by = new Field("CREATE_BY");
created_by.setIsSystem(true);
created_by.setIsMust(true);
created_by.setFieldType(FieldType.Long);
created_by.setFieldLength(19);
created_by.setFieldComment("创建用户");
Field creation_time = new Field("CREATE_TIME");
creation_time.setIsSystem(true);
creation_time.setIsMust(true);
creation_time.setDefaultValue("NULL");
creation_time.setFieldType(FieldType.Date);
creation_time.setFieldComment("创建时间");
Field last_updated_by = new Field("LAST_UPDATE_BY");
last_updated_by.setIsSystem(true);
creation_time.setDefaultValue("NULL");
last_updated_by.setFieldType(FieldType.Long);
last_updated_by.setFieldLength(19);
last_updated_by.setFieldComment("最后更新用户");
Field last_update_time = new Field("LAST_UPDATE_TIME");
last_update_time.setIsSystem(true);
last_update_time.setFieldType(FieldType.Date);
last_update_time.setFieldComment("最后更新时间");
table.putFirstField(id);
table.putField(row_version);
table.putField(is_deleted);
table.putField(created_by);
table.putField(creation_time);
table.putField(last_updated_by);
table.putField(last_update_time);
}
public String getNewModuleName() {
String base = "example";
String name = base;
@ -445,7 +550,6 @@ public class ProjectManager {
table.setUpdate(true);
table.setFind(true);
table.setGet(false);
table.setGetAll(false);
table.setSearch(false);
md.putTable(table);
}
@ -485,7 +589,7 @@ public class ProjectManager {
}
}
ManagerFactory.getdBManager().project.putModule(md);
ManagerFactory.getProjectManager().project.putModule(md);
isUpdate = true;
return true;
} catch (Exception e) {
@ -520,7 +624,6 @@ public class ProjectManager {
table.setUpdate(true);
table.setFind(true);
table.setGet(false);
table.setGetAll(false);
table.setSearch(false);
md.putTable(table);
}
@ -564,7 +667,7 @@ public class ProjectManager {
}
}
ManagerFactory.getdBManager().project.putModule(md);
ManagerFactory.getProjectManager().project.putModule(md);
isUpdate = true;
return true;
} catch (ClassNotFoundException e) {

@ -59,6 +59,11 @@ public class XmlManager {
project.setProjectAuthor(projectAuthor.item(0).getTextContent());
}
NodeList multiDB = dbElement.getElementsByTagName("multiDB");
if (multiDB.getLength() == 1) {
project.setMultiDB(getBoolean(multiDB.item(0).getTextContent()));
}
NodeList modules = dbElement.getElementsByTagName("module");
if (modules.getLength() > 0) {
@ -83,7 +88,7 @@ public class XmlManager {
NodeList hasSysFields = moduleElement.getElementsByTagName("hasSysFields");
if (hasSysFields.getLength() == 1) {
module.setHasSysFields(Boolean.parseBoolean(hasSysFields.item(0).getTextContent()));
module.setHasSysFields(getBoolean(hasSysFields.item(0).getTextContent()));
}
NodeList tables = moduleElement.getElementsByTagName("table");
@ -94,14 +99,14 @@ public class XmlManager {
table.setdBhandle(module);
table.setTableName(tableElement.getAttribute("tableName"));
table.setTableComment(tableElement.getAttribute("tableComment"));
table.setCreate(Boolean.parseBoolean(tableElement.getAttribute("create")));
table.setDelete(Boolean.parseBoolean(tableElement.getAttribute("delete")));
table.setUpdate(Boolean.parseBoolean(tableElement.getAttribute("update")));
table.setFind(Boolean.parseBoolean(tableElement.getAttribute("find")));
table.setGet(Boolean.parseBoolean(tableElement.getAttribute("get")));
table.setSearch(Boolean.parseBoolean(tableElement.getAttribute("search")));
table.setGetAll(Boolean.parseBoolean(tableElement.getAttribute("getAll")));
table.setHtml(Boolean.parseBoolean(tableElement.getAttribute("html")));
table.setCreate(getBoolean(tableElement.getAttribute("create")));
table.setDelete(getBoolean(tableElement.getAttribute("delete")));
table.setUpdate(getBoolean(tableElement.getAttribute("update")));
table.setFind(getBoolean(tableElement.getAttribute("find")));
table.setGet(getBoolean(tableElement.getAttribute("get")));
table.setSearch(getBoolean(tableElement.getAttribute("search")));
table.setHtml(getBoolean(tableElement.getAttribute("html")));
table.setSys(getBoolean(tableElement.getAttribute("sys")));
NodeList fields = tableElement.getElementsByTagName("field");
@ -114,11 +119,11 @@ public class XmlManager {
field.setFieldLength(Integer.parseInt(fieldElement.getAttribute("fieldLength")));
field.setFieldComment(fieldElement.getAttribute("fieldComment"));
field.setDefaultValue(fieldElement.getAttribute("defaultValue"));
field.setIsSystem(Boolean.parseBoolean(fieldElement.getAttribute("IsSystem")));
field.setIsMust(Boolean.parseBoolean(fieldElement.getAttribute("isMust")));
field.setIsPrimaryKey(Boolean.parseBoolean(fieldElement.getAttribute("isPrimaryKey")));
field.setIsQuery(Boolean.parseBoolean(fieldElement.getAttribute("isQuery")));
field.setIsSearch(Boolean.parseBoolean(fieldElement.getAttribute("isSearch")));
field.setIsSystem(getBoolean(fieldElement.getAttribute("IsSystem")));
field.setIsMust(getBoolean(fieldElement.getAttribute("isMust")));
field.setIsPrimaryKey(getBoolean(fieldElement.getAttribute("isPrimaryKey")));
field.setIsQuery(getBoolean(fieldElement.getAttribute("isQuery")));
field.setIsSearch(getBoolean(fieldElement.getAttribute("isSearch")));
table.putField(field);
}
}
@ -164,9 +169,12 @@ public class XmlManager {
projectBasePackage.setTextContent(project.getProjectBasePackage());
Element projectAuthor = doc.createElement("projectAuthor");
projectAuthor.setTextContent(project.getProjectAuthor());
Element multiDB = doc.createElement("multiDB");
multiDB.setTextContent(String.valueOf(project.getMultiDB()));
rootProject.appendChild(projectName);
rootProject.appendChild(projectBasePackage);
rootProject.appendChild(projectAuthor);
rootProject.appendChild(multiDB);
Element modules = doc.createElement("modules");
rootProject.appendChild(modules);
@ -200,8 +208,8 @@ public class XmlManager {
table.setAttribute("find", Boolean.toString(t.getFind()));
table.setAttribute("get", Boolean.toString(t.getGet()));
table.setAttribute("search", Boolean.toString(t.getSearch()));
table.setAttribute("getAll", Boolean.toString(t.getGetAll()));
table.setAttribute("html", Boolean.toString(t.getHtml()));
table.setAttribute("sys", Boolean.toString(t.getSys()));
Element fields = doc.createElement("fields");
@ -249,7 +257,7 @@ public class XmlManager {
if (!path.exists()) {
path.mkdirs();
}
File file = new File(path, project.getProjectName() + ".xml");
File file = new File(path, project.getProjectName() + ".xml");
if (!file.exists()) {
file.createNewFile();
}
@ -275,4 +283,11 @@ public class XmlManager {
}
return true;
}
private boolean getBoolean(String str) {
if (str != null && str.matches("true|1")) {
return true;
}
return false;
}
}

@ -250,6 +250,10 @@ public class SpringBootCallable implements Callable {
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "TaskConfig.java"), option + "/java/config/TaskConfig.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "ThreadPoolConfig.java"), option + "/java/config/ThreadPoolConfig.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "WebMvcConfig.java"), option + "/java/config/WebMvcConfig.java", ctx);
if (project.getMultiDB()){
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "MapperMainConfig.java"), option + "/java/config/MapperMainConfig.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "MapperTwoConfig.java"), option + "/java/config/MapperTwoConfig.java", ctx);
}
}
/**
@ -305,7 +309,7 @@ public class SpringBootCallable implements Callable {
ctx.put("table", table);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "Mapper" + ".java"), option + "/java/module/mpr/mapperJava.ftl", ctx);
if (md.isHasSysFields()) {
if (table.getSys()) {
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "Mapper" + ".xml"), option + "/java/module/mpr/mapper.ftl", ctx);
} else {
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "Mapper" + ".xml"), option + "/java/module/mpr/mapper_nosys.ftl", ctx);
@ -391,9 +395,6 @@ public class SpringBootCallable implements Callable {
if (table.getSearch()) {
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "SearchRequest" + ".java"), option + "/java/module/req/searchRequestClass.ftl", ctx);
}
if (table.getGetAll()) {
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "GetAllRequest" + ".java"), option + "/java/module/req/getAllRequestClass.ftl", ctx);
}
}
}
@ -448,9 +449,6 @@ public class SpringBootCallable implements Callable {
if (table.getSearch()) {
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "SearchResponse" + ".java"), option + "/java/module/rsp/searchResponseClass.ftl", ctx);
}
if (table.getGetAll()) {
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), Tool.lineToClassName(table.getTableName()) + "GetAllResponse" + ".java"), option + "/java/module/rsp/getAllResponseClass.ftl", ctx);
}
}
}
@ -560,7 +558,6 @@ public class SpringBootCallable implements Callable {
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseEntity.java"), option + "/java/frame/base/BaseEntity.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseFindRequest.java"), option + "/java/frame/base/BaseFindRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseFindResponse.java"), option + "/java/frame/base/BaseFindResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseGetAllRequest.java"), option + "/java/frame/base/BaseGetAllRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseRequest.java"), option + "/java/frame/base/BaseRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseResponse.java"), option + "/java/frame/base/BaseResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseSearchRequest.java"), option + "/java/frame/base/BaseSearchRequest.java", ctx);
@ -645,6 +642,7 @@ public class SpringBootCallable implements Callable {
HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put("basePackage", project.getProjectBasePackage());
ctx.put("moduleName", project.getProjectName());
ctx.put("multiDB", project.getMultiDB());
ctx.put("timestamp", new Date().getTime());
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "Application.java"), option + "/java/Application.ftl", ctx);
@ -667,6 +665,7 @@ public class SpringBootCallable implements Callable {
ctx.put("date", new Date());
ctx.put("author", project.getProjectAuthor());
ctx.put("projectName", project.getProjectName());
ctx.put("multiDB", project.getMultiDB());
ctx.put("cloud", cloud);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "start-dev.bat"), option + "/resources/start-dev.bat", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "start-prod.bat"), option + "/resources/start-prod.bat", ctx);
@ -748,8 +747,9 @@ public class SpringBootCallable implements Callable {
ctx.put("author", project.getProjectAuthor());
ctx.put("dBmapper", dBmapper);
ctx.put("date", new Date());
ctx.put("multiDB", project.getMultiDB());
ctx.put("cloud", cloud);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "application.properties"), option + "/test/application.properties", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "application.properties"), option + "/test/application.ftl", ctx);
Tool.outputResource(option + "/test/logback-spring.xml", Tool.createFile(root.getAbsolutePath(), "logback-spring.xml"));
}

@ -348,7 +348,6 @@ public class SpringMVCCallable implements Callable {
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + Tool.lineToClassName(table.getTableName()) + "UpdateRequest" + ".java"), option + "/java/req/updateRequestClass.ftl", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + Tool.lineToClassName(table.getTableName()) + "FindRequest" + ".java"), option + "/java/req/findRequestClass.ftl", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + Tool.lineToClassName(table.getTableName()) + "SearchRequest" + ".java"), option + "/java/req/searchRequestClass.ftl", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + Tool.lineToClassName(table.getTableName()) + "GetAllRequest" + ".java"), option + "/java/req/GetAllRequestClass.ftl", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + Tool.lineToClassName(table.getTableName()) + "GetRequest" + ".java"), option + "/java/req/getRequestClass.ftl", ctx);
}
} catch (Exception e) {
@ -384,7 +383,6 @@ public class SpringMVCCallable implements Callable {
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + Tool.lineToClassName(table.getTableName()) + "UpdateResponse" + ".java"), option + "/java/rsp/updateResponseClass.ftl", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + Tool.lineToClassName(table.getTableName()) + "FindResponse" + ".java"), option + "/java/rsp/findResponseClass.ftl", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + Tool.lineToClassName(table.getTableName()) + "SearchResponse" + ".java"), option + "/java/rsp/searchResponseClass.ftl", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + Tool.lineToClassName(table.getTableName()) + "GetAllResponse" + ".java"), option + "/java/rsp/GetAllResponseClass.ftl", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + Tool.lineToClassName(table.getTableName()) + "GetResponse" + ".java"), option + "/java/rsp/getResponseClass.ftl", ctx);
}
} catch (Exception e) {
@ -422,7 +420,6 @@ public class SpringMVCCallable implements Callable {
freeMarkerManager.outputTemp(new File(base.getAbsolutePath() + File.separator + "BaseEntity.java"), option + "/java/frame/base/BaseEntity.java", ctx);
freeMarkerManager.outputTemp(new File(base.getAbsolutePath() + File.separator + "BaseFindRequest.java"), option + "/java/frame/base/BaseFindRequest.java", ctx);
freeMarkerManager.outputTemp(new File(base.getAbsolutePath() + File.separator + "BaseFindResponse.java"), option + "/java/frame/base/BaseFindResponse.java", ctx);
freeMarkerManager.outputTemp(new File(base.getAbsolutePath() + File.separator + "BaseGetAllRequest.java"), option + "/java/frame/base/BaseGetAllRequest.java", ctx);
freeMarkerManager.outputTemp(new File(base.getAbsolutePath() + File.separator + "BaseRequest.java"), option + "/java/frame/base/BaseRequest.java", ctx);
freeMarkerManager.outputTemp(new File(base.getAbsolutePath() + File.separator + "BaseResponse.java"), option + "/java/frame/base/BaseResponse.java", ctx);
freeMarkerManager.outputTemp(new File(base.getAbsolutePath() + File.separator + "BaseSearchRequest.java"), option + "/java/frame/base/BaseSearchRequest.java", ctx);

@ -31,7 +31,7 @@ public class Module extends TreeItem {
private List<Table> tables = new ArrayList();
private String moduleName;
private boolean hasSysFields;
private boolean hasSysFields = true;
private String projectName;
private String projectBasePackage;
private String projectAuthor;

@ -11,6 +11,7 @@ public class Project extends TreeItem{
this.projectName = "EXAMPLE-WEB";
this.projectBasePackage = "com.example";
this.projectAuthor = "author";
this.multiDB = false;
}
public Project(String projectName) {
@ -22,6 +23,7 @@ public class Project extends TreeItem{
private String projectName;
private String projectBasePackage;
private String projectAuthor;
private boolean multiDB;
/**
*
@ -66,4 +68,12 @@ public class Project extends TreeItem{
public void setModules(List<Module> modules) {
this.modules = modules;
}
public boolean getMultiDB() {
return multiDB;
}
public void setMultiDB(boolean multiDB) {
this.multiDB = multiDB;
}
}

@ -1,6 +1,8 @@
package xyz.wbsite.dbtool.javafx.po;
import javafx.scene.control.TreeItem;
import xyz.wbsite.dbtool.javafx.manger.ManagerFactory;
import xyz.wbsite.dbtool.javafx.manger.ProjectManager;
import xyz.wbsite.dbtool.javafx.tool.Tool;
import java.util.ArrayList;
@ -41,8 +43,8 @@ public class Table extends TreeItem {
private boolean find = true;
private boolean get = true;
private boolean search = false;
private boolean getAll = false;
private boolean html = false;
private boolean sys = true;
/**
*
@ -179,14 +181,6 @@ public class Table extends TreeItem {
this.search = search;
}
public boolean getGetAll() {
return getAll;
}
public void setGetAll(boolean getAll) {
this.getAll = getAll;
}
public boolean getHtml() {
return html;
}
@ -194,4 +188,14 @@ public class Table extends TreeItem {
public void setHtml(boolean html) {
this.html = html;
}
public boolean getSys() {
return sys;
}
public void setSys(boolean sys) {
this.sys = sys;
ProjectManager projectManager = ManagerFactory.getProjectManager();
if (projectManager != null) projectManager.checkSysFields(this);
}
}

@ -327,7 +327,7 @@ public class Dialog {
return;
}
for (Module db : ManagerFactory.getdBManager().getMds()) {
for (Module db : ManagerFactory.getProjectManager().getMds()) {
if (db.getModuleName().equals(userName)) {
Dialog.showConfirmDialog("已经存的模块!");
return;
@ -477,12 +477,6 @@ public class Dialog {
check(controller, controller.getGet().isSelected(), ".get");
}
});
controller.getGetAll().setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
check(controller, controller.getGetAll().isSelected(), ".get.all");
}
});
apiPath.requestFocus();
modulePath.textProperty().addListener(new ChangeListener<String>() {
@ -492,7 +486,7 @@ public class Dialog {
}
});
ProjectManager dBmanger = ManagerFactory.getdBManager();
ProjectManager dBmanger = ManagerFactory.getProjectManager();
File file = dBmanger.getPath();
File[] files = file.listFiles();
@ -567,7 +561,7 @@ public class Dialog {
controller.getOk().setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
ProjectManager dBmanger = ManagerFactory.getdBManager();
ProjectManager dBmanger = ManagerFactory.getProjectManager();
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setInitialDirectory(dBmanger.getPath());
Stage stage = new Stage();
@ -607,7 +601,7 @@ public class Dialog {
}
public static void showSBMDB() {
ProjectManager dBmanger = ManagerFactory.getdBManager();
ProjectManager dBmanger = ManagerFactory.getProjectManager();
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setInitialDirectory(dBmanger.getPath());
Stage stage = new Stage();
@ -645,7 +639,7 @@ public class Dialog {
controller.getOk().setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
ProjectManager dBmanger = ManagerFactory.getdBManager();
ProjectManager dBmanger = ManagerFactory.getProjectManager();
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setInitialDirectory(dBmanger.getPath());
Stage stage = new Stage();

@ -86,10 +86,6 @@ public class RequestReader {
hasList = true;
findOrSearchflag = "1";
}
if (fatherName.contains("BaseGetAllRequest")) {
hasList = true;
findOrSearchflag = "2";
}
}
continue;
}

@ -81,9 +81,6 @@ public class Tool {
* @return
*/
public static String getRequestTarget(String requestName) {
if (requestName.contains("GetAllRequest")) {
return Abb2abb(requestName.substring(0, requestName.indexOf("GetAllRequest")));
}
if (requestName.startsWith("Api")) {
return "api";
}
@ -109,9 +106,6 @@ public class Tool {
public static String getRequestAction(String requestName) {
String s = camelToPoint(requestName);
if (requestName.contains("GetAllRequest")) {
return "getAll";
}
if (requestName.startsWith("Api")) {
return Abb2abb(requestName.substring(3, requestName.indexOf("Request")));
}

@ -7,9 +7,11 @@ package xyz.wbsite.dbtool.web.frame.base;
* @version 0.0.1
* @since 2017-01-01
*/
public class BaseFindRequest extends BaseGetAllRequest {
public class BaseFindRequest extends BaseRequest {
private int pageNumber = 1;
private int pageSize = 10;
private String sortKey;
private SortType sortType;
public int getPageNumber() {
return pageNumber;
@ -26,4 +28,20 @@ public class BaseFindRequest extends BaseGetAllRequest {
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public String getSortKey() {
return sortKey;
}
public void setSortKey(String sortKey) {
this.sortKey = sortKey;
}
public SortType getSortType() {
return sortType;
}
public void setSortType(SortType sortType) {
this.sortType = sortType;
}
}

@ -1,32 +0,0 @@
package xyz.wbsite.dbtool.web.frame.base;
/**
* BaseFindRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
*/
public class BaseGetAllRequest extends BaseRequest {
private String sortKey;
private SortType sortType;
public String getSortKey() {
return sortKey;
}
public void setSortKey(String sortKey) {
this.sortKey = sortKey;
}
public SortType getSortType() {
return sortType;
}
public void setSortType(SortType sortType) {
this.sortType = sortType;
}
}

@ -75,18 +75,10 @@
<items>
<Button mnemonicParsing="false" text=" + " fx:id="add"/>
<Button mnemonicParsing="false" text=" - " fx:id="sub"/>
<CheckBox mnemonicParsing="false" fx:id="addSysFields" text="添加系统字段"
selected="false">
<HBox.margin>
<Insets left="30.0"/>
</HBox.margin>
</CheckBox>
</items>
</ToolBar>
</top>
</BorderPane>
</items>
</SplitPane>
</items>

@ -1,17 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.*?>
<GridPane fx:controller="xyz.wbsite.dbtool.javafx.ctrl.DetailProjectController" maxHeight="-Infinity" maxWidth="-Infinity"
<GridPane fx:controller="xyz.wbsite.dbtool.javafx.ctrl.DetailProjectController" maxHeight="-Infinity"
maxWidth="-Infinity"
minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.65"
xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" prefWidth="10.0" />
<ColumnConstraints hgrow="SOMETIMES" prefWidth="60.0" />
<ColumnConstraints hgrow="SOMETIMES" prefWidth="160.0" />
<ColumnConstraints hgrow="SOMETIMES" prefWidth="10.0" />
<ColumnConstraints hgrow="SOMETIMES" prefWidth="60.0" />
<ColumnConstraints hgrow="SOMETIMES" prefWidth="160.0" />
<ColumnConstraints hgrow="SOMETIMES" prefWidth="10.0"/>
<ColumnConstraints hgrow="SOMETIMES" prefWidth="60.0"/>
<ColumnConstraints hgrow="SOMETIMES" prefWidth="160.0"/>
<ColumnConstraints hgrow="SOMETIMES" prefWidth="10.0"/>
<ColumnConstraints hgrow="SOMETIMES" prefWidth="60.0"/>
<ColumnConstraints hgrow="SOMETIMES" prefWidth="160.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
@ -21,21 +24,37 @@
</rowConstraints>
<children>
<!-- ROW -->
<Label GridPane.rowIndex="0" GridPane.columnIndex="0" text="*" alignment="CENTER" textAlignment="CENTER" textFill="RED" GridPane.halignment="CENTER" GridPane.valignment="CENTER"/>
<Label GridPane.rowIndex="0" GridPane.columnIndex="1" text="项目名称" GridPane.halignment="CENTER" GridPane.valignment="CENTER"/>
<Label GridPane.rowIndex="0" GridPane.columnIndex="0" text="*" alignment="CENTER" textAlignment="CENTER"
textFill="RED" GridPane.halignment="CENTER" GridPane.valignment="CENTER"/>
<Label GridPane.rowIndex="0" GridPane.columnIndex="1" text="项目名称" GridPane.halignment="CENTER"
GridPane.valignment="CENTER"/>
<TextField GridPane.rowIndex="0" GridPane.columnIndex="2" fx:id="projectName"/>
<Label GridPane.rowIndex="0" GridPane.columnIndex="3" text="*" alignment="CENTER" textAlignment="CENTER" textFill="RED" GridPane.halignment="CENTER" GridPane.valignment="CENTER"/>
<Label GridPane.rowIndex="0" GridPane.columnIndex="4" text="作者" GridPane.halignment="CENTER" GridPane.valignment="CENTER"/>
<Label GridPane.rowIndex="0" GridPane.columnIndex="3" text="*" alignment="CENTER" textAlignment="CENTER"
textFill="RED" GridPane.halignment="CENTER" GridPane.valignment="CENTER"/>
<Label GridPane.rowIndex="0" GridPane.columnIndex="4" text="作者" GridPane.halignment="CENTER"
GridPane.valignment="CENTER"/>
<TextField GridPane.rowIndex="0" GridPane.columnIndex="5" fx:id="projectAuthor"/>
<!-- ROW -->
<!-- ROW -->
<Label GridPane.rowIndex="1" GridPane.columnIndex="0" text="*" alignment="CENTER" textAlignment="CENTER" textFill="RED" GridPane.halignment="CENTER" GridPane.valignment="CENTER"/>
<Label GridPane.rowIndex="1" GridPane.columnIndex="1" text="域名" GridPane.halignment="CENTER" GridPane.valignment="CENTER"/>
<Label GridPane.rowIndex="1" GridPane.columnIndex="0" text="*" alignment="CENTER" textAlignment="CENTER"
textFill="RED" GridPane.halignment="CENTER" GridPane.valignment="CENTER"/>
<Label GridPane.rowIndex="1" GridPane.columnIndex="1" text="域名" GridPane.halignment="CENTER"
GridPane.valignment="CENTER"/>
<TextField GridPane.rowIndex="1" GridPane.columnIndex="2" fx:id="projectBasePackage"/>
<!-- ROW -->
<Label GridPane.rowIndex="2" GridPane.columnIndex="1" text="其他配置" GridPane.halignment="CENTER"
GridPane.valignment="CENTER"/>
<HBox GridPane.rowIndex="2" GridPane.columnIndex="2" GridPane.columnSpan="2" alignment="CENTER_LEFT"
GridPane.halignment="CENTER"
GridPane.valignment="CENTER">
<children>
<CheckBox fx:id="multiDB" GridPane.rowIndex="4" GridPane.columnIndex="2" text="多数据库"/>
</children>
</HBox>
</children>
</GridPane>

@ -1,43 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="xyz.wbsite.dbtool.javafx.ctrl.DetailTableController">
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="xyz.wbsite.dbtool.javafx.ctrl.DetailTableController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" prefWidth="10.0" />
<ColumnConstraints hgrow="SOMETIMES" prefWidth="60.0" />
<ColumnConstraints hgrow="SOMETIMES" prefWidth="400.0" />
<ColumnConstraints hgrow="SOMETIMES" prefWidth="10.0"/>
<ColumnConstraints hgrow="SOMETIMES" prefWidth="60.0"/>
<ColumnConstraints hgrow="SOMETIMES" prefWidth="400.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<Label GridPane.rowIndex="0" GridPane.columnIndex="0" text="*" alignment="CENTER" textAlignment="CENTER" textFill="RED" GridPane.halignment="CENTER" GridPane.valignment="CENTER"/>
<Label GridPane.rowIndex="0" GridPane.columnIndex="1" text="对象名称" GridPane.halignment="CENTER" GridPane.valignment="CENTER" />
<TextField GridPane.rowIndex="0" GridPane.columnIndex="2" fx:id="tablename" />
<Label GridPane.rowIndex="0" GridPane.columnIndex="0" text="*" alignment="CENTER" textAlignment="CENTER"
textFill="RED" GridPane.halignment="CENTER" GridPane.valignment="CENTER"/>
<Label GridPane.rowIndex="0" GridPane.columnIndex="1" text="对象名称" GridPane.halignment="CENTER"
GridPane.valignment="CENTER"/>
<TextField GridPane.rowIndex="0" GridPane.columnIndex="2" fx:id="tablename"/>
<Label GridPane.rowIndex="1" GridPane.columnIndex="0" text="*" alignment="CENTER" textAlignment="CENTER" textFill="RED" GridPane.halignment="CENTER" GridPane.valignment="CENTER"/>
<Label GridPane.rowIndex="1" GridPane.columnIndex="1" text="对象注释" GridPane.halignment="CENTER" GridPane.valignment="CENTER" />
<Label GridPane.rowIndex="1" GridPane.columnIndex="0" text="*" alignment="CENTER" textAlignment="CENTER"
textFill="RED" GridPane.halignment="CENTER" GridPane.valignment="CENTER"/>
<Label GridPane.rowIndex="1" GridPane.columnIndex="1" text="对象注释" GridPane.halignment="CENTER"
GridPane.valignment="CENTER"/>
<TextField GridPane.rowIndex="1" GridPane.columnIndex="2" fx:id="tablecomment"/>
<Label GridPane.rowIndex="2" GridPane.columnIndex="1" text="基本方法" GridPane.halignment="CENTER" GridPane.valignment="CENTER" />
<HBox GridPane.rowIndex="2" GridPane.columnIndex="2" alignment="CENTER_LEFT" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<Label GridPane.rowIndex="2" GridPane.columnIndex="1" text="基本方法" GridPane.halignment="CENTER"
GridPane.valignment="CENTER"/>
<HBox GridPane.rowIndex="2" GridPane.columnIndex="2" alignment="CENTER_LEFT" GridPane.halignment="CENTER"
GridPane.valignment="CENTER">
<children>
<CheckBox fx:id="create" mnemonicParsing="false" text="create" />
<CheckBox fx:id="delete" mnemonicParsing="false" text="delete" />
<CheckBox fx:id="update" mnemonicParsing="false" text="update" />
<CheckBox fx:id="find" mnemonicParsing="false" text="find" />
<CheckBox fx:id="get" mnemonicParsing="false" text="get" />
<CheckBox fx:id="search" mnemonicParsing="false" text="search" />
<CheckBox fx:id="getAll" mnemonicParsing="false" text="getAll" />
<CheckBox fx:id="create" mnemonicParsing="false" text="create"/>
<CheckBox fx:id="delete" mnemonicParsing="false" text="delete"/>
<CheckBox fx:id="update" mnemonicParsing="false" text="update"/>
<CheckBox fx:id="find" mnemonicParsing="false" text="find"/>
<CheckBox fx:id="get" mnemonicParsing="false" text="get"/>
<CheckBox fx:id="search" mnemonicParsing="false" text="search"/>
</children>
</HBox>
<Label GridPane.rowIndex="3" GridPane.columnIndex="1" text="其他配置" GridPane.halignment="CENTER" GridPane.valignment="CENTER" />
<CheckBox fx:id="html" selected="false" GridPane.rowIndex="3" GridPane.columnIndex="2" text="HTML模板" />
</children>
<Label GridPane.rowIndex="3" GridPane.columnIndex="1" text="其他配置" GridPane.halignment="CENTER"
GridPane.valignment="CENTER"/>
<HBox GridPane.rowIndex="3" GridPane.columnIndex="2" alignment="CENTER_LEFT" GridPane.halignment="CENTER"
GridPane.valignment="CENTER">
<children>
<CheckBox fx:id="sys" selected="true" GridPane.rowIndex="4" GridPane.columnIndex="2" text="系统字段"/>
<CheckBox fx:id="html" selected="false" GridPane.rowIndex="3" GridPane.columnIndex="2" text="HTML模板"/>
</children>
</HBox>
</children>
</GridPane>

@ -3,11 +3,18 @@ package ${basePackage};
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
<#if multiDB>
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
</#if>
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@SpringBootApplication
<#if multiDB>
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
<#else>
@EnableAutoConfiguration
</#if>
public class Application extends SpringBootServletInitializer {
@Override

@ -97,12 +97,6 @@ public class AjaxController {
baseResponse = search${table.getCName()}(jsonString, token);
break;
</#if>
<#if table.getGetAll()>
// 查询所有${table.tableComment}
case "ajax.${m.moduleName}.${table.getLName()}.get.all":
baseResponse = getAll${table.getCName()}(jsonString, token);
break;
</#if>
</#list>
</#list>
default:
@ -183,16 +177,6 @@ public class AjaxController {
return ${table.getFName()}Manager.search(request, token);
}
</#if>
<#if table.getGetAll()>
/**
* ${table.tableComment}
*/
private BaseResponse getAll${table.getCName()}(String jsonString, Token token) {
${table.getCName()}GetAllRequest request = MapperUtil.toJava(jsonString, ${table.getCName()}GetAllRequest.class);
return ${table.getFName()}Manager.getAll(request, token);
}
</#if>
</#list>
</#list>
}

@ -61,12 +61,6 @@ public class ${table.getCName()}Ajax{
return ${table.getFName()}Manager.search(request, LocalData.getToken());
}
</#if>
<#if table.getGetAll()>
public ${table.getCName()}GetAllResponse getAll(${table.getCName()}GetAllRequest request) {
return ${table.getFName()}Manager.getAll(request, LocalData.getToken());
}
</#if>
<#if table.getHtml()>
public Object template(){

@ -46,10 +46,4 @@ public class ${table.getCName()}Api{
return ${table.getFName()}Manager.search(request, LocalData.getToken());
}
</#if>
<#if table.getGetAll()>
public ${table.getCName()}GetAllResponse getAll(${table.getCName()}GetAllRequest request) {
return ${table.getFName()}Manager.getAll(request, LocalData.getToken());
}
</#if>
}

@ -0,0 +1,41 @@
package com.example.config;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
@Configuration
@MapperScan(basePackages = {"com.example.*.mainMpr"}, sqlSessionFactoryRef = "mainSqlSessionFactory")
public class MapperMainConfig {
@Bean(name = "mainDataSource")
@Primary
@ConfigurationProperties(prefix = "spring.datasource.main")
public DataSource dataSource() {
return DataSourceBuilder.create().build();
}
@Primary
@Bean(name = "mainTransactionManager")
public DataSourceTransactionManager transactionManager(@Qualifier("mainDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Primary
@Bean(name = "mainSqlSessionFactory")
public SqlSessionFactory basicSqlSessionFactory(@Qualifier("mainDataSource") DataSource basicDataSource) throws Exception {
SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
factoryBean.setDataSource(basicDataSource);
factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:com/example/**/mainMpr/*.xml"));
return factoryBean.getObject();
}
}

@ -0,0 +1,37 @@
package com.example.config;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
@Configuration
@MapperScan(basePackages = {"com.example.*.twoMpr"}, sqlSessionFactoryRef = "twoSqlSessionFactory")
public class MapperTwoConfig {
@Bean(name = "TwoDataSource")
@ConfigurationProperties(prefix = "spring.datasource.two")
public DataSource dataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "twoTransactionManager")
public DataSourceTransactionManager transactionManager(@Qualifier("twoDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean(name = "twoSqlSessionFactory")
public SqlSessionFactory basicSqlSessionFactory(@Qualifier("twoDataSource") DataSource basicDataSource) throws Exception {
SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
factoryBean.setDataSource(basicDataSource);
factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:com/example/**/twoMpr/*.xml"));
return factoryBean.getObject();
}
}

@ -7,10 +7,16 @@ package ${basePackage}.frame.base;
* @version 0.0.1
* @since 2017-01-01
*/
public class BaseFindRequest extends BaseGetAllRequest {
public class BaseFindRequest extends BaseRequest {
private int pageNumber = 1;
private int pageSize = 10;
private String sortKey;
private SortType sortType;
public int getPageNumber() {
return pageNumber;
}
@ -26,4 +32,21 @@ public class BaseFindRequest extends BaseGetAllRequest {
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public String getSortKey() {
return sortKey;
}
public void setSortKey(String sortKey) {
this.sortKey = sortKey;
}
public SortType getSortType() {
return sortType;
}
public void setSortType(SortType sortType) {
this.sortType = sortType;
}
}

@ -1,32 +0,0 @@
package ${basePackage}.frame.base;
/**
* BaseFindRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
*/
public class BaseGetAllRequest extends BaseRequest {
private String sortKey;
private SortType sortType;
public String getSortKey() {
return sortKey;
}
public void setSortKey(String sortKey) {
this.sortKey = sortKey;
}
public SortType getSortType() {
return sortType;
}
public void setSortType(SortType sortType) {
this.sortType = sortType;
}
}

@ -78,15 +78,4 @@ public interface ${table.getCName()}Manager {
*/
${table.getCName()}SearchResponse search(${table.getCName()}SearchRequest request, Token token);
</#if>
<#if table.getGetAll()>
/**
* 查询所有
*
* @param request 请求对象
* @param token 令牌
* @return
*/
${table.getCName()}GetAllResponse getAll(${table.getCName()}GetAllRequest request, Token token);
</#if>
}

@ -210,34 +210,4 @@ public class ${table.getCName()}ManagerImpl implements ${table.getCName()}Manage
return response;
}
</#if>
<#if table.getGetAll()>
/**
* 查询所有
*
* @param request 请求对象
* @param token 令牌
* @return 响应
*/
@Transactional(readOnly = true)
public ${table.getCName()}GetAllResponse getAll(${table.getCName()}GetAllRequest request, Token token) {
${table.getCName()}GetAllResponse response = new ${table.getCName()}GetAllResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
PageHelper.startPage(1, 0);
if (StringUtil.isNotEmpty(request.getSortKey())) {
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
}
PageInfo<${table.getCName()}> pageInfo = new PageInfo<>(${table.getFName()}Mapper.getAll(request, token));
response.setResult(pageInfo.getList());
response.setTotalCount(pageInfo.getTotal());
return response;
}
</#if>
}

@ -344,21 +344,6 @@
</#if>
</update>
<select id="getAll" resultMap="${table.getFName()}">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
<#if dataBase == 'Oracle'>
"IS_DELETED" = 0
<#elseif dataBase='MySQL'>
`IS_DELETED` = 0
<#elseif dataBase='SQLite'>
IS_DELETED = 0
</#if>
</select>
<select id="get" resultMap="${table.getFName()}">
SELECT
<include refid="entityColumnList"/>

@ -92,15 +92,4 @@ public interface ${table.getCName()}Mapper {
*/
List<${table.getCName()}> search(@Param("request") ${table.getCName()}SearchRequest request, @Param("token") Token token);
</#if>
<#if table.getGetAll()>
/**
* 获得所有
*
* @param request 请求对象
* @param token 令牌
* @return 返回对象
*/
List<${table.getCName()}> getAll(@Param("request") ${table.getCName()}GetAllRequest request, @Param("token") Token token);
</#if>
}

@ -1,17 +0,0 @@
package ${basePackage}.module.${moduleName}.req;
import ${basePackage}.frame.base.BaseRequest;
/**
* ApiExampleRequest - Api
* <p>
* Request
* Api#Example#Request ==> ##Request
*
* @author ${author?default("")}
* @version 0.0.1
* @since ${date?string("yyyy-MM-dd")}
*/
public class ApiExampleRequest extends BaseRequest {
}

@ -1,13 +0,0 @@
package ${basePackage}.module.${moduleName}.req;
import ${basePackage}.frame.base.BaseGetAllRequest;
/**
* ${table.getCName()}GetAllRequest - ${table.tableComment}获取全部
*
* @author ${author?default("")}
* @version 0.0.1
* @since ${date?string("yyyy-MM-dd")}
*/
public class ${table.getCName()}GetAllRequest extends BaseGetAllRequest {
}

@ -1,17 +0,0 @@
package ${basePackage}.module.${moduleName}.rsp;
import ${basePackage}.frame.base.BaseResponse;
/**
* ApiExampleResponse - Api
* <p>
* Response
* Api#Example#Response ==> ##Response
*
* @author ${author?default("")}
* @version 0.0.1
* @since ${date?string("yyyy-MM-dd")}
*/
public class ApiExampleResponse extends BaseResponse {
}

@ -1,14 +0,0 @@
package ${basePackage}.module.${moduleName}.rsp;
import ${basePackage}.frame.base.BaseFindResponse;
import ${basePackage}.module.${moduleName}.ent.${table.getCName()};
/**
* ${table.getCName()}GetAllResponse - ${table.tableComment}
*
* @author ${author?default("")}
* @version 0.0.1
* @since ${date?string("yyyy-MM-dd")}
*/
public class ${table.getCName()}GetAllResponse extends BaseFindResponse<${table.getCName()}> {
}

@ -135,15 +135,6 @@
AND `ROW_VERSION` = ${r"#"}{request.rowVersion}
</update>
<select id="getAll" resultMap="dictItem">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
</select>
<select id="get" resultMap="dictItem">
SELECT
<include refid="entityColumnList"/>

@ -135,15 +135,6 @@
AND "ROW_VERSION" = ${r"#"}{request.rowVersion}
</update>
<select id="getAll" resultMap="dictItem">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
"IS_DELETED" = 0
</select>
<select id="get" resultMap="dictItem">
SELECT
<include refid="entityColumnList"/>

@ -143,15 +143,6 @@
AND ROW_VERSION = ${r"#"}{request.rowVersion}
</update>
<select id="getAll" resultMap="dictItem">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
IS_DELETED = 0
</select>
<select id="get" resultMap="dictItem">
SELECT
<include refid="entityColumnList"/>

@ -125,15 +125,6 @@
AND `ROW_VERSION` = ${r"#"}{request.rowVersion}
</update>
<select id="getAll" resultMap="dict">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
</select>
<select id="get" resultMap="dict">
SELECT
<include refid="entityColumnList"/>

@ -125,15 +125,6 @@
AND "ROW_VERSION" = ${r"#"}{request.rowVersion}
</update>
<select id="getAll" resultMap="dict">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
"IS_DELETED" = 0
</select>
<select id="get" resultMap="dict">
SELECT
<include refid="entityColumnList"/>

@ -132,15 +132,6 @@
AND ROW_VERSION = ${r"#"}{request.rowVersion}
</update>
<select id="getAll" resultMap="dict">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
IS_DELETED = 0
</select>
<select id="get" resultMap="dict">
SELECT
<include refid="entityColumnList"/>

@ -140,15 +140,6 @@
AND `ROW_VERSION` = ${r"#"}{request.rowVersion}
</update>
<select id="getAll" resultMap="file">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
</select>
<select id="get" resultMap="file">
SELECT
<include refid="entityColumnList"/>

@ -140,15 +140,6 @@
AND "ROW_VERSION" = ${r"#"}{request.rowVersion}
</update>
<select id="getAll" resultMap="file">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
"IS_DELETED" = 0
</select>
<select id="get" resultMap="file">
SELECT
<include refid="entityColumnList"/>

@ -150,15 +150,6 @@
AND ROW_VERSION = ${r"#"}{request.rowVersion}
</update>
<select id="getAll" resultMap="file">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
IS_DELETED = 0
</select>
<select id="get" resultMap="file">
SELECT
<include refid="entityColumnList"/>

@ -17,15 +17,55 @@ server.tomcat.uri-encoding=UTF-8
# 日志配置
logging.path=D://
logging.levels=DEBUG
<#if multiDB>
# ==================================================================================
<#if dataBase == 'Oracle'>
# 主数据库
spring.datasource.main.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.main.jdbc-url=jdbc:oracle:thin:@127.0.0.1:1521:main
spring.datasource.main.username=main_user
spring.datasource.main.password=main_pws
# 副数据库
spring.datasource.two.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.two.jdbc-url=jdbc:oracle:thin:@127.0.0.1:1521:two
spring.datasource.two.username=two_user
spring.datasource.two.password=two_pwd
</#if>
<#if dataBase == 'MySQL'>
# 主数据库
spring.datasource.main.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.main.url=jdbc:mysql://192.168.31.81:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.main.username=test
spring.datasource.main.password=123456# mybatis
# 副数据库
spring.datasource.two.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.two.url=jdbc:mysql://192.168.31.81:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.two.username=test
spring.datasource.two.password=123456
</#if>
<#if dataBase == 'SQLite'>
# 主数据库
spring.datasource.main.driver-class-name=org.sqlite.JDBC
spring.datasource.main.url=jdbc:sqlite:${projectName?default("SpringBoot")}.db?date_string_format=yyyy-MM-dd HH:mm:ss
spring.datasource.main.username=test
spring.datasource.main.password=123456
# 副数据库
spring.datasource.two.driver-class-name=org.sqlite.JDBC
spring.datasource.two.url=jdbc:sqlite:${projectName?default("SpringBoot")}.db?date_string_format=yyyy-MM-dd HH:mm:ss
spring.datasource.two.username=test
spring.datasource.two.password=123456
</#if>
# ==================================================================================
<#else>
<#if dataBase == 'Oracle'>
# Oracle
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
spring.datasource.username=TEST
spring.datasource.password=123456
# mybatis
mybatis.mapper-locations=classpath:**/mpr/*.xml
mybatis.configuration.map-underscore-to-camel-case=true
</#if>
<#if dataBase == 'MySQL'>
# MySQL
@ -33,9 +73,6 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://192.168.31.81:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=test
spring.datasource.password=123456# mybatis
# mybatis
mybatis.mapper-locations=classpath:**/mpr/*.xml
mybatis.configuration.map-underscore-to-camel-case=true
</#if>
<#if dataBase == 'SQLite'>
# SQLite spring.datasource.url=jdbc:sqlite::resource:example.db
@ -43,6 +80,7 @@ spring.datasource.driver-class-name=org.sqlite.JDBC
spring.datasource.url=jdbc:sqlite:${projectName?default("SpringBoot")}.db?date_string_format=yyyy-MM-dd HH:mm:ss
spring.datasource.username=test
spring.datasource.password=123456
</#if>
# mybatis
mybatis.mapper-locations=classpath:**/mpr/*.xml
mybatis.configuration.map-underscore-to-camel-case=true

@ -17,15 +17,55 @@ server.tomcat.uri-encoding=UTF-8
# 日志配置
logging.path=/root/
logging.levels=INFO
<#if multiDB>
# ==================================================================================
<#if dataBase == 'Oracle'>
# 主数据库
spring.datasource.main.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.main.jdbc-url=jdbc:oracle:thin:@127.0.0.1:1521:main
spring.datasource.main.username=main_user
spring.datasource.main.password=main_pws
# 副数据库
spring.datasource.two.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.two.jdbc-url=jdbc:oracle:thin:@127.0.0.1:1521:two
spring.datasource.two.username=two_user
spring.datasource.two.password=two_pwd
</#if>
<#if dataBase == 'MySQL'>
# 主数据库
spring.datasource.main.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.main.url=jdbc:mysql://192.168.31.81:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.main.username=test
spring.datasource.main.password=123456# mybatis
# 副数据库
spring.datasource.two.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.two.url=jdbc:mysql://192.168.31.81:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.two.username=test
spring.datasource.two.password=123456
</#if>
<#if dataBase == 'SQLite'>
# 主数据库
spring.datasource.main.driver-class-name=org.sqlite.JDBC
spring.datasource.main.url=jdbc:sqlite:${projectName?default("SpringBoot")}.db?date_string_format=yyyy-MM-dd HH:mm:ss
spring.datasource.main.username=test
spring.datasource.main.password=123456
# 副数据库
spring.datasource.two.driver-class-name=org.sqlite.JDBC
spring.datasource.two.url=jdbc:sqlite:${projectName?default("SpringBoot")}.db?date_string_format=yyyy-MM-dd HH:mm:ss
spring.datasource.two.username=test
spring.datasource.two.password=123456
</#if>
# ==================================================================================
<#else>
<#if dataBase == 'Oracle'>
# Oracle
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
spring.datasource.username=TEST
spring.datasource.password=123456
# mybatis
mybatis.mapper-locations=classpath:**/mpr/*.xml
mybatis.configuration.map-underscore-to-camel-case=true
</#if>
<#if dataBase == 'MySQL'>
# MySQL
@ -33,9 +73,6 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://192.168.31.81:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=test
spring.datasource.password=123456# mybatis
# mybatis
mybatis.mapper-locations=classpath:**/mpr/*.xml
mybatis.configuration.map-underscore-to-camel-case=true
</#if>
<#if dataBase == 'SQLite'>
# SQLite spring.datasource.url=jdbc:sqlite::resource:example.db
@ -43,6 +80,7 @@ spring.datasource.driver-class-name=org.sqlite.JDBC
spring.datasource.url=jdbc:sqlite:${projectName?default("SpringBoot")}.db?date_string_format=yyyy-MM-dd HH:mm:ss
spring.datasource.username=test
spring.datasource.password=123456
</#if>
# mybatis
mybatis.mapper-locations=classpath:**/mpr/*.xml
mybatis.configuration.map-underscore-to-camel-case=true

@ -10,7 +10,7 @@
<moduleName>system</moduleName>
<hasSysFields>true</hasSysFields>
<tables>
<table create="true" delete="true" find="true" get="true" getAll="false" html="false" search="false" tableComment="字典" tableName="DICT" update="true">
<table create="true" delete="true" find="true" get="true" html="false" search="false" tableComment="字典" tableName="DICT" update="true">
<fields>
<field IsSystem="true" defaultValue="" fieldComment="主键" fieldLength="0" fieldName="ID" fieldType="Long" isMust="true" isPrimaryKey="true" isQuery="false" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="字典名称" fieldLength="50" fieldName="DICT_NAME" fieldType="String_var50" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
@ -25,7 +25,7 @@
<field IsSystem="true" defaultValue="" fieldComment="最后更新时间" fieldLength="0" fieldName="LAST_UPDATE_TIME" fieldType="Date" isMust="false" isPrimaryKey="false" isQuery="false" isSearch="false"/>
</fields>
</table>
<table create="true" delete="true" find="true" get="true" getAll="false" html="false" search="false" tableComment="字典项" tableName="DICT_ITEM" update="true">
<table create="true" delete="true" find="true" get="true" html="false" search="false" tableComment="字典项" tableName="DICT_ITEM" update="true">
<fields>
<field IsSystem="true" defaultValue="" fieldComment="主键" fieldLength="0" fieldName="ID" fieldType="Long" isMust="true" isPrimaryKey="true" isQuery="false" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="字典名称" fieldLength="50" fieldName="DICT_NAME" fieldType="String_var50" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
@ -41,7 +41,7 @@
<field IsSystem="true" defaultValue="" fieldComment="最后更新时间" fieldLength="0" fieldName="LAST_UPDATE_TIME" fieldType="Date" isMust="false" isPrimaryKey="false" isQuery="false" isSearch="false"/>
</fields>
</table>
<table create="true" delete="true" find="true" get="true" getAll="false" html="false" search="false" tableComment="文件" tableName="FILE" update="true">
<table create="true" delete="true" find="true" get="true" html="false" search="false" tableComment="文件" tableName="FILE" update="true">
<fields>
<field IsSystem="true" defaultValue="" fieldComment="主键" fieldLength="0" fieldName="ID" fieldType="Long" isMust="true" isPrimaryKey="true" isQuery="false" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="文件名称" fieldLength="255" fieldName="NAME" fieldType="String_var255" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>

@ -17,15 +17,55 @@ server.tomcat.uri-encoding=UTF-8
# 日志配置
logging.path=D://
logging.levels=DEBUG
<#if multiDB>
# ==================================================================================
<#if dataBase == 'Oracle'>
# 主数据库
spring.datasource.main.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.main.jdbc-url=jdbc:oracle:thin:@127.0.0.1:1521:main
spring.datasource.main.username=main_user
spring.datasource.main.password=main_pws
# 副数据库
spring.datasource.two.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.two.jdbc-url=jdbc:oracle:thin:@127.0.0.1:1521:two
spring.datasource.two.username=two_user
spring.datasource.two.password=two_pwd
</#if>
<#if dataBase == 'MySQL'>
# 主数据库
spring.datasource.main.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.main.url=jdbc:mysql://192.168.31.81:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.main.username=test
spring.datasource.main.password=123456# mybatis
# 副数据库
spring.datasource.two.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.two.url=jdbc:mysql://192.168.31.81:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.two.username=test
spring.datasource.two.password=123456
</#if>
<#if dataBase == 'SQLite'>
# 主数据库
spring.datasource.main.driver-class-name=org.sqlite.JDBC
spring.datasource.main.url=jdbc:sqlite:${projectName?default("SpringBoot")}.db?date_string_format=yyyy-MM-dd HH:mm:ss
spring.datasource.main.username=test
spring.datasource.main.password=123456
# 副数据库
spring.datasource.two.driver-class-name=org.sqlite.JDBC
spring.datasource.two.url=jdbc:sqlite:${projectName?default("SpringBoot")}.db?date_string_format=yyyy-MM-dd HH:mm:ss
spring.datasource.two.username=test
spring.datasource.two.password=123456
</#if>
# ==================================================================================
<#else>
<#if dataBase == 'Oracle'>
# Oracle
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
spring.datasource.username=TEST
spring.datasource.password=123456
# mybatis
mybatis.mapper-locations=classpath:**/mpr/*.xml
mybatis.configuration.map-underscore-to-camel-case=true
</#if>
<#if dataBase == 'MySQL'>
# MySQL
@ -33,9 +73,6 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://192.168.31.81:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=test
spring.datasource.password=123456# mybatis
# mybatis
mybatis.mapper-locations=classpath:**/mpr/*.xml
mybatis.configuration.map-underscore-to-camel-case=true
</#if>
<#if dataBase == 'SQLite'>
# SQLite spring.datasource.url=jdbc:sqlite::resource:example.db
@ -43,6 +80,7 @@ spring.datasource.driver-class-name=org.sqlite.JDBC
spring.datasource.url=jdbc:sqlite:${projectName?default("SpringBoot")}.db?date_string_format=yyyy-MM-dd HH:mm:ss
spring.datasource.username=test
spring.datasource.password=123456
</#if>
# mybatis
mybatis.mapper-locations=classpath:**/mpr/*.xml
mybatis.configuration.map-underscore-to-camel-case=true

@ -68,7 +68,7 @@ public class ${table.getCName()}Test {
</#if>
//删除数据
${table.getCName()}DeleteRequest request = new ${table.getCName()}DeleteRequest();
<#if module.isHasSysFields()>
<#if table.getSys()>
request.setId(createResponse.getId());
<#else>
</#if>
@ -94,15 +94,15 @@ public class ${table.getCName()}Test {
//更新数据
${table.getCName()}UpdateRequest request = new ${table.getCName()}UpdateRequest();
<#if module.isHasSysFields()>
<#if table.getSys()>
request.setId(createResponse.getId());
<#else>
</#if>
<#list table.fields as field>
<#if !field.isSystem>
request.${field.setterName()}(${field.getTestValue()});
</#if>
</#list>
</#if>
${table.getCName()}UpdateResponse response = ${table.getFName()}Manager.update(request,token);
@ -125,7 +125,7 @@ public class ${table.getCName()}Test {
assertTrue(!response.hasError());
}
</#if>
<#if table.getGet() && module.hasSysFields>
<#if table.getGet() && table.getSys()>
@Test
public void testGet() {
@ -141,24 +141,15 @@ public class ${table.getCName()}Test {
//获得数据
${table.getCName()}GetRequest request = new ${table.getCName()}GetRequest();
<#if table.getSys()>
request.setId(createResponse.getId());
</#if>
${table.getCName()}GetResponse response = ${table.getFName()}Manager.get(request,token);
assertTrue(!response.hasError() && response.get${table.getCName()}() != null);
}
</#if>
<#if table.getGetAll()>
@Test
public void testGetAll() {
${table.getCName()}GetAllRequest request = new ${table.getCName()}GetAllRequest();
${table.getCName()}GetAllResponse response = ${table.getFName()}Manager.getAll(request,token);
assertTrue(!response.hasError());
}
</#if>
<#if table.getSearch()>
@Test

@ -137,14 +137,6 @@ public class AjaxController {
return ${table.getFName()}Manager.find(request, token);
}
/**
* 查询所有${table.tableComment}
*/
private BaseResponse getAll${table.getCName()}(JSONObject jsonObject, Token token) {
${table.getCName()}GetAllRequest request = JSON.toJavaObject(jsonObject, ${table.getCName()}GetAllRequest.class);
return ${table.getFName()}Manager.getAll(request, token);
}
/**
* 获得${table.tableComment}
*/

@ -7,12 +7,32 @@ package ${basePackage}.framework.base;
* @version 0.0.1
* @since 2017-01-01
*/
public class BaseFindRequest extends BaseGetAllRequest {
public class BaseFindRequest extends BaseRequest {
private int pageNumber = 1;
private int pageSize = 10;
private int beginIndex = 0;
private int endIndex = 10;
private String sortKey;
private SortType sortType;
public String getSortKey() {
return sortKey;
}
public void setSortKey(String sortKey) {
this.sortKey = sortKey;
}
public SortType getSortType() {
return sortType;
}
public void setSortType(SortType sortType) {
this.sortType = sortType;
}
public int getPageNumber() {
return pageNumber;
}

@ -1,32 +0,0 @@
package ${basePackage}.framework.base;
/**
* BaseFindRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
*/
public class BaseGetAllRequest extends BaseRequest {
private String sortKey;
private SortType sortType;
public String getSortKey() {
return sortKey;
}
public void setSortKey(String sortKey) {
this.sortKey = sortKey;
}
public SortType getSortType() {
return sortType;
}
public void setSortType(SortType sortType) {
this.sortType = sortType;
}
}

@ -58,15 +58,6 @@ public interface ${table.getCName()}Manager {
*/
${table.getCName()}SearchResponse search(${table.getCName()}SearchRequest request, Token token);
/**
* 查询所有
*
* @param request 请求对象
* @param token 令牌
* @return
*/
${table.getCName()}GetAllResponse getAll(${table.getCName()}GetAllRequest request, Token token);
/**
* 获得对象
*

@ -1,14 +0,0 @@
package ${basePackage}.${moduleName}.rsp;
import ${basePackage}.framework.base.BaseFindResponse;
import ${basePackage}.${moduleName}.ent.${table.getCName()};
/**
* ${table.getCName()}GetAllResponse - ${table.tableComment}
*
* @author ${author?default("")}
* @version 0.0.1
* @since ${date?string("yyyy-MM-dd")}
*/
public class ${table.getCName()}GetAllResponse extends BaseFindResponse<${table.getCName()}>{
}
Loading…
Cancel
Save

Powered by TurnKey Linux.