Former-commit-id: 8e50e6677fbd639097624df8d97c76bd12ea4e9f
master
wangbing 5 years ago
parent a572ac900d
commit 7c9e8d9d2e

@ -450,6 +450,12 @@ public class JavaFxApplication extends Application {
currentProject.setMultiDB(newValue); currentProject.setMultiDB(newValue);
} }
}); });
detailProjectController.getSysMD().selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
currentProject.setSysMD(newValue);
}
});
} }
{//初始化表面板 {//初始化表面板
@ -605,6 +611,7 @@ public class JavaFxApplication extends Application {
detailProjectController.getProjectBasePackage().setText(currentProject.getProjectBasePackage()); detailProjectController.getProjectBasePackage().setText(currentProject.getProjectBasePackage());
detailProjectController.getProjectAuthor().setText(currentProject.getProjectAuthor()); detailProjectController.getProjectAuthor().setText(currentProject.getProjectAuthor());
detailProjectController.getMultiDB().setSelected(currentProject.getMultiDB()); detailProjectController.getMultiDB().setSelected(currentProject.getMultiDB());
detailProjectController.getSysMD().setSelected(currentProject.getSysMD());
if (gridPane != null) { if (gridPane != null) {
detail.getChildren().clear(); detail.getChildren().clear();

@ -14,6 +14,16 @@ public class DetailProjectController {
private TextField projectAuthor; private TextField projectAuthor;
@FXML @FXML
private CheckBox multiDB; private CheckBox multiDB;
@FXML
private CheckBox sysMD;
public CheckBox getSysMD() {
return sysMD;
}
public void setSysMD(CheckBox sysMD) {
this.sysMD = sysMD;
}
public CheckBox getMultiDB() { public CheckBox getMultiDB() {
return multiDB; return multiDB;

@ -64,6 +64,11 @@ public class XmlManager {
project.setMultiDB(getBoolean(multiDB.item(0).getTextContent())); project.setMultiDB(getBoolean(multiDB.item(0).getTextContent()));
} }
NodeList sysMD = dbElement.getElementsByTagName("sysMD");
if (sysMD.getLength() == 1) {
project.setSysMD(getBoolean(sysMD.item(0).getTextContent()));
}
NodeList modules = dbElement.getElementsByTagName("module"); NodeList modules = dbElement.getElementsByTagName("module");
if (modules.getLength() > 0) { if (modules.getLength() > 0) {
@ -171,10 +176,13 @@ public class XmlManager {
projectAuthor.setTextContent(project.getProjectAuthor()); projectAuthor.setTextContent(project.getProjectAuthor());
Element multiDB = doc.createElement("multiDB"); Element multiDB = doc.createElement("multiDB");
multiDB.setTextContent(String.valueOf(project.getMultiDB())); multiDB.setTextContent(String.valueOf(project.getMultiDB()));
Element sysMD = doc.createElement("sysMD");
sysMD.setTextContent(String.valueOf(project.getSysMD()));
rootProject.appendChild(projectName); rootProject.appendChild(projectName);
rootProject.appendChild(projectBasePackage); rootProject.appendChild(projectBasePackage);
rootProject.appendChild(projectAuthor); rootProject.appendChild(projectAuthor);
rootProject.appendChild(multiDB); rootProject.appendChild(multiDB);
rootProject.appendChild(sysMD);
Element modules = doc.createElement("modules"); Element modules = doc.createElement("modules");
rootProject.appendChild(modules); rootProject.appendChild(modules);

@ -11,6 +11,7 @@ import xyz.wbsite.dbtool.javafx.po.Project;
import xyz.wbsite.dbtool.javafx.po.Table; import xyz.wbsite.dbtool.javafx.po.Table;
import xyz.wbsite.dbtool.javafx.tool.Tool; import xyz.wbsite.dbtool.javafx.tool.Tool;
import xyz.wbsite.dbtool.web.frame.utils.FileUtil; import xyz.wbsite.dbtool.web.frame.utils.FileUtil;
import xyz.wbsite.dbtool.web.frame.utils.ResourceUtil;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -100,7 +101,7 @@ public class SpringBootCallable implements Callable {
generateResponse(Tool.createPath(moduleDir.getAbsolutePath(), "rsp"), module, dataBase, option); generateResponse(Tool.createPath(moduleDir.getAbsolutePath(), "rsp"), module, dataBase, option);
} }
{// 生成System模块 if (project.getSysMD()) {//生成系统模块
Module module = new Module(); Module module = new Module();
module.setModuleName("system"); module.setModuleName("system");
module.setProjectAuthor(project.getProjectAuthor()); module.setProjectAuthor(project.getProjectAuthor());
@ -158,7 +159,6 @@ public class SpringBootCallable implements Callable {
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "pom.xml"), option + "/pom.ftl", ctx); freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "pom.xml"), option + "/pom.ftl", ctx);
} }
/** /**
* Controller * Controller
* *
@ -179,13 +179,6 @@ public class SpringBootCallable implements Callable {
{ {
File ajax = Tool.createPath(root.getAbsolutePath(), "ajax"); File ajax = Tool.createPath(root.getAbsolutePath(), "ajax");
File system = Tool.createPath(ajax.getAbsolutePath(), "system");
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "AuthAjax.java"), option + "/java/action/ajax/system/AuthAjax.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DictAjax.java"), option + "/java/action/ajax/system/DictAjax.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DictItemAjax.java"), option + "/java/action/ajax/system/DictItemAjax.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "FileAjax.java"), option + "/java/action/ajax/system/FileAjax.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "ResourceAjax.java"), option + "/java/action/ajax/system/ResourceAjax.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "TokensAjax.java"), option + "/java/action/ajax/system/TokensAjax.java", ctx);
for (Module module : project.getModules()) { for (Module module : project.getModules()) {
File m = Tool.createPath(ajax.getAbsolutePath(), module.getModuleName()); File m = Tool.createPath(ajax.getAbsolutePath(), module.getModuleName());
@ -201,21 +194,21 @@ public class SpringBootCallable implements Callable {
freeMarkerManager.outputTemp(Tool.createFile(m.getAbsolutePath(), table.getCName() + "Ajax.java"), option + "/java/action/ajax/Ajax.java", ctxss); freeMarkerManager.outputTemp(Tool.createFile(m.getAbsolutePath(), table.getCName() + "Ajax.java"), option + "/java/action/ajax/Ajax.java", ctxss);
} }
} }
if (project.getSysMD()) {//生成系统模块
File system = Tool.createPath(ajax.getAbsolutePath(), "system");
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/action/ajax/system/")) {
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), name), option + "/java/action/ajax/system/" + name, ctx);
}
}
} }
{ {
File api = Tool.createPath(root.getAbsolutePath(), "api"); File api = Tool.createPath(root.getAbsolutePath(), "api");
File system = Tool.createPath(api.getAbsolutePath(), "system");
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "AuthApi.java"), option + "/java/action/api/system/AuthApi.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DictApi.java"), option + "/java/action/api/system/DictApi.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DictItemApi.java"), option + "/java/action/api/system/DictItemApi.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "FileApi.java"), option + "/java/action/api/system/FileApi.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "ResourceApi.java"), option + "/java/action/api/system/ResourceApi.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "TokensApi.java"), option + "/java/action/api/system/TokensApi.java", ctx);
for (Module module : project.getModules()) { for (Module module : project.getModules()) {
File m = Tool.createPath(api.getAbsolutePath(), module.getModuleName()); File m = Tool.createPath(api.getAbsolutePath(), module.getModuleName());
m.mkdirs();
for (Table table : module.getTables()) { for (Table table : module.getTables()) {
HashMap<String, Object> ctxss = new HashMap<String, Object>(); HashMap<String, Object> ctxss = new HashMap<String, Object>();
@ -227,11 +220,17 @@ public class SpringBootCallable implements Callable {
freeMarkerManager.outputTemp(Tool.createFile(m.getAbsolutePath(), table.getCName() + "Api.java"), option + "/java/action/api/Api.java", ctxss); freeMarkerManager.outputTemp(Tool.createFile(m.getAbsolutePath(), table.getCName() + "Api.java"), option + "/java/action/api/Api.java", ctxss);
} }
} }
if (project.getSysMD()) {//生成系统模块
File system = Tool.createPath(api.getAbsolutePath(), "system");
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/action/api/system/")) {
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), name), option + "/java/action/api/system/" + name, ctx);
}
}
} }
freeMarkerManager.outputTemp(Tool.createFile(screen.getAbsolutePath(), "Index.java"), option + "/java/action/screen/Index.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(screen.getAbsolutePath(), "Index.java"), option + "/java/action/screen/Index.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "GlobalController.java"), option + "/java/action/GlobalController.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "GlobalController.java"), option + "/java/action/GlobalController.java", ctx);
// freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "AjaxController.java"), option + "/java/action/AjaxController.java", ctx);
} }
public void generateConfig(File root, Project project, DataBase dataBase, String option) { public void generateConfig(File root, Project project, DataBase dataBase, String option) {
@ -250,11 +249,13 @@ public class SpringBootCallable implements Callable {
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "ActionConfig.java"), option + "/java/config/ActionConfig.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "ActionConfig.java"), option + "/java/config/ActionConfig.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "FreeMarkerConfig.java"), option + "/java/config/FreeMarkerConfig.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "FreeMarkerConfig.java"), option + "/java/config/FreeMarkerConfig.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "SecurityConfig.java"), option + "/java/config/SecurityConfig.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "SecurityConfig.java"), option + "/java/config/SecurityConfig.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "SQLiteConfig.java"), option + "/java/config/SQLiteConfig.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "TaskConfig.java"), option + "/java/config/TaskConfig.java", ctx); 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(), "ThreadPoolConfig.java"), option + "/java/config/ThreadPoolConfig.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "WebMvcConfig.java"), option + "/java/config/WebMvcConfig.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "WebMvcConfig.java"), option + "/java/config/WebMvcConfig.java", ctx);
if (project.getMultiDB()){ if (dataBase.name().equals(DataBase.SQLite)) {
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "SQLiteConfig.java"), option + "/java/config/SQLiteConfig.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(), "MapperMainConfig.java"), option + "/java/config/MapperMainConfig.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "MapperTwoConfig.java"), option + "/java/config/MapperTwoConfig.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(root.getAbsolutePath(), "MapperTwoConfig.java"), option + "/java/config/MapperTwoConfig.java", ctx);
} }
@ -465,94 +466,29 @@ public class SpringBootCallable implements Callable {
ctx.put("date", new Date()); ctx.put("date", new Date());
ctx.put("dataBase", dataBase.toString()); ctx.put("dataBase", dataBase.toString());
freeMarkerManager.outputTemp(Tool.createFile(ent.getAbsolutePath(), "Dict.java"), option + "/java/module/system/ent/Dict.java", ctx); for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/ent/")) {
freeMarkerManager.outputTemp(Tool.createFile(ent.getAbsolutePath(), "DictItem.java"), option + "/java/module/system/ent/DictItem.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(ent.getAbsolutePath(), name), option + "/java/module/system/ent/" + name, ctx);
freeMarkerManager.outputTemp(Tool.createFile(ent.getAbsolutePath(), "File.java"), option + "/java/module/system/ent/File.java", ctx); }
freeMarkerManager.outputTemp(Tool.createFile(ent.getAbsolutePath(), "Resource.java"), option + "/java/module/system/ent/Resource.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(ent.getAbsolutePath(), "Tokens.java"), option + "/java/module/system/ent/Tokens.java", ctx); for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/mgr/")) {
freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), name), option + "/java/module/system/mgr/" + name, ctx);
freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "DictItemManager.java"), option + "/java/module/system/mgr/DictItemManager.java", ctx); }
freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "DictItemManagerImpl.java"), option + "/java/module/system/mgr/DictItemManagerImpl.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "DictManager.java"), option + "/java/module/system/mgr/DictManager.java", ctx); for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/mpr/")) {
freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "DictManagerImpl.java"), option + "/java/module/system/mgr/DictManagerImpl.java", ctx); if (name.endsWith(".java")) {
freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "FileManager.java"), option + "/java/module/system/mgr/FileManager.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), name), option + "/java/module/system/mpr/" + name, ctx);
freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "FileManagerImpl.java"), option + "/java/module/system/mgr/FileManagerImpl.java", ctx); } else if (name.contains(dataBase.toString())) {
freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "ResourceManager.java"), option + "/java/module/system/mgr/ResourceManager.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), name.replaceAll("_" + dataBase.toString(), "")), option + "/java/module/system/mpr/" + name, ctx);
freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "ResourceManagerImpl.java"), option + "/java/module/system/mgr/ResourceManagerImpl.java", ctx); }
freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "TokensManager.java"), option + "/java/module/system/mgr/TokensManager.java", ctx); }
freeMarkerManager.outputTemp(Tool.createFile(mgr.getAbsolutePath(), "TokensManagerImpl.java"), option + "/java/module/system/mgr/TokensManagerImpl.java", ctx);
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/req/")) {
freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "DictItemMapper.java"), option + "/java/module/system/mpr/DictItemMapper.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), name), option + "/java/module/system/req/" + name, ctx);
freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "DictItemMapper.xml"), option + "/java/module/system/mpr/DictItemMapper_" + dataBase.toString() + ".xml", ctx); }
freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "DictMapper.java"), option + "/java/module/system/mpr/DictMapper.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "DictMapper.xml"), option + "/java/module/system/mpr/DictMapper_" + dataBase.toString() + ".xml", ctx); for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/module/system/rsp/")) {
freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "FileMapper.java"), option + "/java/module/system/mpr/FileMapper.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), name), option + "/java/module/system/rsp/" + name, ctx);
freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "FileMapper.xml"), option + "/java/module/system/mpr/FileMapper_" + dataBase.toString() + ".xml", ctx); }
freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "ResourceMapper.java"), option + "/java/module/system/mpr/ResourceMapper.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "ResourceMapper.xml"), option + "/java/module/system/mpr/ResourceMapper_" + dataBase.toString() + ".xml", ctx);
freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "TokensMapper.java"), option + "/java/module/system/mpr/TokensMapper.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(mpr.getAbsolutePath(), "ResourceMapper.xml"), option + "/java/module/system/mpr/ResourceMapper_" + dataBase.toString() + ".xml", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "AuthLoginRequest.java"), option + "/java/module/system/req/AuthLoginRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictCreateRequest.java"), option + "/java/module/system/req/DictCreateRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictDeleteRequest.java"), option + "/java/module/system/req/DictDeleteRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictFindRequest.java"), option + "/java/module/system/req/DictFindRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictGetRequest.java"), option + "/java/module/system/req/DictGetRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictItemCreateRequest.java"), option + "/java/module/system/req/DictItemCreateRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictItemDeleteRequest.java"), option + "/java/module/system/req/DictItemDeleteRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictItemFindRequest.java"), option + "/java/module/system/req/DictItemFindRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictItemGetRequest.java"), option + "/java/module/system/req/DictItemGetRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictItemUpdateRequest.java"), option + "/java/module/system/req/DictItemUpdateRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictLoadRequest.java"), option + "/java/module/system/req/DictLoadRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "DictUpdateRequest.java"), option + "/java/module/system/req/DictUpdateRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "FileCreateRequest.java"), option + "/java/module/system/req/FileCreateRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "FileDeleteRequest.java"), option + "/java/module/system/req/FileDeleteRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "FileDownloadRequest.java"), option + "/java/module/system/req/FileDownloadRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "FileFindRequest.java"), option + "/java/module/system/req/FileFindRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "FileGetRequest.java"), option + "/java/module/system/req/FileGetRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "FileUploadRequest.java"), option + "/java/module/system/req/FileUploadRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "ResourceCreateRequest.java"), option + "/java/module/system/req/ResourceCreateRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "ResourceDeleteRequest.java"), option + "/java/module/system/req/ResourceDeleteRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "ResourceFindRequest.java"), option + "/java/module/system/req/ResourceFindRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "ResourceGetRequest.java"), option + "/java/module/system/req/ResourceGetRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "ResourceUpdateRequest.java"), option + "/java/module/system/req/ResourceUpdateRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "TokensCreateRequest.java"), option + "/java/module/system/req/TokensCreateRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "TokensDeleteRequest.java"), option + "/java/module/system/req/TokensDeleteRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "TokensFindRequest.java"), option + "/java/module/system/req/TokensFindRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "TokensGetRequest.java"), option + "/java/module/system/req/TokensGetRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(req.getAbsolutePath(), "TokensUpdateRequest.java"), option + "/java/module/system/req/TokensUpdateRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "AuthLoginResponse.java"), option + "/java/module/system/rsp/AuthLoginResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictCreateResponse.java"), option + "/java/module/system/rsp/DictCreateResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictDeleteResponse.java"), option + "/java/module/system/rsp/DictDeleteResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictFindResponse.java"), option + "/java/module/system/rsp/DictFindResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictGetResponse.java"), option + "/java/module/system/rsp/DictGetResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictItemCreateResponse.java"), option + "/java/module/system/rsp/DictItemCreateResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictItemDeleteResponse.java"), option + "/java/module/system/rsp/DictItemDeleteResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictItemFindResponse.java"), option + "/java/module/system/rsp/DictItemFindResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictItemGetResponse.java"), option + "/java/module/system/rsp/DictItemGetResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictItemUpdateResponse.java"), option + "/java/module/system/rsp/DictItemUpdateResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictLoadResponse.java"), option + "/java/module/system/rsp/DictLoadResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "DictUpdateResponse.java"), option + "/java/module/system/rsp/DictUpdateResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "FileCreateResponse.java"), option + "/java/module/system/rsp/FileCreateResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "FileDeleteResponse.java"), option + "/java/module/system/rsp/FileDeleteResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "FileDownloadResponse.java"), option + "/java/module/system/rsp/FileDownloadResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "FileFindResponse.java"), option + "/java/module/system/rsp/FileFindResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "FileGetResponse.java"), option + "/java/module/system/rsp/FileGetResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "FileUploadResponse.java"), option + "/java/module/system/rsp/FileUploadResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "ResourceCreateResponse.java"), option + "/java/module/system/rsp/ResourceCreateResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "ResourceDeleteResponse.java"), option + "/java/module/system/rsp/ResourceDeleteResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "ResourceFindResponse.java"), option + "/java/module/system/rsp/ResourceFindResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "ResourceGetResponse.java"), option + "/java/module/system/rsp/ResourceGetResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "ResourceUpdateResponse.java"), option + "/java/module/system/rsp/ResourceUpdateResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "TokensCreateResponse.java"), option + "/java/module/system/rsp/TokensCreateResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "TokensDeleteResponse.java"), option + "/java/module/system/rsp/TokensDeleteResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "TokensFindResponse.java"), option + "/java/module/system/rsp/TokensFindResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "TokensGetResponse.java"), option + "/java/module/system/rsp/TokensGetResponse.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(rsp.getAbsolutePath(), "TokensUpdateResponse.java"), option + "/java/module/system/rsp/TokensUpdateResponse.java", ctx);
} }
/** /**
@ -583,84 +519,41 @@ public class SpringBootCallable implements Callable {
File validation = Tool.createPath(root.getAbsolutePath(), "validation"); File validation = Tool.createPath(root.getAbsolutePath(), "validation");
//auth //auth
freeMarkerManager.outputTemp(Tool.createFile(auth.getAbsolutePath(), "LocalData.java"), option + "/java/frame/auth/LocalData.java", ctx); for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/auth/")) {
freeMarkerManager.outputTemp(Tool.createFile(auth.getAbsolutePath(), "Verification.java"), option + "/java/frame/auth/Verification.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(auth.getAbsolutePath(), name), option + "/java/frame/auth/" + name, ctx);
}
//base //base
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseEntity.java"), option + "/java/frame/base/BaseEntity.java", ctx); for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/base/")) {
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseFindRequest.java"), option + "/java/frame/base/BaseFindRequest.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), name), option + "/java/frame/base/" + name, ctx);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseFindResponse.java"), option + "/java/frame/base/BaseFindResponse.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);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "BaseUpdateRequest.java"), option + "/java/frame/base/BaseUpdateRequest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "Control.java"), option + "/java/frame/base/Control.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "Error.java"), option + "/java/frame/base/Error.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "ErrorType.java"), option + "/java/frame/base/ErrorType.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "Screen.java"), option + "/java/frame/base/Screen.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "SortType.java"), option + "/java/frame/base/SortType.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(base.getAbsolutePath(), "Token.java"), option + "/java/frame/base/Token.java", ctx);
//excel //excel
freeMarkerManager.outputTemp(Tool.createFile(excel.getAbsolutePath(), "WCell.java"), option + "/java/frame/excel/WCell.java", ctx); for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/")) {
freeMarkerManager.outputTemp(Tool.createFile(excel.getAbsolutePath(), "WColumn.java"), option + "/java/frame/excel/WColumn.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(excel.getAbsolutePath(), name), option + "/java/frame/excel/" + name, ctx);
freeMarkerManager.outputTemp(Tool.createFile(excel.getAbsolutePath(), "WRow.java"), option + "/java/frame/excel/WRow.java", ctx); }
freeMarkerManager.outputTemp(Tool.createFile(excel.getAbsolutePath(), "WSheet.java"), option + "/java/frame/excel/WSheet.java", ctx); for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/annotation/")) {
freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), name), option + "/java/frame/excel/annotation/" + name, ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), "ColumnDescription.java"), option + "/java/frame/excel/annotation/ColumnDescription.java", ctx); }
freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), "ColumnName.java"), option + "/java/frame/excel/annotation/ColumnName.java", ctx); for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/converter/")) {
freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), "Converter.java"), option + "/java/frame/excel/annotation/Converter.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), name), option + "/java/frame/excel/converter/" + name, ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), "Ignore.java"), option + "/java/frame/excel/annotation/Ignore.java", ctx); }
freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), "ParentFirst.java"), option + "/java/frame/excel/annotation/ParentFirst.java", ctx); for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/exception/")) {
freeMarkerManager.outputTemp(Tool.createFile(excelannotation.getAbsolutePath(), "SheetName.java"), option + "/java/frame/excel/annotation/SheetName.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(exception.getAbsolutePath(), name), option + "/java/frame/excel/exception/" + name, ctx);
}
freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "BooleanConverter.java"), option + "/java/frame/excel/converter/BooleanConverter.java", ctx); for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/excel/style/")) {
freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "ByteConverter.java"), option + "/java/frame/excel/converter/ByteConverter.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), name), option + "/java/frame/excel/style/" + name, ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "CharacterConverter.java"), option + "/java/frame/excel/converter/CharacterConverter.java", ctx); }
freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "Converter.java"), option + "/java/frame/excel/converter/Converter.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "DateConverter.java"), option + "/java/frame/excel/converter/DateConverter.java", ctx); //utils
freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "DoubleConverter.java"), option + "/java/frame/excel/converter/DoubleConverter.java", ctx); for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/utils/")) {
freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "FloatConverter.java"), option + "/java/frame/excel/converter/FloatConverter.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), name), option + "/java/frame/utils/" + name, ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "IntegerConverter.java"), option + "/java/frame/excel/converter/IntegerConverter.java", ctx); }
freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "LongConverter.java"), option + "/java/frame/excel/converter/LongConverter.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "ShortConverter.java"), option + "/java/frame/excel/converter/ShortConverter.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelconverter.getAbsolutePath(), "StringConverter.java"), option + "/java/frame/excel/converter/StringConverter.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(exception.getAbsolutePath(), "ReadErrorException.java"), option + "/java/frame/excel/exception/ReadErrorException.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(exception.getAbsolutePath(), "TemplateNotMatchException.java"), option + "/java/frame/excel/exception/TemplateNotMatchException.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(exception.getAbsolutePath(), "ValueConverterException.java"), option + "/java/frame/excel/exception/ValueConverterException.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "BaseCellStyle.java"), option + "/java/frame/excel/style/BaseCellStyle.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "BaseFont.java"), option + "/java/frame/excel/style/BaseFont.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "DataCellStyle.java"), option + "/java/frame/excel/style/DataCellStyle.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "ErrorCellStyle.java"), option + "/java/frame/excel/style/ErrorCellStyle.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "HeadCellStyle.java"), option + "/java/frame/excel/style/HeadCellStyle.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "NormalFont.java"), option + "/java/frame/excel/style/NormalFont.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(excelstyle.getAbsolutePath(), "RedFont.java"), option + "/java/frame/excel/style/RedFont.java", ctx);
//uitls
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "Base64Util.java"), option + "/java/frame/utils/Base64Util.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "AESUtil.java"), option + "/java/frame/utils/AESUtil.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "ClassUtil.java"), option + "/java/frame/utils/ClassUtil.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "CookieUtil.java"), option + "/java/frame/utils/CookieUtil.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "FileUtil.java"), option + "/java/frame/utils/FileUtil.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "LogUtil.java"), option + "/java/frame/utils/LogUtil.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "MapperUtil.java"), option + "/java/frame/utils/MapperUtil.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "MD5Util.java"), option + "/java/frame/utils/MD5Util.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "ProcessUtil.java"), option + "/java/frame/utils/ProcessUtil.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "ResourceUtil.java"), option + "/java/frame/utils/ResourceUtil.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "ResponseUtil.java"), option + "/java/frame/utils/ResponseUtil.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "RSAUtil.java"), option + "/java/frame/utils/RSAUtil.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "StringUtil.java"), option + "/java/frame/utils/StringUtil.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "ValidationUtil.java"), option + "/java/frame/utils/ValidationUtil.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "WebUtils.java"), option + "/java/frame/utils/WebUtils.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "IDgenerator.java"), option + "/java/frame/utils/IDgenerator.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "Message.java"), option + "/java/frame/utils/Message.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(utils.getAbsolutePath(), "UrlUtil.java"), option + "/java/frame/utils/UrlUtil.java", ctx);
//validation //validation
freeMarkerManager.outputTemp(Tool.createFile(validation.getAbsolutePath(), "Dict.java"), option + "/java/frame/validation/Dict.java", ctx); for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/java/frame/validation/")) {
freeMarkerManager.outputTemp(Tool.createFile(validation.getAbsolutePath(), "DictValidator.java"), option + "/java/frame/validation/DictValidator.java", ctx); freeMarkerManager.outputTemp(Tool.createFile(validation.getAbsolutePath(), name), option + "/java/frame/validation/" + name, ctx);
}
} }
/** /**
@ -722,17 +615,12 @@ public class SpringBootCallable implements Callable {
freeMarkerManager.outputTemp(Tool.createFile(tableDir.getAbsolutePath(), "ALL_TABLE.sql"), option + "/resources/dbtool/tableAll.ftl", ctx); freeMarkerManager.outputTemp(Tool.createFile(tableDir.getAbsolutePath(), "ALL_TABLE.sql"), option + "/resources/dbtool/tableAll.ftl", ctx);
} }
{ if (project.getSysMD()) {//生成系统模块
File system = Tool.createPath(dbtool.getAbsolutePath(), "system_table"); File system = Tool.createPath(dbtool.getAbsolutePath(), "system_table");
File file = new File(system.getAbsolutePath(), "ALL_TABLE.sql");
if (file.exists()){ for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/resources/dbtool/system/")) {
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "ALL_TABLE_.sql"), option + "/resources/dbtool/system/ALL_TABLE_" + dataBase.toString() + ".sql", ctx); freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), name), option + "/resources/dbtool/system/" + name, ctx);
}else {
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "ALL_TABLE.sql"), option + "/resources/dbtool/system/ALL_TABLE_" + dataBase.toString() + ".sql", ctx);
} }
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DICT.sql"), option + "/resources/dbtool/system/DICT_" + dataBase.toString() + ".sql", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DICT_ITEM.sql"), option + "/resources/dbtool/system/DICT_ITEM_" + dataBase.toString() + ".sql", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "FILE.sql"), option + "/resources/dbtool/system/FILE_" + dataBase.toString() + ".sql", ctx);
} }
if (DataBase.Oracle.name().equals(dataBase.name())) { if (DataBase.Oracle.name().equals(dataBase.name())) {
@ -846,32 +734,18 @@ public class SpringBootCallable implements Callable {
public void generateTemplates(File root, Project project, DataBase dataBase, String option) { public void generateTemplates(File root, Project project, DataBase dataBase, String option) {
{//生成 {//生成
File templates = Tool.createPath(root.getAbsolutePath(), "templates"); File templates = Tool.createPath(root.getAbsolutePath(), "templates");
templates.mkdirs();
File control = Tool.createPath(templates.getAbsolutePath(), "control"); File control = Tool.createPath(templates.getAbsolutePath(), "control");
File layout = Tool.createPath(templates.getAbsolutePath(), "layout"); File layout = Tool.createPath(templates.getAbsolutePath(), "layout");
File screen = Tool.createPath(templates.getAbsolutePath(), "screen"); File screen = Tool.createPath(templates.getAbsolutePath(), "screen");
File system = Tool.createPath(screen.getAbsolutePath(), "system");
Tool.outputResource(option + "/resources/templates/control/nav.ftl", Tool.createFile(control.getAbsolutePath(), "nav.ftl")); Tool.outputResource(option + "/resources/templates/control/nav.ftl", Tool.createFile(control.getAbsolutePath(), "nav.ftl"));
// Tool.outputResource(option + "/resources/templates/control/header.ftl", Tool.createFile(control.getAbsolutePath(), "header.ftl"));
// Tool.outputResource(option + "/resources/templates/control/footer.ftl", Tool.createFile(control.getAbsolutePath(), "footer.ftl"));
Tool.outputResource(option + "/resources/templates/control/macro.ftl", Tool.createFile(control.getAbsolutePath(), "macro.ftl")); Tool.outputResource(option + "/resources/templates/control/macro.ftl", Tool.createFile(control.getAbsolutePath(), "macro.ftl"));
// Tool.outputResource(option + "/resources/templates/control/mint-ui-extend.ftl", Tool.createFile(control.getAbsolutePath(), "mint-ui-extend.ftl"));
Tool.outputResource(option + "/resources/templates/layout/default.ftl", Tool.createFile(layout.getAbsolutePath(), "default.ftl")); Tool.outputResource(option + "/resources/templates/layout/default.ftl", Tool.createFile(layout.getAbsolutePath(), "default.ftl"));
Tool.outputResource(option + "/resources/templates/layout/index.ftl", Tool.createFile(layout.getAbsolutePath(), "index.ftl"));
// Tool.outputResource(option + "/resources/templates/layout/app.ftl", Tool.createFile(layout.getAbsolutePath(), "app.ftl"));
Tool.outputResource(option + "/resources/templates/screen/home.ftl", Tool.createFile(screen.getAbsolutePath(), "home.ftl")); Tool.outputResource(option + "/resources/templates/screen/home.ftl", Tool.createFile(screen.getAbsolutePath(), "home.ftl"));
Tool.outputResource(option + "/resources/templates/screen/login.ftl", Tool.createFile(screen.getAbsolutePath(), "login.ftl")); Tool.outputResource(option + "/resources/templates/screen/login.ftl", Tool.createFile(screen.getAbsolutePath(), "login.ftl"));
Tool.outputResource(option + "/resources/templates/403.ftl", Tool.createFile(templates.getAbsolutePath(), "403.ftl")); Tool.outputResource(option + "/resources/templates/403.ftl", Tool.createFile(templates.getAbsolutePath(), "403.ftl"));
Tool.outputResource(option + "/resources/templates/404.ftl", Tool.createFile(templates.getAbsolutePath(), "404.ftl")); Tool.outputResource(option + "/resources/templates/404.ftl", Tool.createFile(templates.getAbsolutePath(), "404.ftl"));
Tool.outputResource(option + "/resources/templates/500.ftl", Tool.createFile(templates.getAbsolutePath(), "500.ftl")); Tool.outputResource(option + "/resources/templates/500.ftl", Tool.createFile(templates.getAbsolutePath(), "500.ftl"));
Tool.outputResource(option + "/resources/templates/screen/module/system/dict.ftl", Tool.createFile(system.getAbsolutePath(), "dict.ftl"));
Tool.outputResource(option + "/resources/templates/screen/module/system/dictItem.ftl", Tool.createFile(system.getAbsolutePath(), "dictItem.ftl"));
Tool.outputResource(option + "/resources/templates/screen/module/system/file.ftl", Tool.createFile(system.getAbsolutePath(), "file.ftl"));
Tool.outputResource(option + "/resources/templates/screen/module/system/resource.ftl", Tool.createFile(system.getAbsolutePath(), "resource.ftl"));
Tool.outputResource(option + "/resources/templates/screen/module/system/tokens.ftl", Tool.createFile(system.getAbsolutePath(), "tokens.ftl"));
{ {
HashMap<String, Object> ctx = new HashMap<String, Object>(); HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put("basePackage", project.getProjectBasePackage()); ctx.put("basePackage", project.getProjectBasePackage());
@ -879,6 +753,7 @@ public class SpringBootCallable implements Callable {
ctx.put("author", project.getProjectAuthor()); ctx.put("author", project.getProjectAuthor());
ctx.put("date", new Date()); ctx.put("date", new Date());
ctx.put("modules", project.getModules()); ctx.put("modules", project.getModules());
ctx.put("sysMD", project.getSysMD());
freeMarkerManager.outputTemp(Tool.createFile(screen.getAbsolutePath(), "index.ftl"), option + "/resources/templates/screen/index.ftl", ctx); freeMarkerManager.outputTemp(Tool.createFile(screen.getAbsolutePath(), "index.ftl"), option + "/resources/templates/screen/index.ftl", ctx);
} }
@ -902,6 +777,13 @@ public class SpringBootCallable implements Callable {
} }
} }
} }
if (project.getSysMD()) {//生成系统模块
File system = Tool.createPath(screen.getAbsolutePath(), "system");
for (String name : ResourceUtil.getResourceFiles("/modules/SpringBoot/resources/templates/screen/module/system/")) {
Tool.outputResource(option + "/resources/templates/screen/module/system/" + name, Tool.createFile(system.getAbsolutePath(), name));
}
}
} }
} }
@ -931,21 +813,6 @@ public class SpringBootCallable implements Callable {
freeMarkerManager.outputTemp(file, option + "/test/UtilTest.java", ctx); freeMarkerManager.outputTemp(file, option + "/test/UtilTest.java", ctx);
} }
{
HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put("tool", Tool.class);
ctx.put("basePackage", project.getProjectBasePackage());
ctx.put("moduleName", project.getProjectName());
ctx.put("author", project.getProjectAuthor());
ctx.put("date", new Date());
File system = Tool.createPath(root.getAbsolutePath(), "system");
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DictItemTest.java"), option + "/test/system/DictItemTest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DictTest.java"), option + "/test/system/DictTest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "FileTest.java"), option + "/test/system/FileTest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "ResourceTest.java"), option + "/test/system/ResourceTest.java", ctx);
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "TokensTest.java"), option + "/test/system/TokensTest.java", ctx);
}
for (Module md : project.getModules()) { for (Module md : project.getModules()) {
File module = Tool.createPath(root.getAbsolutePath(), md.getModuleName()); File module = Tool.createPath(root.getAbsolutePath(), md.getModuleName());
@ -965,5 +832,18 @@ public class SpringBootCallable implements Callable {
} }
} }
if (project.getSysMD()) {//生成系统模块
HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put("tool", Tool.class);
ctx.put("basePackage", project.getProjectBasePackage());
ctx.put("moduleName", project.getProjectName());
ctx.put("author", project.getProjectAuthor());
ctx.put("date", new Date());
File system = Tool.createPath(root.getAbsolutePath(), "system");
for (String apiFile : ResourceUtil.getResourceFiles("/modules/SpringBoot/test/system/")) {
freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), apiFile), option + "/test/system/" + apiFile, ctx);
}
}
} }
} }

@ -24,6 +24,7 @@ public class Project extends TreeItem{
private String projectBasePackage; private String projectBasePackage;
private String projectAuthor; private String projectAuthor;
private boolean multiDB; private boolean multiDB;
private boolean sysMD;
/** /**
* *
@ -76,4 +77,12 @@ public class Project extends TreeItem{
public void setMultiDB(boolean multiDB) { public void setMultiDB(boolean multiDB) {
this.multiDB = multiDB; this.multiDB = multiDB;
} }
public boolean getSysMD() {
return sysMD;
}
public void setSysMD(boolean sysMD) {
this.sysMD = sysMD;
}
} }

@ -8,9 +8,58 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ResourceUtil extends ResourceUtils { public class ResourceUtil extends ResourceUtils {
/**
* : /modules/dir/
*
* @param resourcePath
* @return
*/
public static List<String> getResourceFiles(String resourcePath) {
List<String> result = new ArrayList<>();
File applicationHome = getApplicationHome();
if (applicationHome.getAbsolutePath().endsWith(".jar")) {
try {
Pattern pattern = Pattern.compile(".*" + resourcePath + "(.+\\..+)");
JarFile jarFile = new JarFile(applicationHome);
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry jarEntry = entries.nextElement();
String name = jarEntry.getName();
if (name.matches(".*" + resourcePath + "(.+\\..+)")) {
Matcher matcher = pattern.matcher(name);
if (matcher.find()) result.add(matcher.group(1));
}
}
} catch (IOException e) {
e.printStackTrace();
}
} else {
try {
ClassPathResource cpr = new ClassPathResource(resourcePath);
File in = cpr.getFile();
for (File file : in.listFiles()) {
result.add(file.getName());
}
return result;
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
}
/** /**
* jar * jar
* *

@ -52,6 +52,7 @@
GridPane.halignment="CENTER" GridPane.halignment="CENTER"
GridPane.valignment="CENTER"> GridPane.valignment="CENTER">
<children> <children>
<CheckBox fx:id="sysMD" selected="true" GridPane.rowIndex="4" GridPane.columnIndex="2" text="系统模块"/>
<CheckBox fx:id="multiDB" GridPane.rowIndex="4" GridPane.columnIndex="2" text="多数据库"/> <CheckBox fx:id="multiDB" GridPane.rowIndex="4" GridPane.columnIndex="2" text="多数据库"/>
</children> </children>
</HBox> </HBox>

@ -1,22 +1,133 @@
package ${basePackage}.action.ajax.system; package ${basePackage}.action.ajax.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.utils.CookieUtil;
import ${basePackage}.frame.utils.MD5Util;
import ${basePackage}.frame.utils.RequestUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.module.system.ent.User;
import ${basePackage}.module.system.mgr.TokensManager;
import ${basePackage}.module.system.mgr.UserManager;
import ${basePackage}.module.system.req.AuthLoginRequest; import ${basePackage}.module.system.req.AuthLoginRequest;
import ${basePackage}.module.system.req.TokensCreateRequest;
import ${basePackage}.module.system.req.UserFindRequest;
import ${basePackage}.module.system.rsp.AuthLoginResponse; import ${basePackage}.module.system.rsp.AuthLoginResponse;
import ${basePackage}.module.system.rsp.TokensCreateResponse;
import ${basePackage}.module.system.rsp.UserFindResponse;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Calendar;
import java.util.Date;
import java.util.UUID;
public class AuthAjax { public class AuthAjax {
@Value("${r'${web.url.auth.admin}'}")
private String admin;
@Value("${r'${web.url.auth.pwd}'}")
private String pwd;
@Autowired
private TokensManager tokensManager;
@Autowired
private UserManager userManager;
public AuthLoginResponse login(AuthLoginRequest request, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { public AuthLoginResponse login(AuthLoginRequest request, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
AuthLoginResponse response = new AuthLoginResponse(); AuthLoginResponse response = new AuthLoginResponse();
// todo 设置cookie ValidationUtil.validate(request, response);
Cookie token = new Cookie("token", ""); if (response.hasError()) {
token.setDomain(httpServletRequest.getServerName()); return response;
token.setPath("/"); }
httpServletResponse.addCookie(token);
if (request.getUsername().equals(admin)) {//超级管理员登录
String generatePwd = MD5Util.generatePwd(request.getPassword());
if (!generatePwd.equals(pwd)) {
response.addError(ErrorType.BUSINESS_ERROR, "登录密码错误");
} else {
Date current = new Date();
Calendar instance = Calendar.getInstance();
instance.setTime(current);
instance.add(Calendar.HOUR_OF_DAY, 1);//默认一个小时内有效
TokensCreateRequest tokensCreateRequest = new TokensCreateRequest();
tokensCreateRequest.setToken(UUID.randomUUID().toString());
tokensCreateRequest.setUserId(0L);
tokensCreateRequest.setUserName("超级管理员");
tokensCreateRequest.setLoginTime(current);
tokensCreateRequest.setValidTime(instance.getTime());
tokensCreateRequest.setValid(true);
tokensCreateRequest.setDeptId(null);
tokensCreateRequest.setDeptCode(null);
tokensCreateRequest.setDeptName(null);
tokensCreateRequest.setTerminalType("WEB");
tokensCreateRequest.setTerminalIp(RequestUtil.getIp(httpServletRequest));
tokensCreateRequest.setTerminalInfo(RequestUtil.getUserAgent(httpServletRequest));
TokensCreateResponse tokensCreateResponse = tokensManager.create(tokensCreateRequest, LocalData.getSysToken());
if (tokensCreateResponse.hasError()) {
response.addErrors(tokensCreateResponse.getErrors());
return response;
}
Cookie cookie = CookieUtil.newCookie("token", tokensCreateRequest.getToken()));
cookie.setPath("/");
httpServletResponse.addCookie(cookie);
}
} else {//管理员登录
UserFindRequest userFindRequest = new UserFindRequest();
userFindRequest.setUserName(request.getUsername());
UserFindResponse userFindResponse = userManager.find(userFindRequest, LocalData.getSysToken());
if (userFindResponse.hasError()) {
response.addErrors(userFindResponse.getErrors());
return response;
} else if (userFindResponse.getResult().size() == 0) {
response.addError(ErrorType.BUSINESS_ERROR, "用户名或密码错误!");
return response;
} else if (userFindResponse.getResult().size() > 1) {
response.addError(ErrorType.BUSINESS_ERROR, "用户信息异常!");
return response;
}
User user = userFindResponse.getResult().get(0);
String generatePwd = MD5Util.generatePwd(request.getPassword());
if (!generatePwd.equals(user.getUserPwd())) {
response.addError(ErrorType.BUSINESS_ERROR, "用户名或密码错误!");
return response;
}
Date current = new Date();
Calendar instance = Calendar.getInstance();
instance.setTime(current);
instance.add(Calendar.HOUR_OF_DAY, 1);//默认一个小时内有效
TokensCreateRequest tokensCreateRequest = new TokensCreateRequest();
tokensCreateRequest.setToken(UUID.randomUUID().toString());
tokensCreateRequest.setUserId(user.getId());
tokensCreateRequest.setUserName(user.getUserName());
tokensCreateRequest.setLoginTime(current);
tokensCreateRequest.setValidTime(instance.getTime());
tokensCreateRequest.setValid(true);
tokensCreateRequest.setDeptId(user.getDeptId());
tokensCreateRequest.setDeptCode(user.getDeptCode());
tokensCreateRequest.setDeptName(user.getDeptName());
tokensCreateRequest.setTerminalType("WEB");
tokensCreateRequest.setTerminalIp(RequestUtil.getIp(httpServletRequest));
tokensCreateRequest.setTerminalInfo(RequestUtil.getUserAgent(httpServletRequest));
TokensCreateResponse tokensCreateResponse = tokensManager.create(tokensCreateRequest, LocalData.getSysToken());
if (tokensCreateResponse.hasError()) {
response.addErrors(tokensCreateResponse.getErrors());
return response;
}
Cookie cookie = CookieUtil.newCookie("token", tokensCreateRequest.getToken()));
cookie.setPath("/");
httpServletResponse.addCookie(cookie);
}
return response; return response;
} }

@ -0,0 +1,90 @@
package ${basePackage}.action.ajax.system;
import com.fasterxml.jackson.core.TreeNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;
import ${basePackage}.frame.excel.WSheet;
import ${basePackage}.frame.utils.LogUtil;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.base.BaseResponse;
import ${basePackage}.frame.utils.ResponseUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.frame.excel.exception.ReadErrorException;
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
import ${basePackage}.module.system.ent.Dept;
import ${basePackage}.module.system.mgr.DeptManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import java.io.IOException;
import java.util.List;
public class DeptAjax{
@Autowired
private DeptManager deptManager;
public DeptCreateResponse create(DeptCreateRequest request) {
return deptManager.create(request, LocalData.getToken());
}
public DeptDeleteResponse delete(DeptDeleteRequest request) {
return deptManager.delete(request, LocalData.getToken());
}
public DeptUpdateResponse update(DeptUpdateRequest request) {
return deptManager.update(request, LocalData.getToken());
}
public DeptFindResponse find(DeptFindRequest request) {
return deptManager.find(request, LocalData.getToken());
}
public DeptGetResponse get(DeptGetRequest request) {
return deptManager.get(request, LocalData.getToken());
}
public Object template(){
return ResponseUtil.apply(new WSheet<>(Dept.class));
}
public Object exports(TreeNode jsonParam) {
DeptFindRequest request = MapperUtil.toJava(jsonParam, DeptFindRequest.class);
DeptFindResponse response = deptManager.find(request, LocalData.getToken());
if (response.hasError()) {
return response;
} else if (response.getTotalCount() == 0) {
response.addError(ErrorType.BUSINESS_ERROR, "导出数据为空");
return response;
}
return ResponseUtil.apply(new WSheet<>(response.getResult()));
}
public Object imports(MultipartFile file) {
BaseResponse baseResponse = new BaseResponse();
try {
WSheet<Dept> sheet = new WSheet<>(file.getBytes(), Dept.class, new WSheet.Validator<Dept>() {
@Override
public List<String> validate(Dept o) {
DeptCreateRequest request = MapperUtil.map(o, DeptCreateRequest.class);
return ValidationUtil.validate(request);
}
});
if (sheet.hasError()) {
return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-检查.xlsx");
} else {
return baseResponse;
}
} catch (IOException e) {
e.printStackTrace();
LogUtil.dumpException(e);
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件出错");
} catch (TemplateNotMatchException | ReadErrorException e) {
baseResponse.addError(ErrorType.BUSINESS_ERROR, e.getMessage());
}
return baseResponse;
}
}

@ -0,0 +1,90 @@
package ${basePackage}.action.ajax.system;
import com.fasterxml.jackson.core.TreeNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;
import ${basePackage}.frame.excel.WSheet;
import ${basePackage}.frame.utils.LogUtil;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.base.BaseResponse;
import ${basePackage}.frame.utils.ResponseUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.frame.excel.exception.ReadErrorException;
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
import ${basePackage}.module.system.ent.Role;
import ${basePackage}.module.system.mgr.RoleManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import java.io.IOException;
import java.util.List;
public class RoleAjax{
@Autowired
private RoleManager roleManager;
public RoleCreateResponse create(RoleCreateRequest request) {
return roleManager.create(request, LocalData.getToken());
}
public RoleDeleteResponse delete(RoleDeleteRequest request) {
return roleManager.delete(request, LocalData.getToken());
}
public RoleUpdateResponse update(RoleUpdateRequest request) {
return roleManager.update(request, LocalData.getToken());
}
public RoleFindResponse find(RoleFindRequest request) {
return roleManager.find(request, LocalData.getToken());
}
public RoleGetResponse get(RoleGetRequest request) {
return roleManager.get(request, LocalData.getToken());
}
public Object template(){
return ResponseUtil.apply(new WSheet<>(Role.class));
}
public Object exports(TreeNode jsonParam) {
RoleFindRequest request = MapperUtil.toJava(jsonParam, RoleFindRequest.class);
RoleFindResponse response = roleManager.find(request, LocalData.getToken());
if (response.hasError()) {
return response;
} else if (response.getTotalCount() == 0) {
response.addError(ErrorType.BUSINESS_ERROR, "导出数据为空");
return response;
}
return ResponseUtil.apply(new WSheet<>(response.getResult()));
}
public Object imports(MultipartFile file) {
BaseResponse baseResponse = new BaseResponse();
try {
WSheet<Role> sheet = new WSheet<>(file.getBytes(), Role.class, new WSheet.Validator<Role>() {
@Override
public List<String> validate(Role o) {
RoleCreateRequest request = MapperUtil.map(o, RoleCreateRequest.class);
return ValidationUtil.validate(request);
}
});
if (sheet.hasError()) {
return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-检查.xlsx");
} else {
return baseResponse;
}
} catch (IOException e) {
e.printStackTrace();
LogUtil.dumpException(e);
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件出错");
} catch (TemplateNotMatchException | ReadErrorException e) {
baseResponse.addError(ErrorType.BUSINESS_ERROR, e.getMessage());
}
return baseResponse;
}
}

@ -0,0 +1,48 @@
package ${basePackage}.action.ajax.system;
import com.fasterxml.jackson.core.TreeNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;
import ${basePackage}.frame.excel.WSheet;
import ${basePackage}.frame.utils.LogUtil;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.base.BaseResponse;
import ${basePackage}.frame.utils.ResponseUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.frame.excel.exception.ReadErrorException;
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
import ${basePackage}.module.system.ent.RoleResource;
import ${basePackage}.module.system.mgr.RoleResourceManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import java.io.IOException;
import java.util.List;
public class RoleResourceAjax{
@Autowired
private RoleResourceManager roleResourceManager;
public RoleResourceCreateResponse create(RoleResourceCreateRequest request) {
return roleResourceManager.create(request, LocalData.getToken());
}
public RoleResourceDeleteResponse delete(RoleResourceDeleteRequest request) {
return roleResourceManager.delete(request, LocalData.getToken());
}
public RoleResourceUpdateResponse update(RoleResourceUpdateRequest request) {
return roleResourceManager.update(request, LocalData.getToken());
}
public RoleResourceFindResponse find(RoleResourceFindRequest request) {
return roleResourceManager.find(request, LocalData.getToken());
}
public RoleResourceGetResponse get(RoleResourceGetRequest request) {
return roleResourceManager.get(request, LocalData.getToken());
}
}

@ -0,0 +1,90 @@
package ${basePackage}.action.ajax.system;
import com.fasterxml.jackson.core.TreeNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;
import ${basePackage}.frame.excel.WSheet;
import ${basePackage}.frame.utils.LogUtil;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.base.BaseResponse;
import ${basePackage}.frame.utils.ResponseUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.frame.excel.exception.ReadErrorException;
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
import ${basePackage}.module.system.ent.User;
import ${basePackage}.module.system.mgr.UserManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import java.io.IOException;
import java.util.List;
public class UserAjax{
@Autowired
private UserManager userManager;
public UserCreateResponse create(UserCreateRequest request) {
return userManager.create(request, LocalData.getToken());
}
public UserDeleteResponse delete(UserDeleteRequest request) {
return userManager.delete(request, LocalData.getToken());
}
public UserUpdateResponse update(UserUpdateRequest request) {
return userManager.update(request, LocalData.getToken());
}
public UserFindResponse find(UserFindRequest request) {
return userManager.find(request, LocalData.getToken());
}
public UserGetResponse get(UserGetRequest request) {
return userManager.get(request, LocalData.getToken());
}
public Object template(){
return ResponseUtil.apply(new WSheet<>(User.class));
}
public Object exports(TreeNode jsonParam) {
UserFindRequest request = MapperUtil.toJava(jsonParam, UserFindRequest.class);
UserFindResponse response = userManager.find(request, LocalData.getToken());
if (response.hasError()) {
return response;
} else if (response.getTotalCount() == 0) {
response.addError(ErrorType.BUSINESS_ERROR, "导出数据为空");
return response;
}
return ResponseUtil.apply(new WSheet<>(response.getResult()));
}
public Object imports(MultipartFile file) {
BaseResponse baseResponse = new BaseResponse();
try {
WSheet<User> sheet = new WSheet<>(file.getBytes(), User.class, new WSheet.Validator<User>() {
@Override
public List<String> validate(User o) {
UserCreateRequest request = MapperUtil.map(o, UserCreateRequest.class);
return ValidationUtil.validate(request);
}
});
if (sheet.hasError()) {
return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-检查.xlsx");
} else {
return baseResponse;
}
} catch (IOException e) {
e.printStackTrace();
LogUtil.dumpException(e);
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件出错");
} catch (TemplateNotMatchException | ReadErrorException e) {
baseResponse.addError(ErrorType.BUSINESS_ERROR, e.getMessage());
}
return baseResponse;
}
}

@ -0,0 +1,48 @@
package ${basePackage}.action.ajax.system;
import com.fasterxml.jackson.core.TreeNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;
import ${basePackage}.frame.excel.WSheet;
import ${basePackage}.frame.utils.LogUtil;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.base.BaseResponse;
import ${basePackage}.frame.utils.ResponseUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.frame.excel.exception.ReadErrorException;
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
import ${basePackage}.module.system.ent.UserRole;
import ${basePackage}.module.system.mgr.UserRoleManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import java.io.IOException;
import java.util.List;
public class UserRoleAjax{
@Autowired
private UserRoleManager userRoleManager;
public UserRoleCreateResponse create(UserRoleCreateRequest request) {
return userRoleManager.create(request, LocalData.getToken());
}
public UserRoleDeleteResponse delete(UserRoleDeleteRequest request) {
return userRoleManager.delete(request, LocalData.getToken());
}
public UserRoleUpdateResponse update(UserRoleUpdateRequest request) {
return userRoleManager.update(request, LocalData.getToken());
}
public UserRoleFindResponse find(UserRoleFindRequest request) {
return userRoleManager.find(request, LocalData.getToken());
}
public UserRoleGetResponse get(UserRoleGetRequest request) {
return userRoleManager.get(request, LocalData.getToken());
}
}

@ -0,0 +1,33 @@
package ${basePackage}.action.api.system;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.module.system.mgr.DeptManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import org.springframework.beans.factory.annotation.Autowired;
public class DeptApi{
@Autowired
private DeptManager deptManager;
public DeptCreateResponse create(DeptCreateRequest request) {
return deptManager.create(request, LocalData.getToken());
}
public DeptDeleteResponse delete(DeptDeleteRequest request) {
return deptManager.delete(request, LocalData.getToken());
}
public DeptUpdateResponse update(DeptUpdateRequest request) {
return deptManager.update(request, LocalData.getToken());
}
public DeptFindResponse find(DeptFindRequest request) {
return deptManager.find(request, LocalData.getToken());
}
public DeptGetResponse get(DeptGetRequest request) {
return deptManager.get(request, LocalData.getToken());
}
}

@ -0,0 +1,33 @@
package ${basePackage}.action.api.system;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.module.system.mgr.RoleManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import org.springframework.beans.factory.annotation.Autowired;
public class RoleApi{
@Autowired
private RoleManager roleManager;
public RoleCreateResponse create(RoleCreateRequest request) {
return roleManager.create(request, LocalData.getToken());
}
public RoleDeleteResponse delete(RoleDeleteRequest request) {
return roleManager.delete(request, LocalData.getToken());
}
public RoleUpdateResponse update(RoleUpdateRequest request) {
return roleManager.update(request, LocalData.getToken());
}
public RoleFindResponse find(RoleFindRequest request) {
return roleManager.find(request, LocalData.getToken());
}
public RoleGetResponse get(RoleGetRequest request) {
return roleManager.get(request, LocalData.getToken());
}
}

@ -0,0 +1,33 @@
package ${basePackage}.action.api.system;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.module.system.mgr.RoleResourceManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import org.springframework.beans.factory.annotation.Autowired;
public class RoleResourceApi{
@Autowired
private RoleResourceManager roleResourceManager;
public RoleResourceCreateResponse create(RoleResourceCreateRequest request) {
return roleResourceManager.create(request, LocalData.getToken());
}
public RoleResourceDeleteResponse delete(RoleResourceDeleteRequest request) {
return roleResourceManager.delete(request, LocalData.getToken());
}
public RoleResourceUpdateResponse update(RoleResourceUpdateRequest request) {
return roleResourceManager.update(request, LocalData.getToken());
}
public RoleResourceFindResponse find(RoleResourceFindRequest request) {
return roleResourceManager.find(request, LocalData.getToken());
}
public RoleResourceGetResponse get(RoleResourceGetRequest request) {
return roleResourceManager.get(request, LocalData.getToken());
}
}

@ -0,0 +1,33 @@
package ${basePackage}.action.api.system;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.module.system.mgr.UserManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import org.springframework.beans.factory.annotation.Autowired;
public class UserApi{
@Autowired
private UserManager userManager;
public UserCreateResponse create(UserCreateRequest request) {
return userManager.create(request, LocalData.getToken());
}
public UserDeleteResponse delete(UserDeleteRequest request) {
return userManager.delete(request, LocalData.getToken());
}
public UserUpdateResponse update(UserUpdateRequest request) {
return userManager.update(request, LocalData.getToken());
}
public UserFindResponse find(UserFindRequest request) {
return userManager.find(request, LocalData.getToken());
}
public UserGetResponse get(UserGetRequest request) {
return userManager.get(request, LocalData.getToken());
}
}

@ -0,0 +1,33 @@
package ${basePackage}.action.api.system;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.module.system.mgr.UserRoleManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import org.springframework.beans.factory.annotation.Autowired;
public class UserRoleApi{
@Autowired
private UserRoleManager userRoleManager;
public UserRoleCreateResponse create(UserRoleCreateRequest request) {
return userRoleManager.create(request, LocalData.getToken());
}
public UserRoleDeleteResponse delete(UserRoleDeleteRequest request) {
return userRoleManager.delete(request, LocalData.getToken());
}
public UserRoleUpdateResponse update(UserRoleUpdateRequest request) {
return userRoleManager.update(request, LocalData.getToken());
}
public UserRoleFindResponse find(UserRoleFindRequest request) {
return userRoleManager.find(request, LocalData.getToken());
}
public UserRoleGetResponse get(UserRoleGetRequest request) {
return userRoleManager.get(request, LocalData.getToken());
}
}

@ -63,7 +63,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return super.authenticationManagerBean(); return super.authenticationManagerBean();
} }
public static class TokenFilter implements Filter { public static class TokenFilter implements Filter {
@Override @Override

@ -37,7 +37,8 @@ public class CookieUtil {
/** /**
* Cookie * Cookie
* *
* @param cookies Cookies * @param key
* @param value
* @return passportID * @return passportID
*/ */
public static Cookie newCookie(String key, String value) { public static Cookie newCookie(String key, String value) {

@ -0,0 +1,66 @@
package ${basePackage}.frame.utils;
import javax.servlet.http.HttpServletRequest;
/**
* RequestUtil
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
*/
public class RequestUtil {
/**
* IP
*
* @param request
* @return
*/
public static String getIp(HttpServletRequest request) {
String ip = request.getHeader("X-Forwarded-For");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
} else if (ip.length() > 15) {
String[] ips = ip.split(",");
for (int index = 0; index < ips.length; index++) {
String strIp = (String) ips[index];
if (!("unknown".equalsIgnoreCase(strIp))) {
ip = strIp;
break;
}
}
}
return ip;
}
/**
*
*
* @param request
* @return
*/
public static String getUserAgent(HttpServletRequest request) {
return request.getHeader("User-Agent");
}
}

@ -8,6 +8,13 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* Resource * Resource
@ -18,6 +25,48 @@ import java.io.InputStream;
*/ */
public class ResourceUtil extends ResourceUtils { public class ResourceUtil extends ResourceUtils {
/**
* : /modules/dir/
*
* @param resourcePath
* @return
*/
public static List<String> getResourceFiles(String resourcePath) {
List<String> result = new ArrayList<>();
File applicationHome = getApplicationHome();
if (applicationHome.getAbsolutePath().endsWith(".jar")) {
try {
Pattern pattern = Pattern.compile(".*" + resourcePath + "(.+\\..+)");
JarFile jarFile = new JarFile(applicationHome);
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry jarEntry = entries.nextElement();
String name = jarEntry.getName();
if (name.matches(".*" + resourcePath + "(.+\\..+)")) {
Matcher matcher = pattern.matcher(name);
if (matcher.find()) result.add(matcher.group(1));
}
}
} catch (IOException e) {
e.printStackTrace();
}
} else {
try {
ClassPathResource cpr = new ClassPathResource(resourcePath);
File in = cpr.getFile();
for (File file : in.listFiles()) {
result.add(file.getName());
}
return result;
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
}
/** /**
* jar * jar
* *

@ -10,7 +10,7 @@ import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
/** /**
* Base64Util * ResponseUtil
* *
* @author wangbing * @author wangbing
* @version 0.0.1 * @version 0.0.1

@ -8,7 +8,7 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = DictValidator.class) @Constraint(validatedBy = DictValidator.class)
public @interface Dict { public @interface Dict {
String message() default "字典错误"; String message() default "字典验证错误";
String name() default ""; String name() default "";

@ -1,5 +1,6 @@
package ${basePackage}.frame.validation; package ${basePackage}.frame.validation;
import org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorContextImpl;
import ${basePackage}.frame.auth.LocalData; import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.frame.utils.StringUtil; import ${basePackage}.frame.utils.StringUtil;
import ${basePackage}.module.system.ent.DictItem; import ${basePackage}.module.system.ent.DictItem;
@ -22,11 +23,22 @@ public class DictValidator implements ConstraintValidator<Dict, String> {
@Override @Override
public boolean isValid(String o, ConstraintValidatorContext constraintValidatorContext) { public boolean isValid(String o, ConstraintValidatorContext constraintValidatorContext) {
String messagePrefix = "";
if (constraintValidatorContext instanceof ConstraintValidatorContextImpl) {
ConstraintValidatorContextImpl validatorContext = (ConstraintValidatorContextImpl) constraintValidatorContext;
if (validatorContext.getConstraintViolationCreationContexts() != null
&& validatorContext.getConstraintViolationCreationContexts().size() > 0
&& validatorContext.getConstraintViolationCreationContexts().get(0).getPath() != null) {
messagePrefix = "[" + validatorContext.getConstraintViolationCreationContexts().get(0).getPath().asString() + "]";
}
}
if (StringUtil.isEmpty(o)) { if (StringUtil.isEmpty(o)) {
return true; return true;
} else if (name == null) { } else if (name == null) {
constraintValidatorContext.disableDefaultConstraintViolation(); constraintValidatorContext.disableDefaultConstraintViolation();
constraintValidatorContext.buildConstraintViolationWithTemplate("字典名称为空").addConstraintViolation();
constraintValidatorContext.buildConstraintViolationWithTemplate(messagePrefix + "字典名称为空").addConstraintViolation();
return false; return false;
} else { } else {
// name 字典名称 // name 字典名称
@ -37,7 +49,7 @@ public class DictValidator implements ConstraintValidator<Dict, String> {
if (dictLoadResponse.hasError()) { if (dictLoadResponse.hasError()) {
constraintValidatorContext.disableDefaultConstraintViolation(); constraintValidatorContext.disableDefaultConstraintViolation();
constraintValidatorContext.buildConstraintViolationWithTemplate("验证字典[" + name + "]值出现异常->" + dictLoadResponse.getErrors().get(0).getMessage()).addConstraintViolation(); constraintValidatorContext.buildConstraintViolationWithTemplate(messagePrefix + "验证字典[" + name + "]值出现异常->" + dictLoadResponse.getErrors().get(0).getMessage()).addConstraintViolation();
return false; return false;
} }
@ -53,7 +65,7 @@ public class DictValidator implements ConstraintValidator<Dict, String> {
return true; return true;
} else { } else {
constraintValidatorContext.disableDefaultConstraintViolation(); constraintValidatorContext.disableDefaultConstraintViolation();
constraintValidatorContext.buildConstraintViolationWithTemplate("非法的字典[" + name + "]值").addConstraintViolation(); constraintValidatorContext.buildConstraintViolationWithTemplate(messagePrefix + "不存在于字典[" + name + "]中").addConstraintViolation();
return false; return false;
} }
} }

@ -26,13 +26,13 @@ public class ${table.getCName()}CreateRequest extends BaseRequest {
* ${field.fieldComment?default("")} * ${field.fieldComment?default("")}
*/ */
<#if field.isMust && !field.fieldType?contains("String")> <#if field.isMust && !field.fieldType?contains("String")>
@NotNull(message = "${field.fieldComment?default("")}不能为NULL") @NotNull(message = "[${field.getFName()}]${field.fieldComment?default("")}不能为NULL")
</#if> </#if>
<#if field.isMust && field.fieldType?contains("String_")> <#if field.isMust && field.fieldType?contains("String_")>
@NotEmpty(message = "${field.fieldComment?default("")}不能为空") @NotEmpty(message = "[${field.getFName()}]${field.fieldComment?default("")}不能为空")
</#if> </#if>
<#if field.fieldType?contains("String_") && field.fieldType != 'String_super'> <#if field.fieldType?contains("String_") && field.fieldType != 'String_super'>
@Length(min = 0, max = ${field.fieldLength}, message = "${field.fieldComment?default("")}长度不合法(0-${field.fieldLength})") @Length(min = 0, max = ${field.fieldLength}, message = "[${field.getFName()}]${field.fieldComment?default("")}长度不合法(0-${field.fieldLength})")
</#if> </#if>
<#if field.fieldType?contains("Dict")> <#if field.fieldType?contains("Dict")>
@Dict(name = "${field.getFieldName()}") @Dict(name = "${field.getFieldName()}")

@ -16,7 +16,7 @@ public class ${table.getCName()}DeleteRequest extends BaseUpdateRequest {
/** /**
* 主键 * 主键
*/ */
@NotNull(message = "主键不能为空") @NotNull(message = "[id]主键不能为空")
private long id; private long id;
public long getId() { public long getId() {

@ -15,7 +15,7 @@ public class ${table.getCName()}GetRequest extends BaseRequest {
/** /**
* 主键 * 主键
*/ */
@NotNull(message = "主键不能为空") @NotNull(message = "[id]主键不能为空")
private long id; private long id;
public long getId() { public long getId() {

@ -26,13 +26,13 @@ public class ${table.getCName()}UpdateRequest extends BaseUpdateRequest {
* ${field.fieldComment?default("")} * ${field.fieldComment?default("")}
*/ */
<#if field.isMust && !field.fieldType?contains("String")> <#if field.isMust && !field.fieldType?contains("String")>
@NotNull(message = "${field.fieldComment?default("")}不能为NULL") @NotNull(message = "[${field.getFName()}]${field.fieldComment?default("")}不能为NULL")
</#if> </#if>
<#if field.isMust && field.fieldType?contains("String_")> <#if field.isMust && field.fieldType?contains("String_")>
@NotEmpty(message = "${field.fieldComment?default("")}不能为空") @NotEmpty(message = "[${field.getFName()}]${field.fieldComment?default("")}不能为空")
</#if> </#if>
<#if field.fieldType?contains("String_") && field.fieldType != 'String_super'> <#if field.fieldType?contains("String_") && field.fieldType != 'String_super'>
@Length(min = 0, max = ${field.fieldLength}, message = "${field.fieldComment?default("")}长度不合法(0-${field.fieldLength})") @Length(min = 0, max = ${field.fieldLength}, message = "[${field.getFName()}]${field.fieldComment?default("")}长度不合法(0-${field.fieldLength})")
</#if> </#if>
<#if field.fieldType?contains("Dict")> <#if field.fieldType?contains("Dict")>
@Dict(name = "${field.getFieldName()}") @Dict(name = "${field.getFieldName()}")

@ -0,0 +1,60 @@
package ${basePackage}.module.system.ent;
import ${basePackage}.frame.excel.annotation.ColumnDescription;
import ${basePackage}.frame.excel.annotation.ColumnName;
import ${basePackage}.frame.excel.annotation.SheetName;
import ${basePackage}.frame.base.BaseEntity;
/**
* ROLE -
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-20
*/
@SheetName("角色")
public class Role extends BaseEntity {
/**
* ROLE_NAME -
*/
@ColumnName("角色名称")
@ColumnDescription("")
private String roleName;
/**
* ROLE_CODE -
*/
@ColumnName("角色代码")
@ColumnDescription("")
private String roleCode;
/**
* ROLE_COMMENT -
*/
@ColumnName("角色描述")
@ColumnDescription("")
private String roleComment;
public String getRoleName() {
return this.roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public String getRoleCode() {
return this.roleCode;
}
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
public String getRoleComment() {
return this.roleComment;
}
public void setRoleComment(String roleComment) {
this.roleComment = roleComment;
}
}

@ -0,0 +1,38 @@
package ${basePackage}.module.system.ent;
import ${basePackage}.frame.base.BaseEntity;
/**
* ROLE_RESOURCE -
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-20
*/
public class RoleResource extends BaseEntity {
/**
* ROLE_ID -
*/
private Long roleId;
/**
* RESOURCE_ID -
*/
private Long resourceId;
public Long getRoleId() {
return this.roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getResourceId() {
return this.resourceId;
}
public void setResourceId(Long resourceId) {
this.resourceId = resourceId;
}
}

@ -9,13 +9,19 @@ import ${basePackage}.frame.base.BaseEntity;
/** /**
* TOKENS - * TOKENS -
* *
* @author author * @author wangbing
* @version 0.0.1 * @version 0.0.1
* @since 2019-12-19 * @since 2019-12-20
*/ */
@SheetName("通行证") @SheetName("通行证")
public class Tokens extends BaseEntity { public class Tokens extends BaseEntity {
/**
* TOKEN -
*/
@ColumnName("登录令牌")
@ColumnDescription("")
private String token;
/** /**
* USER_ID - * USER_ID -
*/ */
@ -83,6 +89,14 @@ public class Tokens extends BaseEntity {
@ColumnDescription("") @ColumnDescription("")
private String terminalInfo; private String terminalInfo;
public String getToken() {
return this.token;
}
public void setToken(String token) {
this.token = token;
}
public Long getUserId() { public Long getUserId() {
return this.userId; return this.userId;
} }

@ -0,0 +1,130 @@
package ${basePackage}.module.system.ent;
import ${basePackage}.frame.excel.annotation.ColumnDescription;
import ${basePackage}.frame.excel.annotation.ColumnName;
import ${basePackage}.frame.excel.annotation.SheetName;
import ${basePackage}.frame.base.BaseEntity;
/**
* USER -
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-20
*/
@SheetName("用户")
public class User extends BaseEntity {
/**
* USER_NAME -
*/
@ColumnName("用户账户")
@ColumnDescription("")
private String userName;
/**
* USER_CODE -
*/
@ColumnName("用户代码")
@ColumnDescription("")
private String userCode;
/**
* USER_ALIAS -
*/
@ColumnName("用户别名")
@ColumnDescription("")
private String userAlias;
/**
* USER_PWD -
*/
@ColumnName("用户密码")
@ColumnDescription("")
private String userPwd;
/**
* USER_STATUS -
*/
@ColumnName("用户状态")
@ColumnDescription("")
private String userStatus;
/**
* DEPT_ID -
*/
@ColumnName("部门主键")
@ColumnDescription("")
private Long deptId;
/**
* DEPT_CODE -
*/
@ColumnName("部门代码")
@ColumnDescription("")
private String deptCode;
/**
* DEPT_NAME -
*/
@ColumnName("部门名称")
@ColumnDescription("")
private String deptName;
public String getUserName() {
return this.userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserCode() {
return this.userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
public String getUserAlias() {
return this.userAlias;
}
public void setUserAlias(String userAlias) {
this.userAlias = userAlias;
}
public String getUserPwd() {
return this.userPwd;
}
public void setUserPwd(String userPwd) {
this.userPwd = userPwd;
}
public String getUserStatus() {
return this.userStatus;
}
public void setUserStatus(String userStatus) {
this.userStatus = userStatus;
}
public Long getDeptId() {
return this.deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public String getDeptCode() {
return this.deptCode;
}
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
public String getDeptName() {
return this.deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
}

@ -0,0 +1,38 @@
package ${basePackage}.module.system.ent;
import ${basePackage}.frame.base.BaseEntity;
/**
* USER_ROLE -
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-20
*/
public class UserRole extends BaseEntity {
/**
* USER_ID -
*/
private Long userId;
/**
* ROLE_ID -
*/
private Long roleId;
public Long getUserId() {
return this.userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getRoleId() {
return this.roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
}

@ -0,0 +1,60 @@
package ${basePackage}.module.system.mgr;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import ${basePackage}.frame.base.Token;
/**
*
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-20
*/
public interface RoleManager {
/**
*
*
* @param request
* @param token
* @return
*/
RoleCreateResponse create(RoleCreateRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleDeleteResponse delete(RoleDeleteRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleUpdateResponse update(RoleUpdateRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleFindResponse find(RoleFindRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleGetResponse get(RoleGetRequest request, Token token);
}

@ -0,0 +1,167 @@
package ${basePackage}.module.system.mgr;
import ${basePackage}.frame.utils.IDgenerator;
import ${basePackage}.frame.utils.Message;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.base.Token;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.module.system.ent.Role;
import ${basePackage}.module.system.mpr.RoleMapper;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* ROLE -
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-20
*/
@Transactional
@Service
public class RoleManagerImpl implements RoleManager {
@Autowired
private RoleMapper roleMapper;
/**
*
*
* @param request
* @param token
* @return
*/
public RoleCreateResponse create(RoleCreateRequest request, Token token) {
RoleCreateResponse response = new RoleCreateResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long id = IDgenerator.nextId();
Role entity = MapperUtil.map(request, Role.class);
entity.setId(id);
long result = roleMapper.insert(entity, token);
if (1L != result) {
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
return response;
}
response.setId(id);
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
public RoleDeleteResponse delete(RoleDeleteRequest request, Token token) {
RoleDeleteResponse response = new RoleDeleteResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long result = roleMapper.delete(request, token);
if (1L != result) {
response.addError(ErrorType.BUSINESS_ERROR, Message.DELETE_FAILURE);
return response;
}
response.setResult(result);
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
public RoleUpdateResponse update(RoleUpdateRequest request, Token token) {
RoleUpdateResponse response = new RoleUpdateResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long result = roleMapper.update(request, token);
if (1L != result) {
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
return response;
}
response.setResult(result);
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
@Transactional(readOnly = true)
public RoleFindResponse find(RoleFindRequest request, Token token) {
RoleFindResponse response = new RoleFindResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
if (StringUtil.isNotEmpty(request.getSortKey())) {
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
}
PageInfo<Role> pageInfo = new PageInfo<>(roleMapper.find(request, token));
response.setResult(pageInfo.getList());
response.setTotalCount(pageInfo.getTotal());
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
@Transactional(readOnly = true)
public RoleGetResponse get(RoleGetRequest request, Token token) {
RoleGetResponse response = new RoleGetResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
Role po = roleMapper.get(request, token);
if (po != null) {
response.setRole(po);
} else {
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
}
return response;
}
}

@ -0,0 +1,60 @@
package ${basePackage}.module.system.mgr;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import ${basePackage}.frame.base.Token;
/**
*
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-20
*/
public interface RoleResourceManager {
/**
*
*
* @param request
* @param token
* @return
*/
RoleResourceCreateResponse create(RoleResourceCreateRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleResourceDeleteResponse delete(RoleResourceDeleteRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleResourceUpdateResponse update(RoleResourceUpdateRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleResourceFindResponse find(RoleResourceFindRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleResourceGetResponse get(RoleResourceGetRequest request, Token token);
}

@ -0,0 +1,167 @@
package ${basePackage}.module.system.mgr;
import ${basePackage}.frame.utils.IDgenerator;
import ${basePackage}.frame.utils.Message;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.base.Token;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.module.system.ent.RoleResource;
import ${basePackage}.module.system.mpr.RoleResourceMapper;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* ROLE_RESOURCE -
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-20
*/
@Transactional
@Service
public class RoleResourceManagerImpl implements RoleResourceManager {
@Autowired
private RoleResourceMapper roleResourceMapper;
/**
*
*
* @param request
* @param token
* @return
*/
public RoleResourceCreateResponse create(RoleResourceCreateRequest request, Token token) {
RoleResourceCreateResponse response = new RoleResourceCreateResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long id = IDgenerator.nextId();
RoleResource entity = MapperUtil.map(request, RoleResource.class);
entity.setId(id);
long result = roleResourceMapper.insert(entity, token);
if (1L != result) {
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
return response;
}
response.setId(id);
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
public RoleResourceDeleteResponse delete(RoleResourceDeleteRequest request, Token token) {
RoleResourceDeleteResponse response = new RoleResourceDeleteResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long result = roleResourceMapper.delete(request, token);
if (1L != result) {
response.addError(ErrorType.BUSINESS_ERROR, Message.DELETE_FAILURE);
return response;
}
response.setResult(result);
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
public RoleResourceUpdateResponse update(RoleResourceUpdateRequest request, Token token) {
RoleResourceUpdateResponse response = new RoleResourceUpdateResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long result = roleResourceMapper.update(request, token);
if (1L != result) {
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
return response;
}
response.setResult(result);
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
@Transactional(readOnly = true)
public RoleResourceFindResponse find(RoleResourceFindRequest request, Token token) {
RoleResourceFindResponse response = new RoleResourceFindResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
if (StringUtil.isNotEmpty(request.getSortKey())) {
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
}
PageInfo<RoleResource> pageInfo = new PageInfo<>(roleResourceMapper.find(request, token));
response.setResult(pageInfo.getList());
response.setTotalCount(pageInfo.getTotal());
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
@Transactional(readOnly = true)
public RoleResourceGetResponse get(RoleResourceGetRequest request, Token token) {
RoleResourceGetResponse response = new RoleResourceGetResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
RoleResource po = roleResourceMapper.get(request, token);
if (po != null) {
response.setRoleResource(po);
} else {
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
}
return response;
}
}

@ -0,0 +1,60 @@
package ${basePackage}.module.system.mgr;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import ${basePackage}.frame.base.Token;
/**
*
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-20
*/
public interface UserManager {
/**
*
*
* @param request
* @param token
* @return
*/
UserCreateResponse create(UserCreateRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
UserDeleteResponse delete(UserDeleteRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
UserUpdateResponse update(UserUpdateRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
UserFindResponse find(UserFindRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
UserGetResponse get(UserGetRequest request, Token token);
}

@ -0,0 +1,167 @@
package ${basePackage}.module.system.mgr;
import ${basePackage}.frame.utils.IDgenerator;
import ${basePackage}.frame.utils.Message;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.base.Token;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.module.system.ent.User;
import ${basePackage}.module.system.mpr.UserMapper;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* USER -
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-20
*/
@Transactional
@Service
public class UserManagerImpl implements UserManager {
@Autowired
private UserMapper userMapper;
/**
*
*
* @param request
* @param token
* @return
*/
public UserCreateResponse create(UserCreateRequest request, Token token) {
UserCreateResponse response = new UserCreateResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long id = IDgenerator.nextId();
User entity = MapperUtil.map(request, User.class);
entity.setId(id);
long result = userMapper.insert(entity, token);
if (1L != result) {
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
return response;
}
response.setId(id);
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
public UserDeleteResponse delete(UserDeleteRequest request, Token token) {
UserDeleteResponse response = new UserDeleteResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long result = userMapper.delete(request, token);
if (1L != result) {
response.addError(ErrorType.BUSINESS_ERROR, Message.DELETE_FAILURE);
return response;
}
response.setResult(result);
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
public UserUpdateResponse update(UserUpdateRequest request, Token token) {
UserUpdateResponse response = new UserUpdateResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long result = userMapper.update(request, token);
if (1L != result) {
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
return response;
}
response.setResult(result);
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
@Transactional(readOnly = true)
public UserFindResponse find(UserFindRequest request, Token token) {
UserFindResponse response = new UserFindResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
if (StringUtil.isNotEmpty(request.getSortKey())) {
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
}
PageInfo<User> pageInfo = new PageInfo<>(userMapper.find(request, token));
response.setResult(pageInfo.getList());
response.setTotalCount(pageInfo.getTotal());
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
@Transactional(readOnly = true)
public UserGetResponse get(UserGetRequest request, Token token) {
UserGetResponse response = new UserGetResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
User po = userMapper.get(request, token);
if (po != null) {
response.setUser(po);
} else {
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
}
return response;
}
}

@ -0,0 +1,60 @@
package ${basePackage}.module.system.mgr;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import ${basePackage}.frame.base.Token;
/**
*
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-20
*/
public interface UserRoleManager {
/**
*
*
* @param request
* @param token
* @return
*/
UserRoleCreateResponse create(UserRoleCreateRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
UserRoleDeleteResponse delete(UserRoleDeleteRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
UserRoleUpdateResponse update(UserRoleUpdateRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
UserRoleFindResponse find(UserRoleFindRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
UserRoleGetResponse get(UserRoleGetRequest request, Token token);
}

@ -0,0 +1,167 @@
package ${basePackage}.module.system.mgr;
import ${basePackage}.frame.utils.IDgenerator;
import ${basePackage}.frame.utils.Message;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.base.Token;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.module.system.ent.UserRole;
import ${basePackage}.module.system.mpr.UserRoleMapper;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* USER_ROLE -
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-20
*/
@Transactional
@Service
public class UserRoleManagerImpl implements UserRoleManager {
@Autowired
private UserRoleMapper userRoleMapper;
/**
*
*
* @param request
* @param token
* @return
*/
public UserRoleCreateResponse create(UserRoleCreateRequest request, Token token) {
UserRoleCreateResponse response = new UserRoleCreateResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long id = IDgenerator.nextId();
UserRole entity = MapperUtil.map(request, UserRole.class);
entity.setId(id);
long result = userRoleMapper.insert(entity, token);
if (1L != result) {
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
return response;
}
response.setId(id);
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
public UserRoleDeleteResponse delete(UserRoleDeleteRequest request, Token token) {
UserRoleDeleteResponse response = new UserRoleDeleteResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long result = userRoleMapper.delete(request, token);
if (1L != result) {
response.addError(ErrorType.BUSINESS_ERROR, Message.DELETE_FAILURE);
return response;
}
response.setResult(result);
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
public UserRoleUpdateResponse update(UserRoleUpdateRequest request, Token token) {
UserRoleUpdateResponse response = new UserRoleUpdateResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long result = userRoleMapper.update(request, token);
if (1L != result) {
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
return response;
}
response.setResult(result);
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
@Transactional(readOnly = true)
public UserRoleFindResponse find(UserRoleFindRequest request, Token token) {
UserRoleFindResponse response = new UserRoleFindResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
if (StringUtil.isNotEmpty(request.getSortKey())) {
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
}
PageInfo<UserRole> pageInfo = new PageInfo<>(userRoleMapper.find(request, token));
response.setResult(pageInfo.getList());
response.setTotalCount(pageInfo.getTotal());
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
@Transactional(readOnly = true)
public UserRoleGetResponse get(UserRoleGetRequest request, Token token) {
UserRoleGetResponse response = new UserRoleGetResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
UserRole po = userRoleMapper.get(request, token);
if (po != null) {
response.setUserRole(po);
} else {
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
}
return response;
}
}

@ -0,0 +1,74 @@
package ${basePackage}.module.system.mpr;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import ${basePackage}.module.system.ent.Role;
import ${basePackage}.module.system.req.*;
import ${basePackage}.frame.base.Token;
/**
* ROLE -
*
* @author wangbing
* @date 2019-12-20
*/
@Mapper
public interface RoleMapper {
/**
*
*
* @param request
* @param token
* @return
*/
long insert(@Param("request") Role request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long insertBatch(@Param("list") List<Role> request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long delete(@Param("request") RoleDeleteRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long update(@Param("request") RoleUpdateRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
List<Role> find(@Param("request") RoleFindRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
Role get(@Param("request") RoleGetRequest request, @Param("token") Token token);
}

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${basePackage}.module.system.mpr.RoleMapper">
<sql id="table">`SYS_ROLE`</sql>
<sql id="entityColumnList">
`ID`,`ROLE_NAME`,`ROLE_CODE`,`ROLE_COMMENT`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME`
</sql>
<resultMap id="role" type="${basePackage}.module.system.ent.Role">
<result column="ID" jdbcType="BIGINT" property="id"/>
<result column="ROLE_NAME" jdbcType="VARCHAR" property="roleName"/>
<result column="ROLE_CODE" jdbcType="VARCHAR" property="roleCode"/>
<result column="ROLE_COMMENT" jdbcType="VARCHAR" property="roleComment"/>
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
</resultMap>
<select id="find" resultMap="role">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
<if test="request.roleName != null and request.roleName != ''">
AND `ROLE_NAME` = ${r"#"}{request.roleName}
</if>
<if test="request.roleCode != null and request.roleCode != ''">
AND `ROLE_CODE` = ${r"#"}{request.roleCode}
</if>
<if test="request.roleComment != null and request.roleComment != ''">
AND `ROLE_COMMENT` = ${r"#"}{request.roleComment}
</if>
</select>
<select id="search" resultMap="role">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
<if test="request.keyword != null and request.keyword != ''">
1 = 2
</if>
</select>
<insert id="insert">
INSERT INTO
<include refid="table"/>
(
<include refid="entityColumnList"/>
)
VALUES
(
${r"#"}{request.id},
${r"#"}{request.roleName,jdbcType=VARCHAR},
${r"#"}{request.roleCode,jdbcType=VARCHAR},
${r"#"}{request.roleComment,jdbcType=VARCHAR},
0,
0,
${r"#"}{token.userId,jdbcType=NUMERIC},
sysdate(),
NULL,
NULL
)
</insert>
<insert id="insertBatch">
INSERT INTO
<include refid="table"/>
(
<include refid="entityColumnList"/>
)
VALUES
<foreach collection="list" item= "item" index ="index" separator=",">
(
${r"#"}{item.id},
${r"#"}{item.roleName,jdbcType=VARCHAR},
${r"#"}{item.roleCode,jdbcType=VARCHAR},
${r"#"}{item.roleComment,jdbcType=VARCHAR},
0,
0,
${r"#"}{token.userId,jdbcType=NUMERIC},
sysdate(),
NULL,
NULL
)
</foreach >
</insert>
<update id="delete">
UPDATE
<include refid="table"/>
SET `IS_DELETED` = 1
WHERE `IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
</update>
<update id="update">
UPDATE
<include refid="table"/>
SET
`ROLE_NAME` = ${r"#"}{request.roleName,jdbcType=VARCHAR},
`ROLE_CODE` = ${r"#"}{request.roleCode,jdbcType=VARCHAR},
`ROLE_COMMENT` = ${r"#"}{request.roleComment,jdbcType=VARCHAR},
`ROW_VERSION` = `ROW_VERSION` + 1,
`LAST_UPDATE_BY` = ${r"#"}{token.userId},
`LAST_UPDATE_TIME` = sysdate()
WHERE
`IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
AND `ROW_VERSION` = ${r"#"}{request.rowVersion}
</update>
<select id="get" resultMap="role">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
</select>
</mapper>

@ -0,0 +1,74 @@
package ${basePackage}.module.system.mpr;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import ${basePackage}.module.system.ent.RoleResource;
import ${basePackage}.module.system.req.*;
import ${basePackage}.frame.base.Token;
/**
* ROLE_RESOURCE -
*
* @author wangbing
* @date 2019-12-20
*/
@Mapper
public interface RoleResourceMapper {
/**
*
*
* @param request
* @param token
* @return
*/
long insert(@Param("request") RoleResource request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long insertBatch(@Param("list") List<RoleResource> request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long delete(@Param("request") RoleResourceDeleteRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long update(@Param("request") RoleResourceUpdateRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
List<RoleResource> find(@Param("request") RoleResourceFindRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleResource get(@Param("request") RoleResourceGetRequest request, @Param("token") Token token);
}

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${basePackage}.module.system.mpr.RoleResourceMapper">
<sql id="table">`SYS_ROLE_RESOURCE`</sql>
<sql id="entityColumnList">
`ID`,`ROLE_ID`,`RESOURCE_ID`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME`
</sql>
<resultMap id="roleResource" type="${basePackage}.module.system.ent.RoleResource">
<result column="ID" jdbcType="BIGINT" property="id"/>
<result column="ROLE_ID" jdbcType="BIGINT" property="roleId"/>
<result column="RESOURCE_ID" jdbcType="BIGINT" property="resourceId"/>
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
</resultMap>
<select id="find" resultMap="roleResource">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
<if test="request.roleId != null and request.roleId != 0">
AND `ROLE_ID` = ${r"#"}{request.roleId}
</if>
<if test="request.resourceId != null and request.resourceId != 0">
AND `RESOURCE_ID` = ${r"#"}{request.resourceId}
</if>
</select>
<select id="search" resultMap="roleResource">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
<if test="request.keyword != null and request.keyword != ''">
1 = 2
</if>
</select>
<insert id="insert">
INSERT INTO
<include refid="table"/>
(
<include refid="entityColumnList"/>
)
VALUES
(
${r"#"}{request.id},
${r"#"}{request.roleId,jdbcType=BIGINT},
${r"#"}{request.resourceId,jdbcType=BIGINT},
0,
0,
${r"#"}{token.userId,jdbcType=NUMERIC},
sysdate(),
NULL,
NULL
)
</insert>
<insert id="insertBatch">
INSERT INTO
<include refid="table"/>
(
<include refid="entityColumnList"/>
)
VALUES
<foreach collection="list" item= "item" index ="index" separator=",">
(
${r"#"}{item.id},
${r"#"}{item.roleId,jdbcType=BIGINT},
${r"#"}{item.resourceId,jdbcType=BIGINT},
0,
0,
${r"#"}{token.userId,jdbcType=NUMERIC},
sysdate(),
NULL,
NULL
)
</foreach >
</insert>
<update id="delete">
UPDATE
<include refid="table"/>
SET `IS_DELETED` = 1
WHERE `IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
</update>
<update id="update">
UPDATE
<include refid="table"/>
SET
`ROLE_ID` = ${r"#"}{request.roleId,jdbcType=BIGINT},
`RESOURCE_ID` = ${r"#"}{request.resourceId,jdbcType=BIGINT},
`ROW_VERSION` = `ROW_VERSION` + 1,
`LAST_UPDATE_BY` = ${r"#"}{token.userId},
`LAST_UPDATE_TIME` = sysdate()
WHERE
`IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
AND `ROW_VERSION` = ${r"#"}{request.rowVersion}
</update>
<select id="get" resultMap="roleResource">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
</select>
</mapper>

@ -7,11 +7,12 @@
<sql id="table">`SYS_TOKENS`</sql> <sql id="table">`SYS_TOKENS`</sql>
<sql id="entityColumnList"> <sql id="entityColumnList">
`ID`,`USER_ID`,`USER_NAME`,`LOGIN_TIME`,`VALID_TIME`,`VALID`,`DEPT_ID`,`DEPT_CODE`,`DEPT_NAME`,`TERMINAL_TYPE`,`TERMINAL_IP`,`TERMINAL_INFO`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME` `ID`,`TOKEN`,`USER_ID`,`USER_NAME`,`LOGIN_TIME`,`VALID_TIME`,`VALID`,`DEPT_ID`,`DEPT_CODE`,`DEPT_NAME`,`TERMINAL_TYPE`,`TERMINAL_IP`,`TERMINAL_INFO`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME`
</sql> </sql>
<resultMap id="tokens" type="${basePackage}.module.system.ent.Tokens"> <resultMap id="tokens" type="${basePackage}.module.system.ent.Tokens">
<result column="ID" jdbcType="BIGINT" property="id"/> <result column="ID" jdbcType="BIGINT" property="id"/>
<result column="TOKEN" jdbcType="VARCHAR" property="token"/>
<result column="USER_ID" jdbcType="BIGINT" property="userId"/> <result column="USER_ID" jdbcType="BIGINT" property="userId"/>
<result column="USER_NAME" jdbcType="VARCHAR" property="userName"/> <result column="USER_NAME" jdbcType="VARCHAR" property="userName"/>
<result column="LOGIN_TIME" jdbcType="TIMESTAMP" property="loginTime"/> <result column="LOGIN_TIME" jdbcType="TIMESTAMP" property="loginTime"/>
@ -38,6 +39,9 @@
<include refid="table"/> <include refid="table"/>
WHERE WHERE
`IS_DELETED` = 0 `IS_DELETED` = 0
<if test="request.token != null and request.token != ''">
AND `TOKEN` = ${r"#"}{request.token}
</if>
<if test="request.userId != null and request.userId != 0"> <if test="request.userId != null and request.userId != 0">
AND `USER_ID` = ${r"#"}{request.userId} AND `USER_ID` = ${r"#"}{request.userId}
</if> </if>
@ -94,6 +98,7 @@
VALUES VALUES
( (
${r"#"}{request.id}, ${r"#"}{request.id},
${r"#"}{request.token,jdbcType=VARCHAR},
${r"#"}{request.userId,jdbcType=BIGINT}, ${r"#"}{request.userId,jdbcType=BIGINT},
${r"#"}{request.userName,jdbcType=VARCHAR}, ${r"#"}{request.userName,jdbcType=VARCHAR},
${r"#"}{request.loginTime,jdbcType=TIMESTAMP}, ${r"#"}{request.loginTime,jdbcType=TIMESTAMP},
@ -124,6 +129,7 @@
<foreach collection="list" item= "item" index ="index" separator=","> <foreach collection="list" item= "item" index ="index" separator=",">
( (
${r"#"}{item.id}, ${r"#"}{item.id},
${r"#"}{item.token,jdbcType=VARCHAR},
${r"#"}{item.userId,jdbcType=BIGINT}, ${r"#"}{item.userId,jdbcType=BIGINT},
${r"#"}{item.userName,jdbcType=VARCHAR}, ${r"#"}{item.userName,jdbcType=VARCHAR},
${r"#"}{item.loginTime,jdbcType=TIMESTAMP}, ${r"#"}{item.loginTime,jdbcType=TIMESTAMP},
@ -157,6 +163,7 @@
UPDATE UPDATE
<include refid="table"/> <include refid="table"/>
SET SET
`TOKEN` = ${r"#"}{request.token,jdbcType=VARCHAR},
`USER_ID` = ${r"#"}{request.userId,jdbcType=BIGINT}, `USER_ID` = ${r"#"}{request.userId,jdbcType=BIGINT},
`USER_NAME` = ${r"#"}{request.userName,jdbcType=VARCHAR}, `USER_NAME` = ${r"#"}{request.userName,jdbcType=VARCHAR},
`LOGIN_TIME` = ${r"#"}{request.loginTime,jdbcType=TIMESTAMP}, `LOGIN_TIME` = ${r"#"}{request.loginTime,jdbcType=TIMESTAMP},

@ -0,0 +1,74 @@
package ${basePackage}.module.system.mpr;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import ${basePackage}.module.system.ent.User;
import ${basePackage}.module.system.req.*;
import ${basePackage}.frame.base.Token;
/**
* USER -
*
* @author wangbing
* @date 2019-12-20
*/
@Mapper
public interface UserMapper {
/**
*
*
* @param request
* @param token
* @return
*/
long insert(@Param("request") User request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long insertBatch(@Param("list") List<User> request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long delete(@Param("request") UserDeleteRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long update(@Param("request") UserUpdateRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
List<User> find(@Param("request") UserFindRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
User get(@Param("request") UserGetRequest request, @Param("token") Token token);
}

@ -0,0 +1,165 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${basePackage}.module.system.mpr.UserMapper">
<sql id="table">`SYS_USER`</sql>
<sql id="entityColumnList">
`ID`,`USER_NAME`,`USER_CODE`,`USER_ALIAS`,`USER_PWD`,`USER_STATUS`,`DEPT_ID`,`DEPT_CODE`,`DEPT_NAME`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME`
</sql>
<resultMap id="user" type="${basePackage}.module.system.ent.User">
<result column="ID" jdbcType="BIGINT" property="id"/>
<result column="USER_NAME" jdbcType="VARCHAR" property="userName"/>
<result column="USER_CODE" jdbcType="VARCHAR" property="userCode"/>
<result column="USER_ALIAS" jdbcType="VARCHAR" property="userAlias"/>
<result column="USER_PWD" jdbcType="VARCHAR" property="userPwd"/>
<result column="USER_STATUS" jdbcType="VARCHAR" property="userStatus"/>
<result column="DEPT_ID" jdbcType="BIGINT" property="deptId"/>
<result column="DEPT_CODE" jdbcType="VARCHAR" property="deptCode"/>
<result column="DEPT_NAME" jdbcType="VARCHAR" property="deptName"/>
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
</resultMap>
<select id="find" resultMap="user">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
<if test="request.userName != null and request.userName != ''">
AND `USER_NAME` = ${r"#"}{request.userName}
</if>
<if test="request.userCode != null and request.userCode != ''">
AND `USER_CODE` = ${r"#"}{request.userCode}
</if>
<if test="request.userAlias != null and request.userAlias != ''">
AND `USER_ALIAS` = ${r"#"}{request.userAlias}
</if>
<if test="request.userStatus != null and request.userStatus != ''">
AND `USER_STATUS` = ${r"#"}{request.userStatus}
</if>
<if test="request.deptId != null and request.deptId != 0">
AND `DEPT_ID` = ${r"#"}{request.deptId}
</if>
<if test="request.deptCode != null and request.deptCode != ''">
AND `DEPT_CODE` = ${r"#"}{request.deptCode}
</if>
<if test="request.deptName != null and request.deptName != ''">
AND `DEPT_NAME` = ${r"#"}{request.deptName}
</if>
</select>
<select id="search" resultMap="user">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
<if test="request.keyword != null and request.keyword != ''">
1 = 2
</if>
</select>
<insert id="insert">
INSERT INTO
<include refid="table"/>
(
<include refid="entityColumnList"/>
)
VALUES
(
${r"#"}{request.id},
${r"#"}{request.userName,jdbcType=VARCHAR},
${r"#"}{request.userCode,jdbcType=VARCHAR},
${r"#"}{request.userAlias,jdbcType=VARCHAR},
${r"#"}{request.userPwd,jdbcType=VARCHAR},
${r"#"}{request.userStatus,jdbcType=VARCHAR},
${r"#"}{request.deptId,jdbcType=BIGINT},
${r"#"}{request.deptCode,jdbcType=VARCHAR},
${r"#"}{request.deptName,jdbcType=VARCHAR},
0,
0,
${r"#"}{token.userId,jdbcType=NUMERIC},
sysdate(),
NULL,
NULL
)
</insert>
<insert id="insertBatch">
INSERT INTO
<include refid="table"/>
(
<include refid="entityColumnList"/>
)
VALUES
<foreach collection="list" item= "item" index ="index" separator=",">
(
${r"#"}{item.id},
${r"#"}{item.userName,jdbcType=VARCHAR},
${r"#"}{item.userCode,jdbcType=VARCHAR},
${r"#"}{item.userAlias,jdbcType=VARCHAR},
${r"#"}{item.userPwd,jdbcType=VARCHAR},
${r"#"}{item.userStatus,jdbcType=VARCHAR},
${r"#"}{item.deptId,jdbcType=BIGINT},
${r"#"}{item.deptCode,jdbcType=VARCHAR},
${r"#"}{item.deptName,jdbcType=VARCHAR},
0,
0,
${r"#"}{token.userId,jdbcType=NUMERIC},
sysdate(),
NULL,
NULL
)
</foreach >
</insert>
<update id="delete">
UPDATE
<include refid="table"/>
SET `IS_DELETED` = 1
WHERE `IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
</update>
<update id="update">
UPDATE
<include refid="table"/>
SET
`USER_NAME` = ${r"#"}{request.userName,jdbcType=VARCHAR},
`USER_CODE` = ${r"#"}{request.userCode,jdbcType=VARCHAR},
`USER_ALIAS` = ${r"#"}{request.userAlias,jdbcType=VARCHAR},
`USER_PWD` = ${r"#"}{request.userPwd,jdbcType=VARCHAR},
`USER_STATUS` = ${r"#"}{request.userStatus,jdbcType=VARCHAR},
`DEPT_ID` = ${r"#"}{request.deptId,jdbcType=BIGINT},
`DEPT_CODE` = ${r"#"}{request.deptCode,jdbcType=VARCHAR},
`DEPT_NAME` = ${r"#"}{request.deptName,jdbcType=VARCHAR},
`ROW_VERSION` = `ROW_VERSION` + 1,
`LAST_UPDATE_BY` = ${r"#"}{token.userId},
`LAST_UPDATE_TIME` = sysdate()
WHERE
`IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
AND `ROW_VERSION` = ${r"#"}{request.rowVersion}
</update>
<select id="get" resultMap="user">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
</select>
</mapper>

@ -0,0 +1,74 @@
package ${basePackage}.module.system.mpr;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import ${basePackage}.module.system.ent.UserRole;
import ${basePackage}.module.system.req.*;
import ${basePackage}.frame.base.Token;
/**
* USER_ROLE -
*
* @author wangbing
* @date 2019-12-20
*/
@Mapper
public interface UserRoleMapper {
/**
*
*
* @param request
* @param token
* @return
*/
long insert(@Param("request") UserRole request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long insertBatch(@Param("list") List<UserRole> request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long delete(@Param("request") UserRoleDeleteRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long update(@Param("request") UserRoleUpdateRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
List<UserRole> find(@Param("request") UserRoleFindRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
UserRole get(@Param("request") UserRoleGetRequest request, @Param("token") Token token);
}

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${basePackage}.module.system.mpr.UserRoleMapper">
<sql id="table">`SYS_USER_ROLE`</sql>
<sql id="entityColumnList">
`ID`,`USER_ID`,`ROLE_ID`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME`
</sql>
<resultMap id="userRole" type="${basePackage}.module.system.ent.UserRole">
<result column="ID" jdbcType="BIGINT" property="id"/>
<result column="USER_ID" jdbcType="BIGINT" property="userId"/>
<result column="ROLE_ID" jdbcType="BIGINT" property="roleId"/>
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
</resultMap>
<select id="find" resultMap="userRole">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
<if test="request.userId != null and request.userId != 0">
AND `USER_ID` = ${r"#"}{request.userId}
</if>
<if test="request.roleId != null and request.roleId != 0">
AND `ROLE_ID` = ${r"#"}{request.roleId}
</if>
</select>
<select id="search" resultMap="userRole">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
<if test="request.keyword != null and request.keyword != ''">
1 = 2
</if>
</select>
<insert id="insert">
INSERT INTO
<include refid="table"/>
(
<include refid="entityColumnList"/>
)
VALUES
(
${r"#"}{request.id},
${r"#"}{request.userId,jdbcType=BIGINT},
${r"#"}{request.roleId,jdbcType=BIGINT},
0,
0,
${r"#"}{token.userId,jdbcType=NUMERIC},
sysdate(),
NULL,
NULL
)
</insert>
<insert id="insertBatch">
INSERT INTO
<include refid="table"/>
(
<include refid="entityColumnList"/>
)
VALUES
<foreach collection="list" item= "item" index ="index" separator=",">
(
${r"#"}{item.id},
${r"#"}{item.userId,jdbcType=BIGINT},
${r"#"}{item.roleId,jdbcType=BIGINT},
0,
0,
${r"#"}{token.userId,jdbcType=NUMERIC},
sysdate(),
NULL,
NULL
)
</foreach >
</insert>
<update id="delete">
UPDATE
<include refid="table"/>
SET `IS_DELETED` = 1
WHERE `IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
</update>
<update id="update">
UPDATE
<include refid="table"/>
SET
`USER_ID` = ${r"#"}{request.userId,jdbcType=BIGINT},
`ROLE_ID` = ${r"#"}{request.roleId,jdbcType=BIGINT},
`ROW_VERSION` = `ROW_VERSION` + 1,
`LAST_UPDATE_BY` = ${r"#"}{token.userId},
`LAST_UPDATE_TIME` = sysdate()
WHERE
`IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
AND `ROW_VERSION` = ${r"#"}{request.rowVersion}
</update>
<select id="get" resultMap="userRole">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
</select>
</mapper>

@ -2,6 +2,8 @@ package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseRequest; import ${basePackage}.frame.base.BaseRequest;
import javax.validation.constraints.NotBlank;
/** /**
* AuthLoginRequest - * AuthLoginRequest -
* *
@ -11,4 +13,25 @@ import ${basePackage}.frame.base.BaseRequest;
*/ */
public class AuthLoginRequest extends BaseRequest { public class AuthLoginRequest extends BaseRequest {
@NotBlank(message = "[username]用户名不能为空")
private String username;
@NotBlank(message = "[password]用户密码不能为空")
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
} }

@ -2,7 +2,7 @@ package ${basePackage}.module.system.req;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import ${basePackage}.frame.base.BaseRequest; import ${basePackage}.frame.base.BaseRequest;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
/** /**
@ -17,28 +17,28 @@ public class DictCreateRequest extends BaseRequest {
/** /**
* *
*/ */
@NotEmpty(message = "字典名称不能为空") @NotBlank(message = "[dictName]字典名称不能为空")
@Length(min = 1, max = 50, message = "字典名称长度不合法(1-50)") @Length(min = 1, max = 50, message = "字典名称长度不合法(1-50)")
private String dictName; private String dictName;
/** /**
* *
*/ */
@NotEmpty(message = "字典描述不能为空") @NotBlank(message = "[dictComment]字典描述不能为空")
@Length(min = 1, max = 50, message = "字典描述长度不合法(1-50)") @Length(min = 1, max = 50, message = "字典描述长度不合法(1-50)")
private String dictComment; private String dictComment;
/** /**
* *
*/ */
@NotEmpty(message = "字典版本不能为空") @NotBlank(message = "[version]字典版本不能为空")
@Length(min = 1, max = 50, message = "字典版本长度不合法(1-50)") @Length(min = 1, max = 50, message = "字典版本长度不合法(1-50)")
private String version; private String version;
/** /**
* *
*/ */
@NotNull(message = "是否有效不能为NULL") @NotNull(message = "[valid]是否有效不能为NULL")
private Boolean valid; private Boolean valid;
public String getDictName() { public String getDictName() {

@ -16,7 +16,7 @@ public class DictDeleteRequest extends BaseUpdateRequest {
/** /**
* *
*/ */
@NotNull(message = "主键不能为空") @NotNull(message = "[id]主键不能为空")
private long id; private long id;
public long getId() { public long getId() {

@ -16,7 +16,7 @@ public class DictGetRequest extends BaseRequest {
/** /**
* *
*/ */
@NotNull(message = "主键不能为空") @NotNull(message = "[id]主键不能为空")
private long id; private long id;
public long getId() { public long getId() {

@ -17,31 +17,31 @@ public class DictItemCreateRequest extends BaseRequest {
/** /**
* *
*/ */
@NotNull(message = "字典名称不能为空") @NotNull(message = "[dictName]字典名称不能为空")
private String dictName; private String dictName;
/** /**
* *
*/ */
@Length(min = 1, max = 10, message = "字典键长度不合法(1-10)") @Length(min = 1, max = 10, message = "[key]字典键长度不合法(1-10)")
private String key; private String key;
/** /**
* *
*/ */
@Length(min = 1, max = 100, message = "字典值长度不合法(1-100)") @Length(min = 1, max = 100, message = "[value]字典值长度不合法(1-100)")
private String value; private String value;
/** /**
* *
*/ */
@NotNull(message = "字典项排序值不能为空") @NotNull(message = "[sort]字典项排序值不能为空")
private Integer sort; private Integer sort;
/** /**
* *
*/ */
@NotNull(message = "是否有效不能为空") @NotNull(message = "[valid]是否有效不能为空")
private Boolean valid; private Boolean valid;
public String getDictName() { public String getDictName() {

@ -16,7 +16,7 @@ public class DictItemDeleteRequest extends BaseUpdateRequest {
/** /**
* *
*/ */
@NotNull(message = "主键不能为空") @NotNull(message = "[id]主键不能为空")
private long id; private long id;
public long getId() { public long getId() {

@ -16,7 +16,7 @@ public class DictItemGetRequest extends BaseRequest {
/** /**
* *
*/ */
@NotNull(message = "主键不能为空") @NotNull(message = "[id]主键不能为空")
private long id; private long id;
public long getId() { public long getId() {

@ -17,31 +17,31 @@ public class DictItemUpdateRequest extends BaseUpdateRequest {
/** /**
* *
*/ */
@NotNull(message = "主键不能为NULL") @NotNull(message = "[id]主键不能为NULL")
private Long id; private Long id;
/** /**
* *
*/ */
@Length(min = 0, max = 10, message = "字典键长度不合法(0-10)") @Length(min = 0, max = 10, message = "[key]字典键长度不合法(0-10)")
private String key; private String key;
/** /**
* *
*/ */
@Length(min = 0, max = 100, message = "字典值长度不合法(0-100)") @Length(min = 0, max = 100, message = "[value]字典值长度不合法(0-100)")
private String value; private String value;
/** /**
* *
*/ */
@NotNull(message = "字典项排序值不能为空") @NotNull(message = "[sort]字典项排序值不能为空")
private Integer sort; private Integer sort;
/** /**
* *
*/ */
@NotNull(message = "是否有效不能为空") @NotNull(message = "[valid]是否有效不能为空")
private Boolean valid; private Boolean valid;
public Long getId() { public Long getId() {

@ -14,7 +14,7 @@ import javax.validation.constraints.NotNull;
*/ */
public class DictLoadRequest extends BaseRequest { public class DictLoadRequest extends BaseRequest {
@NotBlank(message = "字典名称不能为空") @NotBlank(message = "[dictName]字典名称不能为空")
private String dictName; private String dictName;
public String getDictName() { public String getDictName() {

@ -3,7 +3,7 @@ package ${basePackage}.module.system.req;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import ${basePackage}.frame.base.BaseUpdateRequest; import ${basePackage}.frame.base.BaseUpdateRequest;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
/** /**
@ -18,34 +18,34 @@ public class DictUpdateRequest extends BaseUpdateRequest {
/** /**
* *
*/ */
@NotNull(message = "主键不能为NULL") @NotNull(message = "[id]主键不能为NULL")
private Long id; private Long id;
/** /**
* *
*/ */
@NotEmpty(message = "字典名称不能为空") @NotBlank(message = "[dictName]字典名称不能为空")
@Length(min = 0, max = 50, message = "字典名称长度不合法(0-50)") @Length(min = 0, max = 50, message = "[dictName]字典名称长度不合法(0-50)")
private String dictName; private String dictName;
/** /**
* *
*/ */
@NotEmpty(message = "字典描述不能为空") @NotBlank(message = "[dictComment]字典描述不能为空")
@Length(min = 0, max = 50, message = "字典描述长度不合法(0-50)") @Length(min = 0, max = 50, message = "[dictComment]字典描述长度不合法(0-50)")
private String dictComment; private String dictComment;
/** /**
* *
*/ */
@NotEmpty(message = "字典版本不能为空") @NotBlank(message = "[version]字典版本不能为空")
@Length(min = 0, max = 50, message = "字典版本长度不合法(0-50)") @Length(min = 0, max = 50, message = "[version]字典版本长度不合法(0-50)")
private String version; private String version;
/** /**
* *
*/ */
@NotNull(message = "是否有效不能为NULL") @NotNull(message = "[valid]是否有效不能为NULL")
private Boolean valid; private Boolean valid;
public Long getId() { public Long getId() {

@ -3,7 +3,7 @@ package ${basePackage}.module.system.req;
import ${basePackage}.frame.validation.Dict; import ${basePackage}.frame.validation.Dict;
import ${basePackage}.frame.base.BaseRequest; import ${basePackage}.frame.base.BaseRequest;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotBlank;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
/** /**
@ -18,7 +18,7 @@ public class FileCreateRequest extends BaseRequest {
/** /**
* *
*/ */
@NotEmpty(message = "文件名称不能为空") @NotBlank(message = "[name]文件名称不能为空")
@Length(min = 0, max = 255, message = "文件名称长度不合法(0-255)") @Length(min = 0, max = 255, message = "文件名称长度不合法(0-255)")
private String name; private String name;
@ -31,19 +31,19 @@ public class FileCreateRequest extends BaseRequest {
/** /**
* 1 * 1
*/ */
@Length(min = 0, max = 50, message = "扩展属性1长度不合法(0-50)") @Length(min = 0, max = 50, message = "[attribute1]扩展属性1长度不合法(0-50)")
private String attribute1; private String attribute1;
/** /**
* 2 * 2
*/ */
@Length(min = 0, max = 50, message = "扩展属性2长度不合法(0-50)") @Length(min = 0, max = 50, message = "[attribute2]扩展属性2长度不合法(0-50)")
private String attribute2; private String attribute2;
/** /**
* *
*/ */
@Length(min = 0, max = 500, message = "存放地址长度不合法(0-500)") @Length(min = 0, max = 500, message = "[location]存放地址长度不合法(0-500)")
private String location; private String location;
/** /**
@ -55,7 +55,7 @@ public class FileCreateRequest extends BaseRequest {
/** /**
* *
*/ */
@Length(min = 0, max = 500, message = "下载地址长度不合法(0-500)") @Length(min = 0, max = 500, message = "[urlDownload]下载地址长度不合法(0-500)")
private String urlDownload; private String urlDownload;
public String getName() { public String getName() {

@ -15,7 +15,7 @@ public class FileDeleteRequest extends BaseUpdateRequest {
/** /**
* *
*/ */
@NotNull(message = "主键不能为空") @NotNull(message = "[id]主键不能为空")
private long id; private long id;
public long getId() { public long getId() {

@ -16,7 +16,7 @@ public class FileDownloadRequest extends BaseRequest {
/** /**
* ID * ID
*/ */
@NotNull(message = "文件ID不能为空") @NotNull(message = "[fileId]文件主键不能为空")
private Long fileId; private Long fileId;
public Long getFileId() { public Long getFileId() {

@ -16,7 +16,7 @@ public class FileGetRequest extends BaseRequest {
/** /**
* ID * ID
*/ */
@NotNull(message = "文件ID不能为空") @NotNull(message = "[id]文件主键不能为空")
private Long id; private Long id;
public Long getId() { public Long getId() {

@ -2,7 +2,7 @@ package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseRequest; import ${basePackage}.frame.base.BaseRequest;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
/** /**
@ -17,8 +17,8 @@ public class FileUploadRequest extends BaseRequest {
/** /**
* (.) * (.)
*/ */
@NotEmpty(message = "文件名不能为空") @NotBlank(message = "[fileName]文件名不能为空")
@Pattern(regexp = ".*\\.*$", message = "文件后缀错误") @Pattern(regexp = ".*\\.*$", message = "[fileName]文件后缀错误")
private String fileName; private String fileName;
/** /**

@ -2,7 +2,7 @@ package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseRequest; import ${basePackage}.frame.base.BaseRequest;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotBlank;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import ${basePackage}.frame.validation.Dict; import ${basePackage}.frame.validation.Dict;
@ -18,27 +18,27 @@ public class ResourceCreateRequest extends BaseRequest {
/** /**
* *
*/ */
@NotEmpty(message = "资源内容不能为空") @NotBlank(message = "[value]资源内容不能为空")
@Length(min = 0, max = 100, message = "资源内容长度不合法(0-100)") @Length(min = 0, max = 100, message = "资源内容长度不合法(0-100)")
private String value; private String value;
/** /**
* *
*/ */
@Length(min = 0, max = 255, message = "资源描述长度不合法(0-255)") @Length(min = 0, max = 255, message = "[comment]资源描述长度不合法(0-255)")
private String comment; private String comment;
/** /**
* *
*/ */
@NotEmpty(message = "资源类型不能为NULL") @NotBlank(message = "[resourceType]资源类型不能为NULL")
@Dict(name = "RESOURCE_TYPE") @Dict(name = "RESOURCE_TYPE")
private String resourceType; private String resourceType;
/** /**
* *
*/ */
@NotNull(message = "是否有效不能为NULL") @NotNull(message = "[valid]是否有效不能为NULL")
private Boolean valid; private Boolean valid;
public String getValue() { public String getValue() {

@ -15,7 +15,7 @@ public class ResourceDeleteRequest extends BaseUpdateRequest {
/** /**
* *
*/ */
@NotNull(message = "主键不能为空") @NotNull(message = "[id]主键不能为空")
private long id; private long id;
public long getId() { public long getId() {

@ -15,7 +15,7 @@ public class ResourceGetRequest extends BaseRequest {
/** /**
* *
*/ */
@NotNull(message = "主键不能为空") @NotNull(message = "[id]主键不能为空")
private long id; private long id;
public long getId() { public long getId() {

@ -3,7 +3,7 @@ package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseUpdateRequest; import ${basePackage}.frame.base.BaseUpdateRequest;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotBlank;
import ${basePackage}.frame.validation.Dict; import ${basePackage}.frame.validation.Dict;
/** /**
@ -18,33 +18,33 @@ public class ResourceUpdateRequest extends BaseUpdateRequest {
/** /**
* *
*/ */
@NotNull(message = "主键不能为NULL") @NotNull(message = "[id]主键不能为NULL")
private Long id; private Long id;
/** /**
* *
*/ */
@NotEmpty(message = "资源内容不能为空") @NotBlank(message = "[value]资源内容不能为空")
@Length(min = 0, max = 100, message = "资源内容长度不合法(0-100)") @Length(min = 0, max = 100, message = "资源内容长度不合法(0-100)")
private String value; private String value;
/** /**
* *
*/ */
@Length(min = 0, max = 255, message = "资源描述长度不合法(0-255)") @Length(min = 0, max = 255, message = "[comment]资源描述长度不合法(0-255)")
private String comment; private String comment;
/** /**
* *
*/ */
@NotNull(message = "资源类型不能为NULL") @NotNull(message = "[resourceType]资源类型不能为NULL")
@Dict(name = "RESOURCE_TYPE") @Dict(name = "RESOURCE_TYPE")
private String resourceType; private String resourceType;
/** /**
* *
*/ */
@NotNull(message = "是否有效不能为NULL") @NotNull(message = "[valid]是否有效不能为NULL")
private Boolean valid; private Boolean valid;
public Long getId() { public Long getId() {

@ -0,0 +1,30 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseFindRequest;
import javax.validation.constraints.NotBlank;
import java.util.Date;
/**
* TokensRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-20
*/
public class TokensBuildRequest extends BaseFindRequest {
/**
*
*/
@NotBlank(message = "登录令牌不能为空")
private String token;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}

@ -10,41 +10,48 @@ import ${basePackage}.frame.validation.Dict;
/** /**
* TokensCreateRequest - * TokensCreateRequest -
* *
* @author author * @author wangbing
* @version 0.0.1 * @version 0.0.1
* @since 2019-12-19 * @since 2019-12-20
*/ */
public class TokensCreateRequest extends BaseRequest { public class TokensCreateRequest extends BaseRequest {
/**
*
*/
@NotEmpty(message = "[token]登录令牌不能为空")
@Length(min = 0, max = 50, message = "[token]登录令牌长度不合法(0-50)")
private String token;
/** /**
* *
*/ */
@NotNull(message = "用户主键不能为NULL") @NotNull(message = "[userId]用户主键不能为NULL")
private Long userId; private Long userId;
/** /**
* *
*/ */
@NotEmpty(message = "用户名称不能为空") @NotEmpty(message = "[userName]用户名称不能为空")
@Length(min = 0, max = 50, message = "用户名称长度不合法(0-50)") @Length(min = 0, max = 50, message = "[userName]用户名称长度不合法(0-50)")
private String userName; private String userName;
/** /**
* *
*/ */
@NotNull(message = "登录时间不能为NULL") @NotNull(message = "[loginTime]登录时间不能为NULL")
private Date loginTime; private Date loginTime;
/** /**
* *
*/ */
@NotNull(message = "有效时间不能为NULL") @NotNull(message = "[validTime]有效时间不能为NULL")
private Date validTime; private Date validTime;
/** /**
* *
*/ */
@NotNull(message = "是否有效不能为NULL") @NotNull(message = "[valid]是否有效不能为NULL")
private Boolean valid; private Boolean valid;
/** /**
@ -55,13 +62,13 @@ public class TokensCreateRequest extends BaseRequest {
/** /**
* *
*/ */
@Length(min = 0, max = 50, message = "部门代码长度不合法(0-50)") @Length(min = 0, max = 50, message = "[deptCode]部门代码长度不合法(0-50)")
private String deptCode; private String deptCode;
/** /**
* *
*/ */
@Length(min = 0, max = 100, message = "部门名称长度不合法(0-100)") @Length(min = 0, max = 100, message = "[deptName]部门名称长度不合法(0-100)")
private String deptName; private String deptName;
/** /**
@ -73,15 +80,23 @@ public class TokensCreateRequest extends BaseRequest {
/** /**
* *
*/ */
@Length(min = 0, max = 50, message = "终端地址长度不合法(0-50)") @Length(min = 0, max = 50, message = "[terminalIp]终端地址长度不合法(0-50)")
private String terminalIp; private String terminalIp;
/** /**
* *
*/ */
@Length(min = 0, max = 100, message = "终端信息长度不合法(0-100)") @Length(min = 0, max = 500, message = "[terminalInfo]终端信息长度不合法(0-500)")
private String terminalInfo; private String terminalInfo;
public String getToken() {
return this.token;
}
public void setToken(String token) {
this.token = token;
}
public Long getUserId() { public Long getUserId() {
return this.userId; return this.userId;
} }

@ -15,7 +15,7 @@ public class TokensDeleteRequest extends BaseUpdateRequest {
/** /**
* *
*/ */
@NotNull(message = "主键不能为空") @NotNull(message = "[id]主键不能为空")
private long id; private long id;
public long getId() { public long getId() {

@ -7,12 +7,17 @@ import ${basePackage}.frame.validation.Dict;
/** /**
* TokensRequest - * TokensRequest -
* *
* @author author * @author wangbing
* @version 0.0.1 * @version 0.0.1
* @since 2019-12-19 * @since 2019-12-20
*/ */
public class TokensFindRequest extends BaseFindRequest { public class TokensFindRequest extends BaseFindRequest {
/**
*
*/
private String token;
/** /**
* *
*/ */
@ -69,6 +74,14 @@ public class TokensFindRequest extends BaseFindRequest {
*/ */
private String terminalInfo; private String terminalInfo;
public String getToken() {
return this.token;
}
public void setToken(String token) {
this.token = token;
}
public Long getUserId() { public Long getUserId() {
return this.userId; return this.userId;
} }

@ -15,7 +15,7 @@ public class TokensGetRequest extends BaseRequest {
/** /**
* *
*/ */
@NotNull(message = "主键不能为空") @NotNull(message = "[id]主键不能为空")
private long id; private long id;
public long getId() { public long getId() {

@ -10,47 +10,54 @@ import ${basePackage}.frame.validation.Dict;
/** /**
* TokensUpdateRequest - * TokensUpdateRequest -
* *
* @author author * @author wangbing
* @version 0.0.1 * @version 0.0.1
* @since 2019-12-19 * @since 2019-12-20
*/ */
public class TokensUpdateRequest extends BaseUpdateRequest { public class TokensUpdateRequest extends BaseUpdateRequest {
/** /**
* *
*/ */
@NotNull(message = "主键不能为NULL") @NotNull(message = "[id]主键不能为NULL")
private Long id; private Long id;
/**
*
*/
@NotEmpty(message = "[token]登录令牌不能为空")
@Length(min = 0, max = 50, message = "[token]登录令牌长度不合法(0-50)")
private String token;
/** /**
* *
*/ */
@NotNull(message = "用户主键不能为NULL") @NotNull(message = "[userId]用户主键不能为NULL")
private Long userId; private Long userId;
/** /**
* *
*/ */
@NotEmpty(message = "用户名称不能为空") @NotEmpty(message = "[userName]用户名称不能为空")
@Length(min = 0, max = 50, message = "用户名称长度不合法(0-50)") @Length(min = 0, max = 50, message = "[userName]用户名称长度不合法(0-50)")
private String userName; private String userName;
/** /**
* *
*/ */
@NotNull(message = "登录时间不能为NULL") @NotNull(message = "[loginTime]登录时间不能为NULL")
private Date loginTime; private Date loginTime;
/** /**
* *
*/ */
@NotNull(message = "有效时间不能为NULL") @NotNull(message = "[validTime]有效时间不能为NULL")
private Date validTime; private Date validTime;
/** /**
* *
*/ */
@NotNull(message = "是否有效不能为NULL") @NotNull(message = "[valid]是否有效不能为NULL")
private Boolean valid; private Boolean valid;
/** /**
@ -61,13 +68,13 @@ public class TokensUpdateRequest extends BaseUpdateRequest {
/** /**
* *
*/ */
@Length(min = 0, max = 50, message = "部门代码长度不合法(0-50)") @Length(min = 0, max = 50, message = "[deptCode]部门代码长度不合法(0-50)")
private String deptCode; private String deptCode;
/** /**
* *
*/ */
@Length(min = 0, max = 100, message = "部门名称长度不合法(0-100)") @Length(min = 0, max = 100, message = "[deptName]部门名称长度不合法(0-100)")
private String deptName; private String deptName;
/** /**
@ -79,13 +86,13 @@ public class TokensUpdateRequest extends BaseUpdateRequest {
/** /**
* *
*/ */
@Length(min = 0, max = 50, message = "终端地址长度不合法(0-50)") @Length(min = 0, max = 50, message = "[terminalIp]终端地址长度不合法(0-50)")
private String terminalIp; private String terminalIp;
/** /**
* *
*/ */
@Length(min = 0, max = 100, message = "终端信息长度不合法(0-100)") @Length(min = 0, max = 500, message = "[terminalInfo]终端信息长度不合法(0-500)")
private String terminalInfo; private String terminalInfo;
public Long getId() { public Long getId() {
@ -96,6 +103,14 @@ public class TokensUpdateRequest extends BaseUpdateRequest {
this.id = id; this.id = id;
} }
public String getToken() {
return this.token;
}
public void setToken(String token) {
this.token = token;
}
public Long getUserId() { public Long getUserId() {
return this.userId; return this.userId;
} }

@ -0,0 +1,27 @@
package ${basePackage}.module.system.rsp;
import ${basePackage}.frame.base.BaseResponse;
import ${basePackage}.frame.base.Token;
/**
* TokensGetResponse -
*
* @author author
* @version 0.0.1
* @since 2019-12-19
*/
public class TokensBuildResponse extends BaseResponse {
/**
*
*/
private Token token;
public Token getToken() {
return token;
}
public void setToken(Token token) {
this.token = token;
}
}

@ -128,4 +128,7 @@ web.login.page=/login.htm
# 拦截验证 # 拦截验证
web.url.auth.included=/,/**/*.htm web.url.auth.included=/,/**/*.htm
# 直接放行 # 直接放行
web.url.auth.excluded=/login.htm web.url.auth.excluded=/login.htm
# 超级管理员
web.url.auth.admin=admin
web.url.auth.pwd=17fac3376f76d65943d1d26d1f7cb1e5

@ -128,4 +128,7 @@ web.login.page=/login.htm
# 拦截验证 # 拦截验证
web.url.auth.included=/,/**/*.htm web.url.auth.included=/,/**/*.htm
# 直接放行 # 直接放行
web.url.auth.excluded=/login.htm web.url.auth.excluded=/login.htm
# 超级管理员
web.url.auth.admin=admin
web.url.auth.pwd=17fac3376f76d65943d1d26d1f7cb1e5

@ -68,8 +68,8 @@ PRIMARY KEY (`ID`)
-- ---------------------------- -- ----------------------------
-- Table structure for RESOURCE - 资源 -- Table structure for RESOURCE - 资源
-- Target : MySQL -- Target : MySQL
-- Author : author -- Author : wangbing
-- Date: : 2019-12-19 -- Date: : 2019-12-20
-- ---------------------------- -- ----------------------------
CREATE TABLE `SYS_RESOURCE` ( CREATE TABLE `SYS_RESOURCE` (
`ID` BIGINT(20) NOT NULL COMMENT '主键', `ID` BIGINT(20) NOT NULL COMMENT '主键',
@ -77,6 +77,8 @@ CREATE TABLE `SYS_RESOURCE` (
`COMMENT` VARCHAR(250) COMMENT '资源描述', `COMMENT` VARCHAR(250) COMMENT '资源描述',
`RESOURCE_TYPE` VARCHAR(20) NOT NULL COMMENT '资源类型', `RESOURCE_TYPE` VARCHAR(20) NOT NULL COMMENT '资源类型',
`VALID` TINYINT(1) NOT NULL COMMENT '是否有效', `VALID` TINYINT(1) NOT NULL COMMENT '是否有效',
`NODE` TINYINT(1) NOT NULL COMMENT '是否节点',
`SUP_ID` BIGINT(20) COMMENT '上级主键',
`ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本',
`IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除',
`CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户',
@ -85,15 +87,15 @@ CREATE TABLE `SYS_RESOURCE` (
`LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间', `LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间',
PRIMARY KEY (`ID`) PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='资源'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='资源';
-- ---------------------------- -- ----------------------------
-- Table structure for TOKENS - 通行证 -- Table structure for TOKENS - 通行证
-- Target : MySQL -- Target : MySQL
-- Author : author -- Author : wangbing
-- Date: : 2019-12-19 -- Date: : 2019-12-20
-- ---------------------------- -- ----------------------------
CREATE TABLE `SYS_TOKENS` ( CREATE TABLE `SYS_TOKENS` (
`ID` BIGINT(20) NOT NULL COMMENT '主键', `ID` BIGINT(20) NOT NULL COMMENT '主键',
`TOKEN` VARCHAR(50) NOT NULL COMMENT '登录令牌',
`USER_ID` BIGINT(20) NOT NULL COMMENT '用户主键', `USER_ID` BIGINT(20) NOT NULL COMMENT '用户主键',
`USER_NAME` VARCHAR(50) NOT NULL COMMENT '用户名称', `USER_NAME` VARCHAR(50) NOT NULL COMMENT '用户名称',
`LOGIN_TIME` DATETIME NOT NULL COMMENT '登录时间', `LOGIN_TIME` DATETIME NOT NULL COMMENT '登录时间',
@ -104,7 +106,7 @@ CREATE TABLE `SYS_TOKENS` (
`DEPT_NAME` VARCHAR(100) COMMENT '部门名称', `DEPT_NAME` VARCHAR(100) COMMENT '部门名称',
`TERMINAL_TYPE` VARCHAR(20) COMMENT '终端类型', `TERMINAL_TYPE` VARCHAR(20) COMMENT '终端类型',
`TERMINAL_IP` VARCHAR(50) COMMENT '终端地址', `TERMINAL_IP` VARCHAR(50) COMMENT '终端地址',
`TERMINAL_INFO` VARCHAR(100) COMMENT '终端信息', `TERMINAL_INFO` VARCHAR(500) COMMENT '终端信息',
`ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本',
`IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除',
`CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户',

@ -1,11 +1,12 @@
-- ---------------------------- -- ----------------------------
-- Table structure for TOKENS - 通行证 -- Table structure for TOKENS - 通行证
-- Target : MySQL -- Target : MySQL
-- Author : author -- Author : wangbing
-- Date: : 2019-12-19 -- Date: : 2019-12-20
-- ---------------------------- -- ----------------------------
CREATE TABLE `SYS_TOKENS` ( CREATE TABLE `SYS_TOKENS` (
`ID` BIGINT(20) NOT NULL COMMENT '主键', `ID` BIGINT(20) NOT NULL COMMENT '主键',
`TOKEN` VARCHAR(50) NOT NULL COMMENT '登录令牌',
`USER_ID` BIGINT(20) NOT NULL COMMENT '用户主键', `USER_ID` BIGINT(20) NOT NULL COMMENT '用户主键',
`USER_NAME` VARCHAR(50) NOT NULL COMMENT '用户名称', `USER_NAME` VARCHAR(50) NOT NULL COMMENT '用户名称',
`LOGIN_TIME` DATETIME NOT NULL COMMENT '登录时间', `LOGIN_TIME` DATETIME NOT NULL COMMENT '登录时间',
@ -16,7 +17,7 @@ CREATE TABLE `SYS_TOKENS` (
`DEPT_NAME` VARCHAR(100) COMMENT '部门名称', `DEPT_NAME` VARCHAR(100) COMMENT '部门名称',
`TERMINAL_TYPE` VARCHAR(20) COMMENT '终端类型', `TERMINAL_TYPE` VARCHAR(20) COMMENT '终端类型',
`TERMINAL_IP` VARCHAR(50) COMMENT '终端地址', `TERMINAL_IP` VARCHAR(50) COMMENT '终端地址',
`TERMINAL_INFO` VARCHAR(100) COMMENT '终端信息', `TERMINAL_INFO` VARCHAR(500) COMMENT '终端信息',
`ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本',
`IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除',
`CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户',

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project> <project>
<projectName>wadmin</projectName> <projectName>wadmin</projectName>
<projectBasePackage>com.example</projectBasePackage> <projectBasePackage>${basePackage}</projectBasePackage>
<projectAuthor>author</projectAuthor> <projectAuthor>wangbing</projectAuthor>
<multiDB>false</multiDB> <multiDB>false</multiDB>
<sysMD>true</sysMD>
<modules> <modules>
<module> <module>
<moduleComment>系统</moduleComment> <moduleComment>系统</moduleComment>
<modulePrefix>SYS_</modulePrefix> <modulePrefix>SYS_</modulePrefix>
<moduleName>system_</moduleName> <moduleName>system</moduleName>
<hasSysFields>true</hasSysFields> <hasSysFields>true</hasSysFields>
<tables> <tables>
<table create="true" delete="true" find="true" get="true" html="true" search="false" sys="true" tableComment="用户" tableName="USER" update="true"> <table create="true" delete="true" find="true" get="true" html="true" search="false" sys="true" tableComment="用户" tableName="USER" update="true">
@ -35,7 +36,7 @@
<field IsSystem="true" defaultValue="" fieldComment="主键" fieldLength="0" fieldName="ID" fieldType="Long" isMust="true" isPrimaryKey="true" isQuery="false" isSearch="false"/> <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="DEPT_CODE" fieldType="String_var50" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="部门代码" fieldLength="50" fieldName="DEPT_CODE" fieldType="String_var50" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="部门名称" fieldLength="100" fieldName="DEPT_NAME" fieldType="String_var100" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="部门名称" fieldLength="100" fieldName="DEPT_NAME" fieldType="String_var100" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="部门别名" fieldLength="50" fieldName="DEPT_ALIAS" fieldType="String_var50" isMust="false" isPrimaryKey="false" isQuery="false" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="部门别名" fieldLength="50" fieldName="DEPT_ALIAS" fieldType="String_var50" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="父部门代码" fieldLength="50" fieldName="SUP_CODE" fieldType="String_var50" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="父部门代码" fieldLength="50" fieldName="SUP_CODE" fieldType="String_var50" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="父部门名称" fieldLength="100" fieldName="SUP_NAME" fieldType="String_var100" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="父部门名称" fieldLength="100" fieldName="SUP_NAME" fieldType="String_var100" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="是否有效" fieldLength="0" fieldName="VALID" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="是否有效" fieldLength="0" fieldName="VALID" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
@ -81,6 +82,8 @@
<field IsSystem="false" defaultValue="NULL" fieldComment="资源描述" fieldLength="255" fieldName="COMMENT" fieldType="String_var255" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="资源描述" fieldLength="255" fieldName="COMMENT" fieldType="String_var255" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="资源类型" fieldLength="20" fieldName="RESOURCE_TYPE" fieldType="Dict" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="资源类型" fieldLength="20" fieldName="RESOURCE_TYPE" fieldType="Dict" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="是否有效" fieldLength="0" fieldName="VALID" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="是否有效" fieldLength="0" fieldName="VALID" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="是否节点" fieldLength="0" fieldName="NODE" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="上级主键" fieldLength="0" fieldName="SUP_ID" fieldType="Long" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="true" defaultValue="" fieldComment="行版本" fieldLength="0" fieldName="ROW_VERSION" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/> <field IsSystem="true" defaultValue="" fieldComment="行版本" fieldLength="0" fieldName="ROW_VERSION" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
<field IsSystem="true" defaultValue="0" fieldComment="是否已删除" fieldLength="0" fieldName="IS_DELETED" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/> <field IsSystem="true" defaultValue="0" fieldComment="是否已删除" fieldLength="0" fieldName="IS_DELETED" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
<field IsSystem="true" defaultValue="" fieldComment="创建用户" fieldLength="0" fieldName="CREATE_BY" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/> <field IsSystem="true" defaultValue="" fieldComment="创建用户" fieldLength="0" fieldName="CREATE_BY" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
@ -105,6 +108,7 @@
<table create="true" delete="true" find="true" get="true" html="true" search="false" sys="true" tableComment="通行证" tableName="TOKENS" update="true"> <table create="true" delete="true" find="true" get="true" html="true" search="false" sys="true" tableComment="通行证" tableName="TOKENS" update="true">
<fields> <fields>
<field IsSystem="true" defaultValue="" fieldComment="主键" fieldLength="0" fieldName="ID" fieldType="Long" isMust="true" isPrimaryKey="true" isQuery="false" isSearch="false"/> <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="TOKEN" fieldType="String_var50" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="用户主键" fieldLength="0" fieldName="USER_ID" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="用户主键" fieldLength="0" fieldName="USER_ID" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="用户名称" fieldLength="50" fieldName="USER_NAME" fieldType="String_var50" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="用户名称" fieldLength="50" fieldName="USER_NAME" fieldType="String_var50" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="登录时间" fieldLength="0" fieldName="LOGIN_TIME" fieldType="Date" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="登录时间" fieldLength="0" fieldName="LOGIN_TIME" fieldType="Date" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
@ -115,7 +119,7 @@
<field IsSystem="false" defaultValue="NULL" fieldComment="部门名称" fieldLength="100" fieldName="DEPT_NAME" fieldType="String_var100" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="部门名称" fieldLength="100" fieldName="DEPT_NAME" fieldType="String_var100" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="终端类型" fieldLength="20" fieldName="TERMINAL_TYPE" fieldType="Dict" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="终端类型" fieldLength="20" fieldName="TERMINAL_TYPE" fieldType="Dict" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="终端地址" fieldLength="50" fieldName="TERMINAL_IP" fieldType="String_var50" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="终端地址" fieldLength="50" fieldName="TERMINAL_IP" fieldType="String_var50" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="终端信息" fieldLength="100" fieldName="TERMINAL_INFO" fieldType="String_var100" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/> <field IsSystem="false" defaultValue="NULL" fieldComment="终端信息" fieldLength="500" fieldName="TERMINAL_INFO" fieldType="String_var500" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="true" defaultValue="" fieldComment="行版本" fieldLength="0" fieldName="ROW_VERSION" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/> <field IsSystem="true" defaultValue="" fieldComment="行版本" fieldLength="0" fieldName="ROW_VERSION" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
<field IsSystem="true" defaultValue="0" fieldComment="是否已删除" fieldLength="0" fieldName="IS_DELETED" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/> <field IsSystem="true" defaultValue="0" fieldComment="是否已删除" fieldLength="0" fieldName="IS_DELETED" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
<field IsSystem="true" defaultValue="" fieldComment="创建用户" fieldLength="0" fieldName="CREATE_BY" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/> <field IsSystem="true" defaultValue="" fieldComment="创建用户" fieldLength="0" fieldName="CREATE_BY" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>

@ -11,6 +11,7 @@
background-color="#252a2f" background-color="#252a2f"
text-color="#d6d6d6" text-color="#d6d6d6"
active-text-color="#ffd04b"> active-text-color="#ffd04b">
<#if sysMD>
<el-submenu index="${tool.uuid()}" > <el-submenu index="${tool.uuid()}" >
<template slot="title"> <template slot="title">
<i class="el-icon-monitor"></i> <i class="el-icon-monitor"></i>
@ -19,8 +20,12 @@
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '字典管理', name: 'dict', url: '${r'${context}'}/system/dict.htm'})">字典管理</el-menu-item> <el-menu-item index="${tool.uuid()}" @click="addTab({title: '字典管理', name: 'dict', url: '${r'${context}'}/system/dict.htm'})">字典管理</el-menu-item>
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '文件管理', name: 'file', url: '${r'${context}'}/system/file.htm'})">文件管理</el-menu-item> <el-menu-item index="${tool.uuid()}" @click="addTab({title: '文件管理', name: 'file', url: '${r'${context}'}/system/file.htm'})">文件管理</el-menu-item>
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '资源管理', name: 'resource', url: '${r'${context}'}/system/resource.htm'})">资源管理</el-menu-item> <el-menu-item index="${tool.uuid()}" @click="addTab({title: '资源管理', name: 'resource', url: '${r'${context}'}/system/resource.htm'})">资源管理</el-menu-item>
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '用户管理', name: 'user', url: '${r'${context}'}/system/user.htm'})">用户管理</el-menu-item>
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '部门管理', name: 'dept', url: '${r'${context}'}/system/dept.htm'})">部门管理</el-menu-item>
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '角色管理', name: 'role', url: '${r'${context}'}/system/role.htm'})">角色管理</el-menu-item>
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '登录管理', name: 'tokens', url: '${r'${context}'}/system/tokens.htm'})">登录管理</el-menu-item> <el-menu-item index="${tool.uuid()}" @click="addTab({title: '登录管理', name: 'tokens', url: '${r'${context}'}/system/tokens.htm'})">登录管理</el-menu-item>
</el-submenu> </el-submenu>
</#if>
<#list modules as item> <#list modules as item>
<#if item.hasHtml()> <#if item.hasHtml()>
<el-submenu index="${tool.uuid()}"> <el-submenu index="${tool.uuid()}">

@ -0,0 +1,271 @@
<div id="app" v-cloak>
<el-card class="box-card search">
<el-form :inline="true" :model="vm" ref="vm" label-position="left" label-width="90px">
<el-form-item label="部门代码" prop="deptCode">
<el-input v-model="vm.deptCode" clearable size="small" placeholder="请输入部门代码"></el-input>
</el-form-item>
<el-form-item label="部门名称" prop="deptName">
<el-input v-model="vm.deptName" clearable size="small" placeholder="请输入部门名称"></el-input>
</el-form-item>
<el-form-item label="部门别名" prop="deptAlias">
<el-input v-model="vm.deptAlias" clearable size="small" placeholder="请输入部门别名"></el-input>
</el-form-item>
<el-form-item label="父部门代码" prop="supCode">
<el-input v-model="vm.supCode" clearable size="small" placeholder="请输入父部门代码"></el-input>
</el-form-item>
<el-form-item label="父部门名称" prop="supName">
<el-input v-model="vm.supName" clearable size="small" placeholder="请输入父部门名称"></el-input>
</el-form-item>
<el-form-item label="是否有效" prop="valid">
<el-radio-group v-model="vm.valid" clearable size="small">
<el-radio :label="true">是</el-radio>
<el-radio :label="false">否</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" icon="el-icon-search" @click="onSearch">搜索</el-button>
<el-button type="warning" size="small" icon="el-icon-refresh-left" @click="onReset('vm')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="box-card">
<el-row>
<el-col :span="12">
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate">新增</el-button>
<el-button type="warning" size="small" icon="el-icon-download" @click="onExport">导出</el-button>
<el-dialog class="form" :title="form.title" :visible.sync="form.dialog">
<el-form :model="form" :inline="true" :rules="formRules" ref="form" label-position="left" label-width="90px">
<el-form-item label="部门代码" prop="deptCode">
<el-input v-model="form.deptCode" clearable size="small" placeholder="请输入部门代码"></el-input>
</el-form-item>
<el-form-item label="部门名称" prop="deptName">
<el-input v-model="form.deptName" clearable size="small" placeholder="请输入部门名称"></el-input>
</el-form-item>
<el-form-item label="部门别名" prop="deptAlias">
<el-input v-model="form.deptAlias" clearable size="small" placeholder="请输入部门别名"></el-input>
</el-form-item>
<el-form-item label="父部门代码" prop="supCode">
<el-input v-model="form.supCode" clearable size="small" placeholder="请输入父部门代码"></el-input>
</el-form-item>
<el-form-item label="父部门名称" prop="supName">
<el-input v-model="form.supName" clearable size="small" placeholder="请输入父部门名称"></el-input>
</el-form-item>
<el-form-item label="是否有效" prop="valid">
<el-radio-group v-model="form.valid" clearable size="small">
<el-radio :label="true">是</el-radio>
<el-radio :label="false">否</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="form.dialog = false">取 消</el-button>
<el-button size="small" type="primary" @click="onSave">保存</el-button>
</span>
</el-dialog>
</el-col>
<el-col :span="12">
<el-button-group style="float: right;">
<el-tooltip effect="dark" content="Excel模板下载" placement="bottom">
<el-button size="small" icon="el-icon-date" @click="onTemplate"></el-button>
</el-tooltip>
<el-tooltip effect="dark" content="Excel导入" placement="bottom">
<el-button size="small" icon="el-icon-upload2" @click="onImport"></el-button>
</el-tooltip>
<el-tooltip effect="dark" content="批量删除" placement="bottom">
<el-button size="small" icon="el-icon-delete" @click="onBitchDelete"></el-button>
</el-tooltip>
<el-tooltip effect="dark" content="刷新" placement="bottom">
<el-button size="small" icon="el-icon-refresh" @click="onFind"></el-button>
</el-tooltip>
</el-button-group>
</el-col>
</el-row>
<el-table
style="margin-top: 10px"
@selection-change="onSelectionChange"
empty-text="无数据"
:data="result"
size="mini"
style="width: 100%">
<el-table-column
align="center"
type="selection"
width="40">
</el-table-column>
<el-table-column
align="center"
prop="id"
label="主键"
width="140">
</el-table-column>
<el-table-column
align="center"
prop="deptCode"
label="部门代码">
</el-table-column>
<el-table-column
align="center"
prop="deptName"
label="部门名称">
</el-table-column>
<el-table-column
align="center"
prop="deptAlias"
label="部门别名">
</el-table-column>
<el-table-column
align="center"
prop="supCode"
label="父部门代码">
</el-table-column>
<el-table-column
align="center"
prop="supName"
label="父部门名称">
</el-table-column>
<el-table-column
align="center"
prop="valid"
label="是否有效">
</el-table-column>
<el-table-column
align="center"
prop="createTime"
width="140"
label="创建时间">
</el-table-column>
<el-table-column
align="center"
fixed="right"
width="120"
label="操作">
<template slot-scope="scope">
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])"
@command="onCommand">
<i class="el-icon-edit"></i>编辑
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<el-pagination
background
v-if="vm.totalCount > vm.pageSize"
style="margin-top: 10px"
@current-change="onPage"
:current-page="vm.pageNumber"
:page-size="vm.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="vm.totalCount">
</el-pagination>
</el-card>
</div>
<script>
var app = new Vue({
mixins: [mixin],
el: "#app",
data: {
module: 'system',
target: 'dept',
vm: {//条件及分页参数
deptCode: "",
deptName: "",
deptAlias: "",
supCode: "",
supName: "",
valid: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
sortKey:'CREATE_TIME',
sortType:'DESC'
},
form: {//待提交表单
title: "",
dialog: false,
id: '',
deptCode: "",
deptName: "",
deptAlias: "",
supCode: "",
supName: "",
valid: "",
rowVersion: ""
},
formRules: {
deptCode: [
{required: true, message: '部门代码不能为空', trigger: 'blur'},
{min: 1, max: 50, message: '部门代码长度在 1 到 50 个字符', trigger: 'blur'}
],
deptName: [
{required: true, message: '部门名称不能为空', trigger: 'blur'},
{min: 1, max: 100, message: '部门名称长度在 1 到 100 个字符', trigger: 'blur'}
],
deptAlias: [
{min: 1, max: 50, message: '部门别名长度在 1 到 50 个字符', trigger: 'blur'}
],
supCode: [
{min: 1, max: 50, message: '父部门代码长度在 1 到 50 个字符', trigger: 'blur'}
],
supName: [
{min: 1, max: 100, message: '父部门名称长度在 1 到 100 个字符', trigger: 'blur'}
],
valid: [
{required: true, message: '是否有效不能为空', trigger: 'blur'},
],
}
},
methods: {
onCreate: function () {
this.form.title = "部门新增";
this.form.dialog = true;
this.form.id = "";
this.form.deptCode = "";
this.form.deptName = "";
this.form.deptAlias = "";
this.form.supCode = "";
this.form.supName = "";
this.form.valid = "";
},
onCommand: function (arg) {
const cmd = arg[0];
const item = arg[1];
switch (cmd) {
case "edit":
this.form.title = "部门编辑";
this.form.dialog = true;
this.form.id = item.id;
this.form.deptCode = item.deptCode;
this.form.deptName = item.deptName;
this.form.deptAlias = item.deptAlias;
this.form.supCode = item.supCode;
this.form.supName = item.supName;
this.form.valid = item.valid;
this.form.rowVersion = item.rowVersion;
break;
case "delete":
this.onDelete(item);
break;
default:
this.w("未找到对应的命令");
break;
}
},
},
mounted: function () {
this.onFind();
},
})
</script>

@ -0,0 +1,211 @@
<div id="app" v-cloak>
<el-card class="box-card search">
<el-form :inline="true" :model="vm" ref="vm" label-position="left" label-width="90px">
<el-form-item label="角色名称" prop="roleName">
<el-input v-model="vm.roleName" clearable size="small" placeholder="请输入角色名称"></el-input>
</el-form-item>
<el-form-item label="角色代码" prop="roleCode">
<el-input v-model="vm.roleCode" clearable size="small" placeholder="请输入角色代码"></el-input>
</el-form-item>
<el-form-item label="角色描述" prop="roleComment">
<el-input v-model="vm.roleComment" clearable size="small" placeholder="请输入角色描述"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" icon="el-icon-search" @click="onSearch">搜索</el-button>
<el-button type="warning" size="small" icon="el-icon-refresh-left" @click="onReset('vm')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="box-card">
<el-row>
<el-col :span="12">
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate">新增</el-button>
<el-button type="warning" size="small" icon="el-icon-download" @click="onExport">导出</el-button>
<el-dialog class="form" :title="form.title" :visible.sync="form.dialog">
<el-form :model="form" :inline="true" :rules="formRules" ref="form" label-position="left" label-width="90px">
<el-form-item label="角色名称" prop="roleName">
<el-input v-model="form.roleName" clearable size="small" placeholder="请输入角色名称"></el-input>
</el-form-item>
<el-form-item label="角色代码" prop="roleCode">
<el-input v-model="form.roleCode" clearable size="small" placeholder="请输入角色代码"></el-input>
</el-form-item>
<el-form-item label="角色描述" prop="roleComment">
<el-input v-model="form.roleComment" clearable size="small" placeholder="请输入角色描述"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="form.dialog = false">取 消</el-button>
<el-button size="small" type="primary" @click="onSave">保存</el-button>
</span>
</el-dialog>
</el-col>
<el-col :span="12">
<el-button-group style="float: right;">
<el-tooltip effect="dark" content="Excel模板下载" placement="bottom">
<el-button size="small" icon="el-icon-date" @click="onTemplate"></el-button>
</el-tooltip>
<el-tooltip effect="dark" content="Excel导入" placement="bottom">
<el-button size="small" icon="el-icon-upload2" @click="onImport"></el-button>
</el-tooltip>
<el-tooltip effect="dark" content="批量删除" placement="bottom">
<el-button size="small" icon="el-icon-delete" @click="onBitchDelete"></el-button>
</el-tooltip>
<el-tooltip effect="dark" content="刷新" placement="bottom">
<el-button size="small" icon="el-icon-refresh" @click="onFind"></el-button>
</el-tooltip>
</el-button-group>
</el-col>
</el-row>
<el-table
style="margin-top: 10px"
@selection-change="onSelectionChange"
empty-text="无数据"
:data="result"
size="mini"
style="width: 100%">
<el-table-column
align="center"
type="selection"
width="40">
</el-table-column>
<el-table-column
align="center"
prop="id"
label="主键"
width="140">
</el-table-column>
<el-table-column
align="center"
prop="roleName"
label="角色名称">
</el-table-column>
<el-table-column
align="center"
prop="roleCode"
label="角色代码">
</el-table-column>
<el-table-column
align="center"
prop="roleComment"
label="角色描述">
</el-table-column>
<el-table-column
align="center"
prop="createTime"
width="140"
label="创建时间">
</el-table-column>
<el-table-column
align="center"
fixed="right"
width="120"
label="操作">
<template slot-scope="scope">
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])"
@command="onCommand">
<i class="el-icon-edit"></i>编辑
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<el-pagination
background
v-if="vm.totalCount > vm.pageSize"
style="margin-top: 10px"
@current-change="onPage"
:current-page="vm.pageNumber"
:page-size="vm.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="vm.totalCount">
</el-pagination>
</el-card>
</div>
<script>
var app = new Vue({
mixins: [mixin],
el: "#app",
data: {
module: 'system',
target: 'role',
vm: {//条件及分页参数
roleName: "",
roleCode: "",
roleComment: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
sortKey:'CREATE_TIME',
sortType:'DESC'
},
form: {//待提交表单
title: "",
dialog: false,
id: '',
roleName: "",
roleCode: "",
roleComment: "",
rowVersion: ""
},
formRules: {
roleName: [
{required: true, message: '角色名称不能为空', trigger: 'blur'},
{min: 1, max: 50, message: '角色名称长度在 1 到 50 个字符', trigger: 'blur'}
],
roleCode: [
{required: true, message: '角色代码不能为空', trigger: 'blur'},
{min: 1, max: 50, message: '角色代码长度在 1 到 50 个字符', trigger: 'blur'}
],
roleComment: [
{min: 1, max: 50, message: '角色描述长度在 1 到 50 个字符', trigger: 'blur'}
],
}
},
methods: {
onCreate: function () {
this.form.title = "角色新增";
this.form.dialog = true;
this.form.id = "";
this.form.roleName = "";
this.form.roleCode = "";
this.form.roleComment = "";
},
onCommand: function (arg) {
const cmd = arg[0];
const item = arg[1];
switch (cmd) {
case "edit":
this.form.title = "角色编辑";
this.form.dialog = true;
this.form.id = item.id;
this.form.roleName = item.roleName;
this.form.roleCode = item.roleCode;
this.form.roleComment = item.roleComment;
this.form.rowVersion = item.rowVersion;
break;
case "delete":
this.onDelete(item);
break;
default:
this.w("未找到对应的命令");
break;
}
},
},
mounted: function () {
this.onFind();
},
})
</script>

@ -39,68 +39,7 @@
<el-card class="box-card"> <el-card class="box-card">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate">新增</el-button>
<el-button type="warning" size="small" icon="el-icon-download" @click="onExport">导出</el-button> <el-button type="warning" size="small" icon="el-icon-download" @click="onExport">导出</el-button>
<el-dialog class="form" :title="form.title" :visible.sync="form.dialog">
<el-form :model="form" :inline="true" :rules="formRules" ref="form" label-position="left" label-width="90px">
<el-form-item label="用户主键" prop="userId">
<el-input-number v-model="form.userId" clearable size="small" placeholder="请输入用户主键" :step="1" step-strictly></el-input-number>
</el-form-item>
<el-form-item label="用户名称" prop="userName">
<el-input v-model="form.userName" clearable size="small" placeholder="请输入用户名称"></el-input>
</el-form-item>
<el-form-item label="登录时间" prop="loginTime">
<el-date-picker
size="small"
v-model="form.loginTime"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="有效时间" prop="validTime">
<el-date-picker
size="small"
v-model="form.validTime"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="是否有效" prop="valid">
<el-radio-group v-model="form.valid" clearable size="small">
<el-radio :label="true">是</el-radio>
<el-radio :label="false">否</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="部门主键" prop="deptId">
<el-input-number v-model="form.deptId" clearable size="small" placeholder="请输入部门主键" :step="1" step-strictly></el-input-number>
</el-form-item>
<el-form-item label="部门代码" prop="deptCode">
<el-input v-model="form.deptCode" clearable size="small" placeholder="请输入部门代码"></el-input>
</el-form-item>
<el-form-item label="部门名称" prop="deptName">
<el-input v-model="form.deptName" clearable size="small" placeholder="请输入部门名称"></el-input>
</el-form-item>
<el-form-item label="终端类型" prop="terminalType">
<el-input-dict v-model="form.terminalType" clearable size="small" placeholder="请输入终端类型" dict-name="TERMINAL_TYPE" ></el-input-dict>
</el-form-item>
<el-form-item label="终端地址" prop="terminalIp">
<el-input v-model="form.terminalIp" clearable size="small" placeholder="请输入终端地址"></el-input>
</el-form-item>
<el-form-item label="终端信息" prop="terminalInfo">
<el-input v-model="form.terminalInfo" clearable size="small" placeholder="请输入终端信息"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="form.dialog = false">取 消</el-button>
<el-button size="small" type="primary" @click="onSave">保存</el-button>
</span>
</el-dialog>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -315,22 +254,6 @@
} }
}, },
methods: { methods: {
onCreate: function () {
this.form.title = "通行证新增";
this.form.dialog = true;
this.form.id = "";
this.form.userId = "";
this.form.userName = "";
this.form.loginTime = "";
this.form.validTime = "";
this.form.valid = "";
this.form.deptId = "";
this.form.deptCode = "";
this.form.deptName = "";
this.form.terminalType = "";
this.form.terminalIp = "";
this.form.terminalInfo = "";
},
onCommand: function (arg) { onCommand: function (arg) {
const cmd = arg[0]; const cmd = arg[0];
const item = arg[1]; const item = arg[1];

@ -0,0 +1,297 @@
<div id="app" v-cloak>
<el-card class="box-card search">
<el-form :inline="true" :model="vm" ref="vm" label-position="left" label-width="90px">
<el-form-item label="用户账户" prop="userName">
<el-input v-model="vm.userName" clearable size="small" placeholder="请输入用户账户"></el-input>
</el-form-item>
<el-form-item label="用户代码" prop="userCode">
<el-input v-model="vm.userCode" clearable size="small" placeholder="请输入用户代码"></el-input>
</el-form-item>
<el-form-item label="用户别名" prop="userAlias">
<el-input v-model="vm.userAlias" clearable size="small" placeholder="请输入用户别名"></el-input>
</el-form-item>
<el-form-item label="用户状态" prop="userStatus">
<el-input-dict v-model="vm.userStatus" clearable size="small" placeholder="请输入用户状态" dict-name="USER_STATUS" ></el-input-dict>
</el-form-item>
<el-form-item label="部门主键" prop="deptId">
<el-input-number v-model="vm.deptId" clearable size="small" placeholder="请输入部门主键" :step="1" step-strictly></el-input-number>
</el-form-item>
<el-form-item label="部门代码" prop="deptCode">
<el-input v-model="vm.deptCode" clearable size="small" placeholder="请输入部门代码"></el-input>
</el-form-item>
<el-form-item label="部门名称" prop="deptName">
<el-input v-model="vm.deptName" clearable size="small" placeholder="请输入部门名称"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" icon="el-icon-search" @click="onSearch">搜索</el-button>
<el-button type="warning" size="small" icon="el-icon-refresh-left" @click="onReset('vm')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="box-card">
<el-row>
<el-col :span="12">
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate">新增</el-button>
<el-button type="warning" size="small" icon="el-icon-download" @click="onExport">导出</el-button>
<el-dialog class="form" :title="form.title" :visible.sync="form.dialog">
<el-form :model="form" :inline="true" :rules="formRules" ref="form" label-position="left" label-width="90px">
<el-form-item label="用户账户" prop="userName">
<el-input v-model="form.userName" clearable size="small" placeholder="请输入用户账户"></el-input>
</el-form-item>
<el-form-item label="用户代码" prop="userCode">
<el-input v-model="form.userCode" clearable size="small" placeholder="请输入用户代码"></el-input>
</el-form-item>
<el-form-item label="用户别名" prop="userAlias">
<el-input v-model="form.userAlias" clearable size="small" placeholder="请输入用户别名"></el-input>
</el-form-item>
<el-form-item label="用户密码" prop="userPwd">
<el-input v-model="form.userPwd" clearable size="small" placeholder="请输入用户密码"></el-input>
</el-form-item>
<el-form-item label="用户状态" prop="userStatus">
<el-input-dict v-model="form.userStatus" clearable size="small" placeholder="请输入用户状态" dict-name="USER_STATUS" ></el-input-dict>
</el-form-item>
<el-form-item label="部门主键" prop="deptId">
<el-input-number v-model="form.deptId" clearable size="small" placeholder="请输入部门主键" :step="1" step-strictly></el-input-number>
</el-form-item>
<el-form-item label="部门代码" prop="deptCode">
<el-input v-model="form.deptCode" clearable size="small" placeholder="请输入部门代码"></el-input>
</el-form-item>
<el-form-item label="部门名称" prop="deptName">
<el-input v-model="form.deptName" clearable size="small" placeholder="请输入部门名称"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="form.dialog = false">取 消</el-button>
<el-button size="small" type="primary" @click="onSave">保存</el-button>
</span>
</el-dialog>
</el-col>
<el-col :span="12">
<el-button-group style="float: right;">
<el-tooltip effect="dark" content="Excel模板下载" placement="bottom">
<el-button size="small" icon="el-icon-date" @click="onTemplate"></el-button>
</el-tooltip>
<el-tooltip effect="dark" content="Excel导入" placement="bottom">
<el-button size="small" icon="el-icon-upload2" @click="onImport"></el-button>
</el-tooltip>
<el-tooltip effect="dark" content="批量删除" placement="bottom">
<el-button size="small" icon="el-icon-delete" @click="onBitchDelete"></el-button>
</el-tooltip>
<el-tooltip effect="dark" content="刷新" placement="bottom">
<el-button size="small" icon="el-icon-refresh" @click="onFind"></el-button>
</el-tooltip>
</el-button-group>
</el-col>
</el-row>
<el-table
style="margin-top: 10px"
@selection-change="onSelectionChange"
empty-text="无数据"
:data="result"
size="mini"
style="width: 100%">
<el-table-column
align="center"
type="selection"
width="40">
</el-table-column>
<el-table-column
align="center"
prop="id"
label="主键"
width="140">
</el-table-column>
<el-table-column
align="center"
prop="userName"
label="用户账户">
</el-table-column>
<el-table-column
align="center"
prop="userCode"
label="用户代码">
</el-table-column>
<el-table-column
align="center"
prop="userAlias"
label="用户别名">
</el-table-column>
<el-table-column
align="center"
prop="userPwd"
label="用户密码">
</el-table-column>
<el-table-column
align="center"
prop="userStatus"
label="用户状态">
</el-table-column>
<el-table-column
align="center"
prop="deptId"
label="部门主键">
</el-table-column>
<el-table-column
align="center"
prop="deptCode"
label="部门代码">
</el-table-column>
<el-table-column
align="center"
prop="deptName"
label="部门名称">
</el-table-column>
<el-table-column
align="center"
prop="createTime"
width="140"
label="创建时间">
</el-table-column>
<el-table-column
align="center"
fixed="right"
width="120"
label="操作">
<template slot-scope="scope">
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])"
@command="onCommand">
<i class="el-icon-edit"></i>编辑
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<el-pagination
background
v-if="vm.totalCount > vm.pageSize"
style="margin-top: 10px"
@current-change="onPage"
:current-page="vm.pageNumber"
:page-size="vm.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="vm.totalCount">
</el-pagination>
</el-card>
</div>
<script>
var app = new Vue({
mixins: [mixin],
el: "#app",
data: {
module: 'system',
target: 'user',
vm: {//条件及分页参数
userName: "",
userCode: "",
userAlias: "",
userStatus: "",
deptId: "",
deptCode: "",
deptName: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
sortKey:'CREATE_TIME',
sortType:'DESC'
},
form: {//待提交表单
title: "",
dialog: false,
id: '',
userName: "",
userCode: "",
userAlias: "",
userPwd: "",
userStatus: "",
deptId: "",
deptCode: "",
deptName: "",
rowVersion: ""
},
formRules: {
userName: [
{required: true, message: '用户账户不能为空', trigger: 'blur'},
{min: 1, max: 100, message: '用户账户长度在 1 到 100 个字符', trigger: 'blur'}
],
userCode: [
{required: true, message: '用户代码不能为空', trigger: 'blur'},
{min: 1, max: 50, message: '用户代码长度在 1 到 50 个字符', trigger: 'blur'}
],
userAlias: [
{min: 1, max: 50, message: '用户别名长度在 1 到 50 个字符', trigger: 'blur'}
],
userPwd: [
{required: true, message: '用户密码不能为空', trigger: 'blur'},
{min: 1, max: 50, message: '用户密码长度在 1 到 50 个字符', trigger: 'blur'}
],
userStatus: [
{required: true, message: '用户状态不能为空', trigger: 'blur'},
],
deptId: [
],
deptCode: [
{min: 1, max: 50, message: '部门代码长度在 1 到 50 个字符', trigger: 'blur'}
],
deptName: [
{min: 1, max: 100, message: '部门名称长度在 1 到 100 个字符', trigger: 'blur'}
],
}
},
methods: {
onCreate: function () {
this.form.title = "用户新增";
this.form.dialog = true;
this.form.id = "";
this.form.userName = "";
this.form.userCode = "";
this.form.userAlias = "";
this.form.userPwd = "";
this.form.userStatus = "";
this.form.deptId = "";
this.form.deptCode = "";
this.form.deptName = "";
},
onCommand: function (arg) {
const cmd = arg[0];
const item = arg[1];
switch (cmd) {
case "edit":
this.form.title = "用户编辑";
this.form.dialog = true;
this.form.id = item.id;
this.form.userName = item.userName;
this.form.userCode = item.userCode;
this.form.userAlias = item.userAlias;
this.form.userPwd = item.userPwd;
this.form.userStatus = item.userStatus;
this.form.deptId = item.deptId;
this.form.deptCode = item.deptCode;
this.form.deptName = item.deptName;
this.form.rowVersion = item.rowVersion;
break;
case "delete":
this.onDelete(item);
break;
default:
this.w("未找到对应的命令");
break;
}
},
},
mounted: function () {
this.onFind();
},
})
</script>
Loading…
Cancel
Save

Powered by TurnKey Linux.