From 961531a45953be437957d112e60343a0d01aba76 Mon Sep 17 00:00:00 2001 From: wangbing <1919101440@qq.com> Date: Sun, 5 Jan 2020 21:34:46 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=812323?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: c87dd8780ad723fcb2e4e8ab540ea29f1d4d0dd2 --- .../java/action/ajax/system/DictAjax.java | 12 +- .../java/action/ajax/system/DictItemAjax.java | 12 +- .../java/action/ajax/system/FileAjax.java | 16 +- .../java/action/ajax/system/ResourceAjax.java | 104 -------- .../java/action/ajax/system/RoleAjax.java | 14 +- .../java/action/ajax/system/RoleResAjax.java | 37 ++- .../action/ajax/system/RoleResourceAjax.java | 50 ---- .../java/action/ajax/system/TokensAjax.java | 14 +- .../java/action/ajax/system/UserAjax.java | 4 +- .../java/action/ajax/system/UserRoleAjax.java | 5 +- .../java/action/api/system/ResApi.java | 47 ++++ .../java/action/api/system/ResourceApi.java | 33 --- .../java/action/api/system/RoleResApi.java | 41 +++ .../action/api/system/RoleResourceApi.java | 33 --- .../java/module/system/ent/Resource.java | 88 ------ .../java/module/system/ent/ResourceTree.java | 27 -- .../java/module/system/ent/RoleResource.java | 38 --- .../module/system/mgr/ResourceManager.java | 79 ------ .../system/mgr/ResourceManagerImpl.java | 252 ------------------ .../module/system/mgr/RoleResManager.java | 13 +- .../module/system/mgr/RoleResManagerImpl.java | 68 ++++- .../system/mgr/RoleResourceManager.java | 79 ------ .../system/mgr/RoleResourceManagerImpl.java | 227 ---------------- .../system/mpr/MySQL_ResourceMapper.xml | 147 ---------- .../system/mpr/MySQL_RoleResourceMapper.xml | 126 --------- .../module/system/mpr/ResourceMapper.java | 76 ------ .../module/system/mpr/RoleResourceMapper.java | 76 ------ .../module/system/req/ResCreateRequest.java | 5 +- .../module/system/req/ResUpdateRequest.java | 35 +-- .../system/req/ResourceCreateRequest.java | 90 ------- .../system/req/ResourceDeleteRequest.java | 28 -- .../system/req/ResourceFindRequest.java | 80 ------ .../module/system/req/ResourceGetRequest.java | 28 -- .../system/req/ResourceTreeRequest.java | 14 - .../system/req/ResourceUpdateRequest.java | 104 -------- .../system/req/RoleResCheckRequest.java | 87 ++++++ .../system/req/RoleResourceCheckRequest.java | 58 ---- .../system/req/RoleResourceCreateRequest.java | 44 --- .../system/req/RoleResourceDeleteRequest.java | 28 -- .../system/req/RoleResourceFindRequest.java | 39 --- .../system/req/RoleResourceGetRequest.java | 28 -- .../system/req/RoleResourceUpdateRequest.java | 58 ---- .../system/rsp/ResourceCreateResponse.java | 26 -- .../system/rsp/ResourceDeleteResponse.java | 26 -- .../system/rsp/ResourceFindResponse.java | 14 - .../system/rsp/ResourceGetResponse.java | 27 -- .../system/rsp/ResourceTreeResponse.java | 15 -- .../system/rsp/ResourceUpdateResponse.java | 26 -- ...esponse.java => RoleResCheckResponse.java} | 2 +- .../rsp/RoleResourceCreateResponse.java | 26 -- .../rsp/RoleResourceDeleteResponse.java | 26 -- .../system/rsp/RoleResourceFindResponse.java | 14 - .../system/rsp/RoleResourceGetResponse.java | 27 -- .../rsp/RoleResourceUpdateResponse.java | 26 -- .../dbtool/system/MySQL_ALL_TABLE.sql | 28 +- .../resources/dbtool/system/MySQL_RES.sql | 4 +- .../dbtool/system/MySQL_RESOURCE.sql | 21 -- .../SpringBoot/resources/dbtool/wadmin.xml | 4 +- .../templates/screen/module/system/res.ftl | 2 +- .../SpringBoot/test/system/DeptTest.java | 27 +- .../SpringBoot/test/system/DictItemTest.java | 13 +- .../SpringBoot/test/system/DictTest.java | 1 - .../SpringBoot/test/system/FileTest.java | 1 - .../SpringBoot/test/system/ResTest.java | 145 ++++++++++ .../SpringBoot/test/system/RoleResTest.java | 137 ++++++++++ .../SpringBoot/test/system/RoleTest.java | 25 +- .../SpringBoot/test/system/TokensTest.java | 1 - .../SpringBoot/test/system/UserRoleTest.java | 25 +- .../SpringBoot/test/system/UserTest.java | 1 - .../modules/SpringBoot/test/test.ftl | 21 +- 70 files changed, 681 insertions(+), 2474 deletions(-) delete mode 100644 src/main/resources/modules/SpringBoot/java/action/ajax/system/ResourceAjax.java delete mode 100644 src/main/resources/modules/SpringBoot/java/action/ajax/system/RoleResourceAjax.java create mode 100644 src/main/resources/modules/SpringBoot/java/action/api/system/ResApi.java delete mode 100644 src/main/resources/modules/SpringBoot/java/action/api/system/ResourceApi.java create mode 100644 src/main/resources/modules/SpringBoot/java/action/api/system/RoleResApi.java delete mode 100644 src/main/resources/modules/SpringBoot/java/action/api/system/RoleResourceApi.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/ent/Resource.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/ent/ResourceTree.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/ent/RoleResource.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/mgr/ResourceManager.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/mgr/ResourceManagerImpl.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResourceManager.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResourceManagerImpl.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_ResourceMapper.xml delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_RoleResourceMapper.xml delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/mpr/ResourceMapper.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/mpr/RoleResourceMapper.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/req/ResourceCreateRequest.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/req/ResourceDeleteRequest.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/req/ResourceFindRequest.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/req/ResourceGetRequest.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/req/ResourceTreeRequest.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/req/ResourceUpdateRequest.java create mode 100644 src/main/resources/modules/SpringBoot/java/module/system/req/RoleResCheckRequest.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceCheckRequest.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceCreateRequest.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceDeleteRequest.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceFindRequest.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceGetRequest.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceUpdateRequest.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceCreateResponse.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceDeleteResponse.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceFindResponse.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceGetResponse.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceTreeResponse.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceUpdateResponse.java rename src/main/resources/modules/SpringBoot/java/module/system/rsp/{RoleResourceCheckResponse.java => RoleResCheckResponse.java} (85%) delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceCreateResponse.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceDeleteResponse.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceFindResponse.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceGetResponse.java delete mode 100644 src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceUpdateResponse.java delete mode 100644 src/main/resources/modules/SpringBoot/resources/dbtool/system/MySQL_RESOURCE.sql create mode 100644 src/main/resources/modules/SpringBoot/test/system/ResTest.java create mode 100644 src/main/resources/modules/SpringBoot/test/system/RoleResTest.java diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/system/DictAjax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/system/DictAjax.java index 790a2156..a052a2f9 100644 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/system/DictAjax.java +++ b/src/main/resources/modules/SpringBoot/java/action/ajax/system/DictAjax.java @@ -3,16 +3,16 @@ 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.BaseResponse; import ${basePackage}.frame.base.ErrorType; +import ${basePackage}.frame.excel.WSheet; +import ${basePackage}.frame.excel.exception.ReadErrorException; +import ${basePackage}.frame.excel.exception.TemplateNotMatchException; +import ${basePackage}.frame.utils.LogUtil; 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.Dict; import ${basePackage}.module.system.mgr.DictManager; import ${basePackage}.module.system.req.DictCreateRequest; @@ -60,7 +60,7 @@ public class DictAjax { return dictManager.load(request, LocalData.getToken()); } - public Object template(){ + public Object template() { return ResponseUtil.apply(new WSheet<>(Dict.class)); } diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/system/DictItemAjax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/system/DictItemAjax.java index 94617369..eedd2b80 100644 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/system/DictItemAjax.java +++ b/src/main/resources/modules/SpringBoot/java/action/ajax/system/DictItemAjax.java @@ -3,16 +3,16 @@ 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.BaseResponse; import ${basePackage}.frame.base.ErrorType; +import ${basePackage}.frame.excel.WSheet; +import ${basePackage}.frame.excel.exception.ReadErrorException; +import ${basePackage}.frame.excel.exception.TemplateNotMatchException; +import ${basePackage}.frame.utils.LogUtil; 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.DictItem; import ${basePackage}.module.system.mgr.DictItemManager; import ${basePackage}.module.system.req.DictItemCreateRequest; @@ -54,7 +54,7 @@ public class DictItemAjax { return dictItemManager.get(request, LocalData.getToken()); } - public Object template(){ + public Object template() { return ResponseUtil.apply(new WSheet<>(DictItem.class)); } diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/system/FileAjax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/system/FileAjax.java index 58036961..57b1304a 100644 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/system/FileAjax.java +++ b/src/main/resources/modules/SpringBoot/java/action/ajax/system/FileAjax.java @@ -1,5 +1,12 @@ package ${basePackage}.action.ajax.system; +import com.fasterxml.jackson.core.TreeNode; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.multipart.MultipartFile; import ${basePackage}.frame.auth.LocalData; import ${basePackage}.frame.base.BaseResponse; import ${basePackage}.frame.base.ErrorType; @@ -21,13 +28,6 @@ import ${basePackage}.module.system.rsp.FileDeleteResponse; import ${basePackage}.module.system.rsp.FileFindResponse; import ${basePackage}.module.system.rsp.FileGetResponse; import ${basePackage}.module.system.rsp.FileUploadResponse; -import com.fasterxml.jackson.core.TreeNode; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.net.URLEncoder; @@ -54,7 +54,7 @@ public class FileAjax { return fileManager.get(request, LocalData.getToken()); } - public Object template(){ + public Object template() { return ResponseUtil.apply(new WSheet<>(File.class)); } diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/system/ResourceAjax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/system/ResourceAjax.java deleted file mode 100644 index 8ee6ec0f..00000000 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/system/ResourceAjax.java +++ /dev/null @@ -1,104 +0,0 @@ -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.auth.LocalData; -import ${basePackage}.frame.base.BaseResponse; -import ${basePackage}.frame.base.ErrorType; -import ${basePackage}.frame.excel.WSheet; -import ${basePackage}.frame.excel.exception.ReadErrorException; -import ${basePackage}.frame.excel.exception.TemplateNotMatchException; -import ${basePackage}.frame.utils.LogUtil; -import ${basePackage}.frame.utils.MapperUtil; -import ${basePackage}.frame.utils.ResponseUtil; -import ${basePackage}.frame.utils.ValidationUtil; -import ${basePackage}.module.system.ent.Resource; -import ${basePackage}.module.system.mgr.ResourceManager; -import ${basePackage}.module.system.req.ResourceCreateRequest; -import ${basePackage}.module.system.req.ResourceDeleteRequest; -import ${basePackage}.module.system.req.ResourceFindRequest; -import ${basePackage}.module.system.req.ResourceGetRequest; -import ${basePackage}.module.system.req.ResourceTreeRequest; -import ${basePackage}.module.system.req.ResourceUpdateRequest; -import ${basePackage}.module.system.rsp.ResourceCreateResponse; -import ${basePackage}.module.system.rsp.ResourceDeleteResponse; -import ${basePackage}.module.system.rsp.ResourceFindResponse; -import ${basePackage}.module.system.rsp.ResourceGetResponse; -import ${basePackage}.module.system.rsp.ResourceTreeResponse; -import ${basePackage}.module.system.rsp.ResourceUpdateResponse; - -import java.io.IOException; -import java.util.List; - -public class ResourceAjax { - - @Autowired - private ResourceManager resourceManager; - - public ResourceCreateResponse create(ResourceCreateRequest request) { - return resourceManager.create(request, LocalData.getToken()); - } - - public ResourceDeleteResponse delete(ResourceDeleteRequest request) { - return resourceManager.delete(request, LocalData.getToken()); - } - - public ResourceUpdateResponse update(ResourceUpdateRequest request) { - return resourceManager.update(request, LocalData.getToken()); - } - - public ResourceFindResponse find(ResourceFindRequest request) { - return resourceManager.find(request, LocalData.getToken()); - } - - public ResourceGetResponse get(ResourceGetRequest request) { - return resourceManager.get(request, LocalData.getToken()); - } - - public ResourceTreeResponse tree(ResourceTreeRequest request) { - return resourceManager.tree(request, LocalData.getToken()); - } - - public Object template() { - return ResponseUtil.apply(new WSheet<>(Resource.class)); - } - - public Object exports(TreeNode jsonParam) { - ResourceFindRequest request = MapperUtil.toJava(jsonParam, ResourceFindRequest.class); - ResourceFindResponse response = resourceManager.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 sheet = new WSheet<>(file.getBytes(), Resource.class, new WSheet.Validator() { - @Override - public List validate(Resource o) { - ResourceCreateRequest request = MapperUtil.map(o, ResourceCreateRequest.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; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/system/RoleAjax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/system/RoleAjax.java index 25410a1e..ca950e70 100644 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/system/RoleAjax.java +++ b/src/main/resources/modules/SpringBoot/java/action/ajax/system/RoleAjax.java @@ -3,16 +3,16 @@ 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.BaseResponse; import ${basePackage}.frame.base.ErrorType; +import ${basePackage}.frame.excel.WSheet; +import ${basePackage}.frame.excel.exception.ReadErrorException; +import ${basePackage}.frame.excel.exception.TemplateNotMatchException; +import ${basePackage}.frame.utils.LogUtil; 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.RoleCreateRequest; @@ -29,7 +29,7 @@ import ${basePackage}.module.system.rsp.RoleUpdateResponse; import java.io.IOException; import java.util.List; -public class RoleAjax{ +public class RoleAjax { @Autowired private RoleManager roleManager; @@ -54,7 +54,7 @@ public class RoleAjax{ return roleManager.get(request, LocalData.getToken()); } - public Object template(){ + public Object template() { return ResponseUtil.apply(new WSheet<>(Role.class)); } diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/system/RoleResAjax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/system/RoleResAjax.java index 215770e8..91ffb0be 100644 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/system/RoleResAjax.java +++ b/src/main/resources/modules/SpringBoot/java/action/ajax/system/RoleResAjax.java @@ -1,27 +1,22 @@ 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.RoleRes; import ${basePackage}.module.system.mgr.RoleResManager; -import ${basePackage}.module.system.req.*; -import ${basePackage}.module.system.rsp.*; - -import java.io.IOException; -import java.util.List; - -public class RoleResAjax{ +import ${basePackage}.module.system.req.RoleResCheckRequest; +import ${basePackage}.module.system.req.RoleResCreateRequest; +import ${basePackage}.module.system.req.RoleResDeleteRequest; +import ${basePackage}.module.system.req.RoleResFindRequest; +import ${basePackage}.module.system.req.RoleResGetRequest; +import ${basePackage}.module.system.req.RoleResUpdateRequest; +import ${basePackage}.module.system.rsp.RoleResCheckResponse; +import ${basePackage}.module.system.rsp.RoleResCreateResponse; +import ${basePackage}.module.system.rsp.RoleResDeleteResponse; +import ${basePackage}.module.system.rsp.RoleResFindResponse; +import ${basePackage}.module.system.rsp.RoleResGetResponse; +import ${basePackage}.module.system.rsp.RoleResUpdateResponse; + +public class RoleResAjax { @Autowired private RoleResManager roleResManager; @@ -45,4 +40,8 @@ public class RoleResAjax{ public RoleResGetResponse get(RoleResGetRequest request) { return roleResManager.get(request, LocalData.getToken()); } + + public RoleResCheckResponse check(RoleResCheckRequest request) { + return roleResManager.check(request, LocalData.getToken()); + } } diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/system/RoleResourceAjax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/system/RoleResourceAjax.java deleted file mode 100644 index 9a436759..00000000 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/system/RoleResourceAjax.java +++ /dev/null @@ -1,50 +0,0 @@ -package ${basePackage}.action.ajax.system; - -import org.springframework.beans.factory.annotation.Autowired; -import ${basePackage}.frame.auth.LocalData; -import ${basePackage}.module.system.mgr.RoleResourceManager; -import ${basePackage}.module.system.req.RoleResourceCheckRequest; -import ${basePackage}.module.system.req.RoleResourceCreateRequest; -import ${basePackage}.module.system.req.RoleResourceDeleteRequest; -import ${basePackage}.module.system.req.RoleResourceFindRequest; -import ${basePackage}.module.system.req.RoleResourceGetRequest; -import ${basePackage}.module.system.req.RoleResourceUpdateRequest; -import ${basePackage}.module.system.rsp.RoleResourceCheckResponse; -import ${basePackage}.module.system.rsp.RoleResourceCreateResponse; -import ${basePackage}.module.system.rsp.RoleResourceDeleteResponse; -import ${basePackage}.module.system.rsp.RoleResourceFindResponse; -import ${basePackage}.module.system.rsp.RoleResourceGetResponse; -import ${basePackage}.module.system.rsp.RoleResourceUpdateResponse; - -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()); - } - - public RoleResourceCheckResponse check(RoleResourceCheckRequest request) { - return roleResourceManager.check(request, LocalData.getToken()); - } -} diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/system/TokensAjax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/system/TokensAjax.java index 5d624d38..bf38f996 100644 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/system/TokensAjax.java +++ b/src/main/resources/modules/SpringBoot/java/action/ajax/system/TokensAjax.java @@ -3,16 +3,16 @@ 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.BaseResponse; import ${basePackage}.frame.base.ErrorType; +import ${basePackage}.frame.excel.WSheet; +import ${basePackage}.frame.excel.exception.ReadErrorException; +import ${basePackage}.frame.excel.exception.TemplateNotMatchException; +import ${basePackage}.frame.utils.LogUtil; 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.Tokens; import ${basePackage}.module.system.mgr.TokensManager; import ${basePackage}.module.system.req.TokensCreateRequest; @@ -31,7 +31,7 @@ import ${basePackage}.module.system.rsp.TokensUpdateResponse; import java.io.IOException; import java.util.List; -public class TokensAjax{ +public class TokensAjax { @Autowired private TokensManager tokensManager; @@ -60,7 +60,7 @@ public class TokensAjax{ return tokensManager.logout(request, LocalData.getToken()); } - public Object template(){ + public Object template() { return ResponseUtil.apply(new WSheet<>(Tokens.class)); } diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/system/UserAjax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/system/UserAjax.java index 271a0b7e..b6c30860 100644 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/system/UserAjax.java +++ b/src/main/resources/modules/SpringBoot/java/action/ajax/system/UserAjax.java @@ -44,7 +44,7 @@ import java.util.Date; import java.util.List; import java.util.UUID; -public class UserAjax{ +public class UserAjax { @Value("${r'${web.url.auth.admin}'}") private String admin; @@ -174,7 +174,7 @@ public class UserAjax{ return response; } - public Object template(){ + public Object template() { return ResponseUtil.apply(new WSheet<>(User.class)); } diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/system/UserRoleAjax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/system/UserRoleAjax.java index b6c828bb..d2d02a44 100644 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/system/UserRoleAjax.java +++ b/src/main/resources/modules/SpringBoot/java/action/ajax/system/UserRoleAjax.java @@ -14,10 +14,7 @@ import ${basePackage}.module.system.rsp.UserRoleFindResponse; import ${basePackage}.module.system.rsp.UserRoleGetResponse; import ${basePackage}.module.system.rsp.UserRoleUpdateResponse; -import java.io.IOException; -import java.util.List; - -public class UserRoleAjax{ +public class UserRoleAjax { @Autowired private UserRoleManager userRoleManager; diff --git a/src/main/resources/modules/SpringBoot/java/action/api/system/ResApi.java b/src/main/resources/modules/SpringBoot/java/action/api/system/ResApi.java new file mode 100644 index 00000000..d2d50001 --- /dev/null +++ b/src/main/resources/modules/SpringBoot/java/action/api/system/ResApi.java @@ -0,0 +1,47 @@ +package ${basePackage}.action.api.system; + +import org.springframework.beans.factory.annotation.Autowired; +import ${basePackage}.frame.auth.LocalData; +import ${basePackage}.module.system.mgr.ResManager; +import ${basePackage}.module.system.req.ResCreateRequest; +import ${basePackage}.module.system.req.ResDeleteRequest; +import ${basePackage}.module.system.req.ResFindRequest; +import ${basePackage}.module.system.req.ResGetRequest; +import ${basePackage}.module.system.req.ResTreeRequest; +import ${basePackage}.module.system.req.ResUpdateRequest; +import ${basePackage}.module.system.rsp.ResCreateResponse; +import ${basePackage}.module.system.rsp.ResDeleteResponse; +import ${basePackage}.module.system.rsp.ResFindResponse; +import ${basePackage}.module.system.rsp.ResGetResponse; +import ${basePackage}.module.system.rsp.ResTreeResponse; +import ${basePackage}.module.system.rsp.ResUpdateResponse; + +public class ResApi { + + @Autowired + private ResManager resManager; + + public ResCreateResponse create(ResCreateRequest request) { + return resManager.create(request, LocalData.getToken()); + } + + public ResDeleteResponse delete(ResDeleteRequest request) { + return resManager.delete(request, LocalData.getToken()); + } + + public ResUpdateResponse update(ResUpdateRequest request) { + return resManager.update(request, LocalData.getToken()); + } + + public ResFindResponse find(ResFindRequest request) { + return resManager.find(request, LocalData.getToken()); + } + + public ResGetResponse get(ResGetRequest request) { + return resManager.get(request, LocalData.getToken()); + } + + public ResTreeResponse tree(ResTreeRequest request) { + return resManager.tree(request, LocalData.getToken()); + } +} diff --git a/src/main/resources/modules/SpringBoot/java/action/api/system/ResourceApi.java b/src/main/resources/modules/SpringBoot/java/action/api/system/ResourceApi.java deleted file mode 100644 index db5136a9..00000000 --- a/src/main/resources/modules/SpringBoot/java/action/api/system/ResourceApi.java +++ /dev/null @@ -1,33 +0,0 @@ -package ${basePackage}.action.api.system; - -import ${basePackage}.frame.auth.LocalData; -import ${basePackage}.module.system.mgr.ResourceManager; -import ${basePackage}.module.system.req.*; -import ${basePackage}.module.system.rsp.*; -import org.springframework.beans.factory.annotation.Autowired; - -public class ResourceApi{ - - @Autowired - private ResourceManager resourceManager; - - public ResourceCreateResponse create(ResourceCreateRequest request) { - return resourceManager.create(request, LocalData.getToken()); - } - - public ResourceDeleteResponse delete(ResourceDeleteRequest request) { - return resourceManager.delete(request, LocalData.getToken()); - } - - public ResourceUpdateResponse update(ResourceUpdateRequest request) { - return resourceManager.update(request, LocalData.getToken()); - } - - public ResourceFindResponse find(ResourceFindRequest request) { - return resourceManager.find(request, LocalData.getToken()); - } - - public ResourceGetResponse get(ResourceGetRequest request) { - return resourceManager.get(request, LocalData.getToken()); - } -} diff --git a/src/main/resources/modules/SpringBoot/java/action/api/system/RoleResApi.java b/src/main/resources/modules/SpringBoot/java/action/api/system/RoleResApi.java new file mode 100644 index 00000000..5e9bf385 --- /dev/null +++ b/src/main/resources/modules/SpringBoot/java/action/api/system/RoleResApi.java @@ -0,0 +1,41 @@ +package ${basePackage}.action.ajax.system; + +import org.springframework.beans.factory.annotation.Autowired; +import ${basePackage}.frame.auth.LocalData; +import ${basePackage}.module.system.mgr.RoleResManager; +import ${basePackage}.module.system.req.RoleResCreateRequest; +import ${basePackage}.module.system.req.RoleResDeleteRequest; +import ${basePackage}.module.system.req.RoleResFindRequest; +import ${basePackage}.module.system.req.RoleResGetRequest; +import ${basePackage}.module.system.req.RoleResUpdateRequest; +import ${basePackage}.module.system.rsp.RoleResCreateResponse; +import ${basePackage}.module.system.rsp.RoleResDeleteResponse; +import ${basePackage}.module.system.rsp.RoleResFindResponse; +import ${basePackage}.module.system.rsp.RoleResGetResponse; +import ${basePackage}.module.system.rsp.RoleResUpdateResponse; + +public class RoleResApi{ + + @Autowired + private RoleResManager roleResManager; + + public RoleResCreateResponse create(RoleResCreateRequest request) { + return roleResManager.create(request, LocalData.getToken()); + } + + public RoleResDeleteResponse delete(RoleResDeleteRequest request) { + return roleResManager.delete(request, LocalData.getToken()); + } + + public RoleResUpdateResponse update(RoleResUpdateRequest request) { + return roleResManager.update(request, LocalData.getToken()); + } + + public RoleResFindResponse find(RoleResFindRequest request) { + return roleResManager.find(request, LocalData.getToken()); + } + + public RoleResGetResponse get(RoleResGetRequest request) { + return roleResManager.get(request, LocalData.getToken()); + } +} diff --git a/src/main/resources/modules/SpringBoot/java/action/api/system/RoleResourceApi.java b/src/main/resources/modules/SpringBoot/java/action/api/system/RoleResourceApi.java deleted file mode 100644 index 11ec4c9b..00000000 --- a/src/main/resources/modules/SpringBoot/java/action/api/system/RoleResourceApi.java +++ /dev/null @@ -1,33 +0,0 @@ -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()); - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/ent/Resource.java b/src/main/resources/modules/SpringBoot/java/module/system/ent/Resource.java deleted file mode 100644 index 65b74624..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/ent/Resource.java +++ /dev/null @@ -1,88 +0,0 @@ -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; - -/** - * RESOURCE - 资源 - * - * @author wangbing - * @version 0.0.1 - * @since 2019-12-27 - */ -@SheetName("资源") -public class Resource extends BaseEntity { - - /** - * CODE - 资源代码 - */ - @ColumnName("资源代码") - @ColumnDescription("") - private String code; - /** - * VALUE - 资源内容 - */ - @ColumnName("资源内容") - @ColumnDescription("") - private String value; - /** - * COMMENT - 资源描述 - */ - @ColumnName("资源描述") - @ColumnDescription("") - private String comment; - /** - * RESOURCE_TYPE - 资源类型 - */ - @ColumnName("资源类型") - @ColumnDescription("") - private String resourceType; - /** - * VALID - 是否有效 - */ - @ColumnName("是否有效") - @ColumnDescription("") - private Boolean valid; - - public String getCode() { - return this.code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getValue() { - return this.value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getComment() { - return this.comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public String getResourceType() { - return this.resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public Boolean getValid() { - return this.valid; - } - - public void setValid(Boolean valid) { - this.valid = valid; - } -} \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/java/module/system/ent/ResourceTree.java b/src/main/resources/modules/SpringBoot/java/module/system/ent/ResourceTree.java deleted file mode 100644 index 1cb224a8..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/ent/ResourceTree.java +++ /dev/null @@ -1,27 +0,0 @@ -package ${basePackage}.module.system.ent; - -import java.util.ArrayList; -import java.util.List; - -public class ResourceTree extends Resource { - - private Long pId; - - private List children = new ArrayList<>(); - - public Long getpId() { - return pId; - } - - public void setpId(Long pId) { - this.pId = pId; - } - - public List getChildren() { - return children; - } - - public void setChildren(List children) { - this.children = children; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/ent/RoleResource.java b/src/main/resources/modules/SpringBoot/java/module/system/ent/RoleResource.java deleted file mode 100644 index 62b4b9bb..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/ent/RoleResource.java +++ /dev/null @@ -1,38 +0,0 @@ -package ${basePackage}.module.system.ent; - -import ${basePackage}.frame.base.BaseEntity; - -/** - * ROLE_RESOURCE - 角色资源关系 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -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; - } -} \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mgr/ResourceManager.java b/src/main/resources/modules/SpringBoot/java/module/system/mgr/ResourceManager.java deleted file mode 100644 index 436dbd08..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/mgr/ResourceManager.java +++ /dev/null @@ -1,79 +0,0 @@ -package ${basePackage}.module.system.mgr; - -import ${basePackage}.frame.base.Token; -import ${basePackage}.module.system.req.ResourceCreateRequest; -import ${basePackage}.module.system.req.ResourceDeleteRequest; -import ${basePackage}.module.system.req.ResourceFindRequest; -import ${basePackage}.module.system.req.ResourceGetRequest; -import ${basePackage}.module.system.req.ResourceTreeRequest; -import ${basePackage}.module.system.req.ResourceUpdateRequest; -import ${basePackage}.module.system.rsp.ResourceCreateResponse; -import ${basePackage}.module.system.rsp.ResourceDeleteResponse; -import ${basePackage}.module.system.rsp.ResourceFindResponse; -import ${basePackage}.module.system.rsp.ResourceGetResponse; -import ${basePackage}.module.system.rsp.ResourceTreeResponse; -import ${basePackage}.module.system.rsp.ResourceUpdateResponse; - -/** - * 资源 - * - * @author author - * @version 0.0.1 - * @since 2017-01-01 - */ -public interface ResourceManager { - - /** - * 插入 - * - * @param request 请求对象 - * @param token 令牌 - * @return - */ - ResourceCreateResponse create(ResourceCreateRequest request, Token token); - - /** - * 逻辑删除 - * - * @param request 请求对象 - * @param token 令牌 - * @return - */ - ResourceDeleteResponse delete(ResourceDeleteRequest request, Token token); - - /** - * 更新 - * - * @param request 请求对象 - * @param token 令牌 - * @return - */ - ResourceUpdateResponse update(ResourceUpdateRequest request, Token token); - - /** - * 查询 - * - * @param request 请求对象 - * @param token 令牌 - * @return - */ - ResourceFindResponse find(ResourceFindRequest request, Token token); - - /** - * 获得对象 - * - * @param request 请求对象 - * @param token 令牌 - * @return - */ - ResourceGetResponse get(ResourceGetRequest request, Token token); - - /** - * 获得资源树 - * - * @param request 请求对象 - * @param token 令牌 - * @return - */ - ResourceTreeResponse tree(ResourceTreeRequest request, Token token); -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mgr/ResourceManagerImpl.java b/src/main/resources/modules/SpringBoot/java/module/system/mgr/ResourceManagerImpl.java deleted file mode 100644 index d99b3572..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/mgr/ResourceManagerImpl.java +++ /dev/null @@ -1,252 +0,0 @@ -package ${basePackage}.module.system.mgr; - -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; -import ${basePackage}.frame.base.ErrorType; -import ${basePackage}.frame.base.SortType; -import ${basePackage}.frame.base.Token; -import ${basePackage}.frame.utils.IDgenerator; -import ${basePackage}.frame.utils.MapperUtil; -import ${basePackage}.frame.utils.Message; -import ${basePackage}.frame.utils.ValidationUtil; -import ${basePackage}.module.system.ent.Resource; -import ${basePackage}.module.system.ent.ResourceTree; -import ${basePackage}.module.system.mpr.ResourceMapper; -import ${basePackage}.module.system.req.ResourceCreateRequest; -import ${basePackage}.module.system.req.ResourceDeleteRequest; -import ${basePackage}.module.system.req.ResourceFindRequest; -import ${basePackage}.module.system.req.ResourceGetRequest; -import ${basePackage}.module.system.req.ResourceTreeRequest; -import ${basePackage}.module.system.req.ResourceUpdateRequest; -import ${basePackage}.module.system.rsp.ResourceCreateResponse; -import ${basePackage}.module.system.rsp.ResourceDeleteResponse; -import ${basePackage}.module.system.rsp.ResourceFindResponse; -import ${basePackage}.module.system.rsp.ResourceGetResponse; -import ${basePackage}.module.system.rsp.ResourceTreeResponse; -import ${basePackage}.module.system.rsp.ResourceUpdateResponse; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -/** - * RESOURCE - 资源 - * - * @author author - * @version 0.0.1 - * @since 2017-01-01 - */ -@Transactional -@Service -public class ResourceManagerImpl implements ResourceManager { - - @Autowired - private ResourceMapper resourceMapper; - @Autowired - private DictItemManager dictItemManager; - - /** - * 插入 - * - * @param request 请求对象 - * @param token 令牌 - * @return 响应 - */ - public ResourceCreateResponse create(ResourceCreateRequest request, Token token) { - ResourceCreateResponse response = new ResourceCreateResponse(); - - ValidationUtil.validate(request, response); - if (response.hasError()) { - return response; - } - - long id = IDgenerator.nextId(); - Resource entity = MapperUtil.map(request, Resource.class); - entity.setId(id); - - long result = resourceMapper.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 ResourceDeleteResponse delete(ResourceDeleteRequest request, Token token) { - ResourceDeleteResponse response = new ResourceDeleteResponse(); - - ValidationUtil.validate(request, response); - if (response.hasError()) { - return response; - } - - long result = resourceMapper.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 ResourceUpdateResponse update(ResourceUpdateRequest request, Token token) { - ResourceUpdateResponse response = new ResourceUpdateResponse(); - - ValidationUtil.validate(request, response); - if (response.hasError()) { - return response; - } - - long result = resourceMapper.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 ResourceFindResponse find(ResourceFindRequest request, Token token) { - ResourceFindResponse response = new ResourceFindResponse(); - - 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 pageInfo = new PageInfo<>(resourceMapper.find(request, token)); - - response.setResult(pageInfo.getList()); - response.setTotalCount(pageInfo.getTotal()); - - return response; - } - - /** - * 获得对象 - * - * @param request 请求对象 - * @param token 令牌 - * @return 响应 - */ - @Transactional(readOnly = true) - public ResourceGetResponse get(ResourceGetRequest request, Token token) { - ResourceGetResponse response = new ResourceGetResponse(); - - ValidationUtil.validate(request, response); - if (response.hasError()) { - return response; - } - - Resource po = resourceMapper.get(request, token); - - if (po != null) { - response.setResource(po); - } else { - response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE); - } - - return response; - } - - @Override - public ResourceTreeResponse tree(ResourceTreeRequest request, Token token) { - ResourceTreeResponse response = new ResourceTreeResponse(); - - ValidationUtil.validate(request, response); - if (response.hasError()) { - return response; - } - - ResourceFindRequest resourceFindRequest = new ResourceFindRequest(); - resourceFindRequest.setPageSize(0); - resourceFindRequest.setValid(true); - resourceFindRequest.setSortType(SortType.ASC); - resourceFindRequest.setSortKey("CODE"); - ResourceFindResponse resourceFindResponse = this.find(resourceFindRequest, token); - - if (resourceFindResponse.hasError()) { - response.addErrors(resourceFindResponse.getErrors()); - return response; - } - - List data = new ArrayList<>(); - Map allMap = new HashMap<>(); - List result = resourceFindResponse.getResult(); - // 获取最顶级资源 - int level = 1; - while (result.size() > 0) { - Iterator iterator = result.iterator(); - while (iterator.hasNext()) { - Resource next = iterator.next(); - ResourceTree tree = new ResourceTree(); - tree.setId(next.getId()); - tree.setCode(next.getCode()); - tree.setResourceType(next.getResourceType()); - tree.setValid(next.getValid()); - tree.setComment(next.getComment()); - tree.setValue(next.getValue()); - tree.setRowVersion(next.getRowVersion()); - - if (next.getCode() != null && next.getCode().split("_").length == level) { - allMap.put(tree.getCode(), tree); - iterator.remove(); - //尝试获取上级资源 - String code = next.getCode(); - ResourceTree Ptree = null; - while (code.contains("_")) { - code = code.substring(0, code.lastIndexOf("_")); - Ptree = allMap.get(code); - if (Ptree != null) break; - } - if (Ptree != null) { - tree.setpId(Ptree.getId()); - Ptree.getChildren().add(tree); - } else { - data.add(tree); - } - } - } - level++; - } - - response.setResult(data); - return response; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResManager.java b/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResManager.java index f66fe301..8243abc5 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResManager.java +++ b/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResManager.java @@ -1,16 +1,18 @@ package ${basePackage}.module.system.mgr; +import ${basePackage}.frame.base.Token; +import ${basePackage}.module.system.req.RoleResCheckRequest; import ${basePackage}.module.system.req.RoleResCreateRequest; import ${basePackage}.module.system.req.RoleResDeleteRequest; import ${basePackage}.module.system.req.RoleResFindRequest; import ${basePackage}.module.system.req.RoleResGetRequest; import ${basePackage}.module.system.req.RoleResUpdateRequest; +import ${basePackage}.module.system.rsp.RoleResCheckResponse; import ${basePackage}.module.system.rsp.RoleResCreateResponse; import ${basePackage}.module.system.rsp.RoleResDeleteResponse; import ${basePackage}.module.system.rsp.RoleResFindResponse; import ${basePackage}.module.system.rsp.RoleResGetResponse; import ${basePackage}.module.system.rsp.RoleResUpdateResponse; -import ${basePackage}.frame.base.Token; /** * 角色资源关系 @@ -65,4 +67,13 @@ public interface RoleResManager { * @return */ RoleResGetResponse get(RoleResGetRequest request, Token token); + + /** + * 选中或取消资源 + * + * @param request 请求对象 + * @param token 令牌 + * @return 响应 + */ + RoleResCheckResponse check(RoleResCheckRequest request, Token token); } diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResManagerImpl.java b/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResManagerImpl.java index 8bf15e65..d0c01282 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResManagerImpl.java +++ b/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResManagerImpl.java @@ -1,29 +1,32 @@ package ${basePackage}.module.system.mgr; -import ${basePackage}.frame.utils.IDgenerator; -import ${basePackage}.frame.utils.Message; +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; +import org.springframework.transaction.interceptor.TransactionAspectSupport; import ${basePackage}.frame.base.ErrorType; import ${basePackage}.frame.base.Token; +import ${basePackage}.frame.utils.IDgenerator; import ${basePackage}.frame.utils.MapperUtil; +import ${basePackage}.frame.utils.Message; import ${basePackage}.frame.utils.ValidationUtil; import ${basePackage}.module.system.ent.RoleRes; import ${basePackage}.module.system.mpr.RoleResMapper; +import ${basePackage}.module.system.req.RoleResCheckRequest; import ${basePackage}.module.system.req.RoleResCreateRequest; import ${basePackage}.module.system.req.RoleResDeleteRequest; import ${basePackage}.module.system.req.RoleResFindRequest; import ${basePackage}.module.system.req.RoleResGetRequest; import ${basePackage}.module.system.req.RoleResUpdateRequest; +import ${basePackage}.module.system.rsp.RoleResCheckResponse; import ${basePackage}.module.system.rsp.RoleResCreateResponse; import ${basePackage}.module.system.rsp.RoleResDeleteResponse; import ${basePackage}.module.system.rsp.RoleResFindResponse; import ${basePackage}.module.system.rsp.RoleResGetResponse; import ${basePackage}.module.system.rsp.RoleResUpdateResponse; -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_RES - 角色资源关系 @@ -172,4 +175,53 @@ public class RoleResManagerImpl implements RoleResManager { return response; } + + /** + * 选中或取消资源 + * + * @param request 请求对象 + * @param token 令牌 + * @return 响应 + */ + public RoleResCheckResponse check(RoleResCheckRequest request, Token token) { + RoleResCheckResponse response = new RoleResCheckResponse(); + + ValidationUtil.validate(request, response); + if (response.hasError()) { + return response; + } + + RoleResFindRequest roleResFindRequest = new RoleResFindRequest(); + roleResFindRequest.setRoleId(request.getRoleId()); + roleResFindRequest.setResId(request.getResId()); + RoleResFindResponse roleResFindResponse = this.find(roleResFindRequest, token); + if (roleResFindResponse.hasError()) { + response.addErrors(roleResFindResponse.getErrors()); + return response; + } + + if (request.getChecked() && roleResFindResponse.getResult().size() == 0) { + RoleResCreateRequest roleResCreateRequest = new RoleResCreateRequest(); + roleResCreateRequest.setRoleId(request.getRoleId()); + roleResCreateRequest.setResId(request.getResId()); + RoleResCreateResponse roleResCreateResponse = this.create(roleResCreateRequest, token); + if (roleResCreateResponse.hasError()) { + response.addErrors(roleResCreateResponse.getErrors()); + return response; + } + } else if (!request.getChecked() && roleResFindResponse.getResult().size() > 0) { + for (RoleRes roleRes : roleResFindResponse.getResult()) { + RoleResDeleteRequest roleResDeleteRequest = new RoleResDeleteRequest(); + roleResDeleteRequest.setId(roleRes.getId()); + RoleResDeleteResponse roleResDeleteResponse = this.delete(roleResDeleteRequest, token); + if (roleResDeleteResponse.hasError()) { + response.addErrors(roleResDeleteResponse.getErrors()); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return response; + } + } + } + + return response; + } } diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResourceManager.java b/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResourceManager.java deleted file mode 100644 index 64c93a8a..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResourceManager.java +++ /dev/null @@ -1,79 +0,0 @@ -package ${basePackage}.module.system.mgr; - -import ${basePackage}.frame.base.Token; -import ${basePackage}.module.system.req.RoleResourceCheckRequest; -import ${basePackage}.module.system.req.RoleResourceCreateRequest; -import ${basePackage}.module.system.req.RoleResourceDeleteRequest; -import ${basePackage}.module.system.req.RoleResourceFindRequest; -import ${basePackage}.module.system.req.RoleResourceGetRequest; -import ${basePackage}.module.system.req.RoleResourceUpdateRequest; -import ${basePackage}.module.system.rsp.RoleResourceCheckResponse; -import ${basePackage}.module.system.rsp.RoleResourceCreateResponse; -import ${basePackage}.module.system.rsp.RoleResourceDeleteResponse; -import ${basePackage}.module.system.rsp.RoleResourceFindResponse; -import ${basePackage}.module.system.rsp.RoleResourceGetResponse; -import ${basePackage}.module.system.rsp.RoleResourceUpdateResponse; - -/** - * 角色资源关系 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -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); - - /** - * 选中或取消资源 - * - * @param request 请求对象 - * @param token 令牌 - * @return 响应 - */ - RoleResourceCheckResponse check(RoleResourceCheckRequest request, Token token); -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResourceManagerImpl.java b/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResourceManagerImpl.java deleted file mode 100644 index cd446ae1..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleResourceManagerImpl.java +++ /dev/null @@ -1,227 +0,0 @@ -package ${basePackage}.module.system.mgr; - -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; -import org.springframework.transaction.interceptor.TransactionAspectSupport; -import ${basePackage}.frame.base.ErrorType; -import ${basePackage}.frame.base.Token; -import ${basePackage}.frame.utils.IDgenerator; -import ${basePackage}.frame.utils.MapperUtil; -import ${basePackage}.frame.utils.Message; -import ${basePackage}.frame.utils.ValidationUtil; -import ${basePackage}.module.system.ent.RoleResource; -import ${basePackage}.module.system.mpr.RoleResourceMapper; -import ${basePackage}.module.system.req.RoleResourceCheckRequest; -import ${basePackage}.module.system.req.RoleResourceCreateRequest; -import ${basePackage}.module.system.req.RoleResourceDeleteRequest; -import ${basePackage}.module.system.req.RoleResourceFindRequest; -import ${basePackage}.module.system.req.RoleResourceGetRequest; -import ${basePackage}.module.system.req.RoleResourceUpdateRequest; -import ${basePackage}.module.system.rsp.RoleResourceCheckResponse; -import ${basePackage}.module.system.rsp.RoleResourceCreateResponse; -import ${basePackage}.module.system.rsp.RoleResourceDeleteResponse; -import ${basePackage}.module.system.rsp.RoleResourceFindResponse; -import ${basePackage}.module.system.rsp.RoleResourceGetResponse; -import ${basePackage}.module.system.rsp.RoleResourceUpdateResponse; - -/** - * ROLE_RESOURCE - 角色资源关系 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -@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 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; - } - - /** - * 选中或取消资源 - * - * @param request 请求对象 - * @param token 令牌 - * @return 响应 - */ - public RoleResourceCheckResponse check(RoleResourceCheckRequest request, Token token) { - RoleResourceCheckResponse response = new RoleResourceCheckResponse(); - - ValidationUtil.validate(request, response); - if (response.hasError()) { - return response; - } - - RoleResourceFindRequest roleResourceFindRequest = new RoleResourceFindRequest(); - roleResourceFindRequest.setRoleId(request.getRoleId()); - roleResourceFindRequest.setResourceId(request.getResourceId()); - RoleResourceFindResponse roleResourceFindResponse = this.find(roleResourceFindRequest, token); - if (roleResourceFindResponse.hasError()) { - response.addErrors(roleResourceFindResponse.getErrors()); - return response; - } - - if (request.getChecked() && roleResourceFindResponse.getResult().size() == 0) { - RoleResourceCreateRequest roleResourceCreateRequest = new RoleResourceCreateRequest(); - roleResourceCreateRequest.setRoleId(request.getRoleId()); - roleResourceCreateRequest.setResourceId(request.getResourceId()); - RoleResourceCreateResponse roleResourceCreateResponse = this.create(roleResourceCreateRequest, token); - if (roleResourceCreateResponse.hasError()) { - response.addErrors(roleResourceCreateResponse.getErrors()); - return response; - } - } else if (!request.getChecked() && roleResourceFindResponse.getResult().size() > 0) { - for (RoleResource roleResource : roleResourceFindResponse.getResult()) { - RoleResourceDeleteRequest roleResourceDeleteRequest = new RoleResourceDeleteRequest(); - roleResourceDeleteRequest.setId(roleResource.getId()); - RoleResourceDeleteResponse roleResourceDeleteResponse = this.delete(roleResourceDeleteRequest, token); - if (roleResourceDeleteResponse.hasError()) { - response.addErrors(roleResourceDeleteResponse.getErrors()); - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - return response; - } - } - } - - return response; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_ResourceMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_ResourceMapper.xml deleted file mode 100644 index 358a90f0..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_ResourceMapper.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - - `SYS_RESOURCE` - - - `ID`,`CODE`,`VALUE`,`COMMENT`,`RESOURCE_TYPE`,`VALID`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME` - - - - - - - - - - - - - - - - - - - - - - - INSERT INTO - - ( - - ) - VALUES - ( - ${r"#"}{request.id}, - ${r"#"}{request.code,jdbcType=VARCHAR}, - ${r"#"}{request.value,jdbcType=VARCHAR}, - ${r"#"}{request.comment,jdbcType=VARCHAR}, - ${r"#"}{request.resourceType,jdbcType=VARCHAR}, - ${r"#"}{request.valid,jdbcType=BIT}, - 0, - 0, - ${r"#"}{token.userId,jdbcType=NUMERIC}, - sysdate(), - NULL, - NULL - ) - - - - INSERT INTO - - ( - - ) - VALUES - - ( - ${r"#"}{item.id}, - ${r"#"}{item.code,jdbcType=VARCHAR}, - ${r"#"}{item.value,jdbcType=VARCHAR}, - ${r"#"}{item.comment,jdbcType=VARCHAR}, - ${r"#"}{item.resourceType,jdbcType=VARCHAR}, - ${r"#"}{item.valid,jdbcType=BIT}, - 0, - 0, - ${r"#"}{token.userId,jdbcType=NUMERIC}, - sysdate(), - NULL, - NULL - ) - - - - - UPDATE - - SET `IS_DELETED` = 1 - WHERE `IS_DELETED` = 0 - AND `ID` = ${r"#"}{request.id} - - - - UPDATE - - SET - `CODE` = ${r"#"}{request.code,jdbcType=VARCHAR}, - `VALUE` = ${r"#"}{request.value,jdbcType=VARCHAR}, - `COMMENT` = ${r"#"}{request.comment,jdbcType=VARCHAR}, - `RESOURCE_TYPE` = ${r"#"}{request.resourceType,jdbcType=VARCHAR}, - `VALID` = ${r"#"}{request.valid,jdbcType=BIT}, - `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} - - - - \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_RoleResourceMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_RoleResourceMapper.xml deleted file mode 100644 index 0b98fccc..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_RoleResourceMapper.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - `SYS_ROLE_RESOURCE` - - - `ID`,`ROLE_ID`,`RESOURCE_ID`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME` - - - - - - - - - - - - - - - - - - - - INSERT INTO - - ( - - ) - 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 INTO - - ( - - ) - VALUES - - ( - ${r"#"}{item.id}, - ${r"#"}{item.roleId,jdbcType=BIGINT}, - ${r"#"}{item.resourceId,jdbcType=BIGINT}, - 0, - 0, - ${r"#"}{token.userId,jdbcType=NUMERIC}, - sysdate(), - NULL, - NULL - ) - - - - - UPDATE - - SET `IS_DELETED` = 1 - WHERE `IS_DELETED` = 0 - AND `ID` = ${r"#"}{request.id} - - - - UPDATE - - 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} - - - - \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/ResourceMapper.java b/src/main/resources/modules/SpringBoot/java/module/system/mpr/ResourceMapper.java deleted file mode 100644 index dc6a2e43..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/ResourceMapper.java +++ /dev/null @@ -1,76 +0,0 @@ -package ${basePackage}.module.system.mpr; - -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; -import ${basePackage}.frame.base.Token; -import ${basePackage}.module.system.ent.Resource; -import ${basePackage}.module.system.req.ResourceDeleteRequest; -import ${basePackage}.module.system.req.ResourceFindRequest; -import ${basePackage}.module.system.req.ResourceGetRequest; -import ${basePackage}.module.system.req.ResourceUpdateRequest; - -import java.util.List; - -/** - * RESOURCE - 资源 - * - * @author author - * @date 2019-12-19 - */ -@Mapper -public interface ResourceMapper { - - /** - * 插入 - * - * @param request 请求对象 - * @param token 令牌 - * @return 返回数量 - */ - long insert(@Param("request") Resource request, @Param("token") Token token); - - /** - * 批量插入 - * - * @param request 请求对象 - * @param token 令牌 - * @return 返回数量 - */ - long insertBatch(@Param("list") List request, @Param("token") Token token); - - /** - * 逻辑删除 - * - * @param request 请求对象 - * @param token 令牌 - * @return 返回数量 - */ - long delete(@Param("request") ResourceDeleteRequest request, @Param("token") Token token); - - /** - * 更新 - * - * @param request 请求对象 - * @param token 令牌 - * @return 返回数量 - */ - long update(@Param("request") ResourceUpdateRequest request, @Param("token") Token token); - - /** - * 查询 - * - * @param request 请求对象 - * @param token 令牌 - * @return 返回对象 - */ - List find(@Param("request") ResourceFindRequest request, @Param("token") Token token); - - /** - * 获得对象 - * - * @param request 请求对象 - * @param token 令牌 - * @return 返回对象 - */ - Resource get(@Param("request") ResourceGetRequest request, @Param("token") Token token); -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/RoleResourceMapper.java b/src/main/resources/modules/SpringBoot/java/module/system/mpr/RoleResourceMapper.java deleted file mode 100644 index de70e493..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/RoleResourceMapper.java +++ /dev/null @@ -1,76 +0,0 @@ -package ${basePackage}.module.system.mpr; - -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; -import ${basePackage}.frame.base.Token; -import ${basePackage}.module.system.ent.RoleResource; -import ${basePackage}.module.system.req.RoleResourceDeleteRequest; -import ${basePackage}.module.system.req.RoleResourceFindRequest; -import ${basePackage}.module.system.req.RoleResourceGetRequest; -import ${basePackage}.module.system.req.RoleResourceUpdateRequest; - -import java.util.List; - -/** - * 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 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 find(@Param("request") RoleResourceFindRequest request, @Param("token") Token token); - - /** - * 获得对象 - * - * @param request 请求对象 - * @param token 令牌 - * @return 返回对象 - */ - RoleResource get(@Param("request") RoleResourceGetRequest request, @Param("token") Token token); -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/ResCreateRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/ResCreateRequest.java index 9c8754e9..adfa0ba1 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/ResCreateRequest.java +++ b/src/main/resources/modules/SpringBoot/java/module/system/req/ResCreateRequest.java @@ -25,7 +25,8 @@ public class ResCreateRequest extends BaseRequest { /** * 资源名称 */ - @Length(min = 0, max = 255, message = "[resName]资源名称长度不合法(0-255)") + @NotEmpty(message = "[resName]资源名称不能为空") + @Length(min = 0, max = 50, message = "[resName]资源名称长度不合法(0-50)") private String resName; /** @@ -38,7 +39,7 @@ public class ResCreateRequest extends BaseRequest { /** * 资源内容 */ - @Length(min = 0, max = 100, message = "[resValue]资源内容长度不合法(0-100)") + @Length(min = 0, max = 255, message = "[resValue]资源内容长度不合法(0-255)") private String resValue; /** diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/ResUpdateRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/ResUpdateRequest.java index 977e96c0..25624a44 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/ResUpdateRequest.java +++ b/src/main/resources/modules/SpringBoot/java/module/system/req/ResUpdateRequest.java @@ -31,7 +31,8 @@ public class ResUpdateRequest extends BaseUpdateRequest { /** * 资源名称 */ - @Length(min = 0, max = 255, message = "[resName]资源名称长度不合法(0-255)") + @NotEmpty(message = "[resName]资源名称不能为空") + @Length(min = 0, max = 50, message = "[resName]资源名称长度不合法(0-50)") private String resName; /** @@ -44,22 +45,9 @@ public class ResUpdateRequest extends BaseUpdateRequest { /** * 资源内容 */ - @NotEmpty(message = "[resValue]资源内容不能为空") - @Length(min = 0, max = 100, message = "[resValue]资源内容长度不合法(0-100)") + @Length(min = 0, max = 255, message = "[resValue]资源内容长度不合法(0-255)") private String resValue; - /** - * 上级代码 - */ - @Length(min = 0, max = 50, message = "[supCode]上级代码长度不合法(0-50)") - private String supCode; - - /** - * 上级名称 - */ - @Length(min = 0, max = 50, message = "[supName]上级名称长度不合法(0-50)") - private String supName; - /** * 是否有效 */ @@ -106,22 +94,6 @@ public class ResUpdateRequest extends BaseUpdateRequest { this.resValue = resValue; } - public String getSupCode() { - return this.supCode; - } - - public void setSupCode(String supCode) { - this.supCode = supCode; - } - - public String getSupName() { - return this.supName; - } - - public void setSupName(String supName) { - this.supName = supName; - } - public Boolean getValid() { return this.valid; } @@ -130,3 +102,4 @@ public class ResUpdateRequest extends BaseUpdateRequest { this.valid = valid; } } + diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceCreateRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceCreateRequest.java deleted file mode 100644 index 9771ebe3..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceCreateRequest.java +++ /dev/null @@ -1,90 +0,0 @@ -package ${basePackage}.module.system.req; - -import ${basePackage}.frame.base.BaseRequest; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.NotEmpty; -import org.hibernate.validator.constraints.Length; -import ${basePackage}.frame.validation.Dict; - -/** - * ResourceCreateRequest - 资源新增 - * - * @author wangbing - * @version 0.0.1 - * @since 2019-12-27 - */ -public class ResourceCreateRequest extends BaseRequest { - - /** - * 资源代码 - */ - @NotEmpty(message = "[code]资源代码不能为空") - @Length(min = 0, max = 50, message = "[code]资源代码长度不合法(0-50)") - private String code; - - /** - * 资源内容 - */ - @NotEmpty(message = "[value]资源内容不能为空") - @Length(min = 0, max = 100, message = "[value]资源内容长度不合法(0-100)") - private String value; - - /** - * 资源描述 - */ - @Length(min = 0, max = 255, message = "[comment]资源描述长度不合法(0-255)") - private String comment; - - /** - * 资源类型 - */ - @NotNull(message = "[resourceType]资源类型不能为NULL") - @Dict(name = "RESOURCE_TYPE") - private String resourceType; - - /** - * 是否有效 - */ - @NotNull(message = "[valid]是否有效不能为NULL") - private Boolean valid; - - public String getCode() { - return this.code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getValue() { - return this.value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getComment() { - return this.comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public String getResourceType() { - return this.resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public Boolean getValid() { - return this.valid; - } - - public void setValid(Boolean valid) { - this.valid = valid; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceDeleteRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceDeleteRequest.java deleted file mode 100644 index c734d985..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceDeleteRequest.java +++ /dev/null @@ -1,28 +0,0 @@ -package ${basePackage}.module.system.req; - -import ${basePackage}.frame.base.BaseUpdateRequest; -import javax.validation.constraints.NotNull; - -/** - * ResourceDeleteRequest - 资源删除 - * - * @author wangbing - * @version 0.0.1 - * @since 2019-12-27 - */ -public class ResourceDeleteRequest extends BaseUpdateRequest { - - /** - * 主键 - */ - @NotNull(message = "[id]主键不能为空") - private long id; - - public long getId() { - return this.id; - } - - public void setId(long id) { - this.id = id; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceFindRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceFindRequest.java deleted file mode 100644 index 2a094f92..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceFindRequest.java +++ /dev/null @@ -1,80 +0,0 @@ -package ${basePackage}.module.system.req; - -import ${basePackage}.frame.base.BaseFindRequest; -import ${basePackage}.frame.validation.Dict; - -/** - * ResourceRequest - 资源查询 - * - * @author wangbing - * @version 0.0.1 - * @since 2019-12-27 - */ -public class ResourceFindRequest extends BaseFindRequest { - - /** - * 资源代码 - */ - private String code; - - /** - * 资源内容 - */ - private String value; - - /** - * 资源描述 - */ - private String comment; - - /** - * 资源类型 - */ - @Dict(name = "RESOURCE_TYPE") - private String resourceType; - - /** - * 是否有效 - */ - private Boolean valid; - - public String getCode() { - return this.code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getValue() { - return this.value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getComment() { - return this.comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public String getResourceType() { - return this.resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public Boolean getValid() { - return this.valid; - } - - public void setValid(Boolean valid) { - this.valid = valid; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceGetRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceGetRequest.java deleted file mode 100644 index c00eea90..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceGetRequest.java +++ /dev/null @@ -1,28 +0,0 @@ -package ${basePackage}.module.system.req; - -import ${basePackage}.frame.base.BaseRequest; -import javax.validation.constraints.NotNull; - -/** - * ResourceGetRequest - 资源获取 - * - * @author wangbing - * @version 0.0.1 - * @since 2019-12-27 - */ -public class ResourceGetRequest extends BaseRequest { - - /** - * 主键 - */ - @NotNull(message = "[id]主键不能为空") - private long id; - - public long getId() { - return this.id; - } - - public void setId(long id) { - this.id = id; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceTreeRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceTreeRequest.java deleted file mode 100644 index b8f42f96..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceTreeRequest.java +++ /dev/null @@ -1,14 +0,0 @@ -package ${basePackage}.module.system.req; - -import ${basePackage}.frame.base.BaseRequest; - -/** - * ResourceTreeRequest - 资源获取 - * - * @author wangbing - * @version 0.0.1 - * @since 2019-12-26 - */ -public class ResourceTreeRequest extends BaseRequest { - -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceUpdateRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceUpdateRequest.java deleted file mode 100644 index 3c2a9966..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/ResourceUpdateRequest.java +++ /dev/null @@ -1,104 +0,0 @@ -package ${basePackage}.module.system.req; - -import ${basePackage}.frame.base.BaseUpdateRequest; -import javax.validation.constraints.NotNull; -import org.hibernate.validator.constraints.Length; -import javax.validation.constraints.NotEmpty; -import ${basePackage}.frame.validation.Dict; - -/** - * ResourceUpdateRequest - 资源更新 - * - * @author wangbing - * @version 0.0.1 - * @since 2019-12-27 - */ -public class ResourceUpdateRequest extends BaseUpdateRequest { - - /** - * 主键 - */ - @NotNull(message = "[id]主键不能为NULL") - private Long id; - - /** - * 资源代码 - */ - @NotEmpty(message = "[code]资源代码不能为空") - @Length(min = 0, max = 50, message = "[code]资源代码长度不合法(0-50)") - private String code; - - /** - * 资源内容 - */ - @NotEmpty(message = "[value]资源内容不能为空") - @Length(min = 0, max = 100, message = "[value]资源内容长度不合法(0-100)") - private String value; - - /** - * 资源描述 - */ - @Length(min = 0, max = 255, message = "[comment]资源描述长度不合法(0-255)") - private String comment; - - /** - * 资源类型 - */ - @NotNull(message = "[resourceType]资源类型不能为NULL") - @Dict(name = "RESOURCE_TYPE") - private String resourceType; - - /** - * 是否有效 - */ - @NotNull(message = "[valid]是否有效不能为NULL") - private Boolean valid; - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getCode() { - return this.code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getValue() { - return this.value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getComment() { - return this.comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public String getResourceType() { - return this.resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public Boolean getValid() { - return this.valid; - } - - public void setValid(Boolean valid) { - this.valid = valid; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResCheckRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResCheckRequest.java new file mode 100644 index 00000000..f97112e5 --- /dev/null +++ b/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResCheckRequest.java @@ -0,0 +1,87 @@ +package ${basePackage}.module.system.req; + +import ${basePackage}.frame.base.BaseUpdateRequest; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * RoleResCheckRequest - 角色资源切换 + * + * @author wangbing + * @version 0.0.1 + * @since 2017-01-01 + */ +public class RoleResCheckRequest extends BaseUpdateRequest { + + /** + * 角色主键 + */ + @NotNull(message = "[roleId]资源主键不能为NULL") + private Long roleId; + + /** + * 角色代码 + */ + @NotBlank(message = "[roleCode]资源代码不能为NULL") + private String roleCode; + + /** + * 资源主键 + */ + @NotNull(message = "[resId]资源主键不能为NULL") + private Long resId; + + /** + * 资源代码 + */ + @NotBlank(message = "[resCode]资源代码不能为NULL") + private String resCode; + + /** + * 是否选中 + */ + @NotNull(message = "[checked]是否选中不能为NULL") + private Boolean checked; + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + public String getRoleCode() { + return roleCode; + } + + public void setRoleCode(String roleCode) { + this.roleCode = roleCode; + } + + public Long getResId() { + return resId; + } + + public void setResId(Long resId) { + this.resId = resId; + } + + public String getResCode() { + return resCode; + } + + public void setResCode(String resCode) { + this.resCode = resCode; + } + + public Boolean getChecked() { + return checked; + } + + public void setChecked(Boolean checked) { + this.checked = checked; + } +} + diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceCheckRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceCheckRequest.java deleted file mode 100644 index 2a8ca27a..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceCheckRequest.java +++ /dev/null @@ -1,58 +0,0 @@ -package ${basePackage}.module.system.req; - -import ${basePackage}.frame.base.BaseUpdateRequest; - -import javax.validation.constraints.NotNull; - -/** - * RoleResourceUpdateRequest - 角色资源关系更新 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -public class RoleResourceCheckRequest extends BaseUpdateRequest { - - /** - * 角色主键 - */ - @NotNull(message = "[roleId]角色主键不能为NULL") - private Long roleId; - - /** - * 资源主键 - */ - @NotNull(message = "[resourceId]资源主键不能为NULL") - private Long resourceId; - - /** - * 是否选中 - */ - @NotNull(message = "[checked]是否选中不能为NULL") - private Boolean checked; - - 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; - } - - public Boolean getChecked() { - return checked; - } - - public void setChecked(Boolean checked) { - this.checked = checked; - } -} - diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceCreateRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceCreateRequest.java deleted file mode 100644 index fa1a8c83..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceCreateRequest.java +++ /dev/null @@ -1,44 +0,0 @@ -package ${basePackage}.module.system.req; - -import ${basePackage}.frame.base.BaseRequest; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.NotEmpty; -import org.hibernate.validator.constraints.Length; - -/** - * RoleResourceCreateRequest - 角色资源关系新增 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -public class RoleResourceCreateRequest extends BaseRequest { - - /** - * 角色主键 - */ - @NotNull(message = "[roleId]角色主键不能为NULL") - private Long roleId; - - /** - * 资源主键 - */ - @NotNull(message = "[resourceId]资源主键不能为NULL") - 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; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceDeleteRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceDeleteRequest.java deleted file mode 100644 index ea0c5813..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceDeleteRequest.java +++ /dev/null @@ -1,28 +0,0 @@ -package ${basePackage}.module.system.req; - -import ${basePackage}.frame.base.BaseUpdateRequest; -import javax.validation.constraints.NotNull; - -/** - * RoleResourceDeleteRequest - 角色资源关系删除 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -public class RoleResourceDeleteRequest extends BaseUpdateRequest { - - /** - * 主键 - */ - @NotNull(message = "[id]主键不能为空") - private long id; - - public long getId() { - return this.id; - } - - public void setId(long id) { - this.id = id; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceFindRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceFindRequest.java deleted file mode 100644 index 881836bd..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceFindRequest.java +++ /dev/null @@ -1,39 +0,0 @@ -package ${basePackage}.module.system.req; - -import ${basePackage}.frame.base.BaseFindRequest; - -/** - * RoleResourceRequest - 角色资源关系查询 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -public class RoleResourceFindRequest extends BaseFindRequest { - - /** - * 角色主键 - */ - private Long roleId; - - /** - * 资源主键 - */ - 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; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceGetRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceGetRequest.java deleted file mode 100644 index e73adb4c..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceGetRequest.java +++ /dev/null @@ -1,28 +0,0 @@ -package ${basePackage}.module.system.req; - -import ${basePackage}.frame.base.BaseRequest; -import javax.validation.constraints.NotNull; - -/** - * RoleResourceGetRequest - 角色资源关系获取 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -public class RoleResourceGetRequest extends BaseRequest { - - /** - * 主键 - */ - @NotNull(message = "[id]主键不能为空") - private long id; - - public long getId() { - return this.id; - } - - public void setId(long id) { - this.id = id; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceUpdateRequest.java b/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceUpdateRequest.java deleted file mode 100644 index b400049b..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/req/RoleResourceUpdateRequest.java +++ /dev/null @@ -1,58 +0,0 @@ -package ${basePackage}.module.system.req; - -import ${basePackage}.frame.base.BaseUpdateRequest; -import javax.validation.constraints.NotNull; -import org.hibernate.validator.constraints.Length; -import javax.validation.constraints.NotEmpty; - -/** - * RoleResourceUpdateRequest - 角色资源关系更新 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -public class RoleResourceUpdateRequest extends BaseUpdateRequest { - - /** - * 主键 - */ - @NotNull(message = "[id]主键不能为NULL") - private Long id; - - /** - * 角色主键 - */ - @NotNull(message = "[roleId]角色主键不能为NULL") - private Long roleId; - - /** - * 资源主键 - */ - @NotNull(message = "[resourceId]资源主键不能为NULL") - private Long resourceId; - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - 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; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceCreateResponse.java b/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceCreateResponse.java deleted file mode 100644 index 871e5633..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceCreateResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -package ${basePackage}.module.system.rsp; - -import ${basePackage}.frame.base.BaseResponse; - -/** - * ResourceCreateResponse - 资源 - * - * @author author - * @version 0.0.1 - * @since 2017-01-01 - */ -public class ResourceCreateResponse extends BaseResponse { - - /** - * ID - */ - private Long id; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceDeleteResponse.java b/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceDeleteResponse.java deleted file mode 100644 index 9afd64e6..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceDeleteResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -package ${basePackage}.module.system.rsp; - -import ${basePackage}.frame.base.BaseResponse; - -/** - * ResourceDeleteResponse - 资源 - * - * @author author - * @version 0.0.1 - * @since 2017-01-01 - */ -public class ResourceDeleteResponse extends BaseResponse { - - /** - * 删除数目 - */ - private Long result; - - public Long getResult() { - return this.result; - } - - public void setResult(Long result) { - this.result = result; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceFindResponse.java b/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceFindResponse.java deleted file mode 100644 index 38753b53..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceFindResponse.java +++ /dev/null @@ -1,14 +0,0 @@ -package ${basePackage}.module.system.rsp; - -import ${basePackage}.frame.base.BaseFindResponse; -import ${basePackage}.module.system.ent.Resource; - -/** - * ResourceFindResponse - 资源 - * - * @author author - * @version 0.0.1 - * @since 2017-01-01 - */ -public class ResourceFindResponse extends BaseFindResponse { -} \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceGetResponse.java b/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceGetResponse.java deleted file mode 100644 index a80159ca..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceGetResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -package ${basePackage}.module.system.rsp; - -import ${basePackage}.module.system.ent.Resource; -import ${basePackage}.frame.base.BaseResponse; - -/** - * ResourceGetResponse - 资源 - * - * @author author - * @version 0.0.1 - * @since 2017-01-01 - */ -public class ResourceGetResponse extends BaseResponse { - - /** - * 资源 - */ - private Resource resource; - - public Resource getResource() { - return this.resource; - } - - public void setResource(Resource resource) { - this.resource = resource; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceTreeResponse.java b/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceTreeResponse.java deleted file mode 100644 index ae09909d..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceTreeResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package ${basePackage}.module.system.rsp; - -import ${basePackage}.frame.base.BaseFindResponse; -import ${basePackage}.module.system.ent.ResourceTree; - -/** - * ResourceTreeResponse - 资源 - * - * @author author - * @version 0.0.1 - * @since 2017-01-01 - */ -public class ResourceTreeResponse extends BaseFindResponse { - -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceUpdateResponse.java b/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceUpdateResponse.java deleted file mode 100644 index 60b02735..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/rsp/ResourceUpdateResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -package ${basePackage}.module.system.rsp; - -import ${basePackage}.frame.base.BaseResponse; - -/** - * ResourceUpdateResponse - 资源 - * - * @author author - * @version 0.0.1 - * @since 2017-01-01 - */ -public class ResourceUpdateResponse extends BaseResponse { - - /** - * 更新数目 - */ - private Long result; - - public Long getResult() { - return this.result; - } - - public void setResult(Long result) { - this.result = result; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceCheckResponse.java b/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResCheckResponse.java similarity index 85% rename from src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceCheckResponse.java rename to src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResCheckResponse.java index 72d79d60..1bea6e50 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceCheckResponse.java +++ b/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResCheckResponse.java @@ -9,7 +9,7 @@ import ${basePackage}.frame.base.BaseResponse; * @version 0.0.1 * @since 2017-01-01 */ -public class RoleResourceCheckResponse extends BaseResponse { +public class RoleResCheckResponse extends BaseResponse { /** * ID diff --git a/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceCreateResponse.java b/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceCreateResponse.java deleted file mode 100644 index 0e678c6f..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceCreateResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -package ${basePackage}.module.system.rsp; - -import ${basePackage}.frame.base.BaseResponse; - -/** - * RoleResourceCreateResponse - 角色资源关系 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -public class RoleResourceCreateResponse extends BaseResponse { - - /** - * ID - */ - private Long id; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceDeleteResponse.java b/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceDeleteResponse.java deleted file mode 100644 index 61b941f7..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceDeleteResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -package ${basePackage}.module.system.rsp; - -import ${basePackage}.frame.base.BaseResponse; - -/** - * RoleResourceDeleteResponse - 角色资源关系 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -public class RoleResourceDeleteResponse extends BaseResponse { - - /** - * 删除数目 - */ - private Long result; - - public Long getResult() { - return this.result; - } - - public void setResult(Long result) { - this.result = result; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceFindResponse.java b/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceFindResponse.java deleted file mode 100644 index f08a4c8f..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceFindResponse.java +++ /dev/null @@ -1,14 +0,0 @@ -package ${basePackage}.module.system.rsp; - -import ${basePackage}.frame.base.BaseFindResponse; -import ${basePackage}.module.system.ent.RoleResource; - -/** - * RoleResourceFindResponse - 角色资源关系 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -public class RoleResourceFindResponse extends BaseFindResponse { -} \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceGetResponse.java b/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceGetResponse.java deleted file mode 100644 index f72f1072..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceGetResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -package ${basePackage}.module.system.rsp; - -import ${basePackage}.module.system.ent.RoleResource; -import ${basePackage}.frame.base.BaseResponse; - -/** - * RoleResourceGetResponse - 角色资源关系 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -public class RoleResourceGetResponse extends BaseResponse { - - /** - * 角色资源关系 - */ - private RoleResource roleResource; - - public RoleResource getRoleResource() { - return this.roleResource; - } - - public void setRoleResource(RoleResource roleResource) { - this.roleResource = roleResource; - } -} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceUpdateResponse.java b/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceUpdateResponse.java deleted file mode 100644 index 36656b70..00000000 --- a/src/main/resources/modules/SpringBoot/java/module/system/rsp/RoleResourceUpdateResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -package ${basePackage}.module.system.rsp; - -import ${basePackage}.frame.base.BaseResponse; - -/** - * RoleResourceUpdateResponse - 角色资源关系 - * - * @author wangbing - * @version 0.0.1 - * @since 2017-01-01 - */ -public class RoleResourceUpdateResponse extends BaseResponse { - - /** - * 更新数目 - */ - private Long result; - - public Long getResult() { - return this.result; - } - - public void setResult(Long result) { - this.result = result; - } -} diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/system/MySQL_ALL_TABLE.sql b/src/main/resources/modules/SpringBoot/resources/dbtool/system/MySQL_ALL_TABLE.sql index 131a3173..f7b52ba4 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/system/MySQL_ALL_TABLE.sql +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/system/MySQL_ALL_TABLE.sql @@ -48,20 +48,20 @@ PRIMARY KEY (`ID`) -- Date: : 2020-01-05 -- ---------------------------- CREATE TABLE `SYS_RES` ( - `ID` BIGINT(20) NOT NULL COMMENT '主键', - `RES_CODE` VARCHAR(50) NOT NULL COMMENT '资源代码', - `RES_NAME` VARCHAR(250) COMMENT '资源名称', - `RES_TYPE` VARCHAR(20) NOT NULL COMMENT '资源类型', - `RES_VALUE` VARCHAR(100) NOT NULL COMMENT '资源内容', - `SUP_CODE` VARCHAR(50) COMMENT '上级代码', - `SUP_NAME` VARCHAR(50) COMMENT '上级名称', - `VALID` TINYINT(1) NOT NULL COMMENT '是否有效', - `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', - `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', - `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户', - `LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间', + `ID` BIGINT(20) NOT NULL COMMENT '主键', + `RES_CODE` VARCHAR(50) NOT NULL COMMENT '资源代码', + `RES_NAME` VARCHAR(50) NOT NULL COMMENT '资源名称', + `RES_TYPE` VARCHAR(20) NOT NULL COMMENT '资源类型', + `RES_VALUE` VARCHAR(250) COMMENT '资源内容', + `SUP_CODE` VARCHAR(50) COMMENT '上级代码', + `SUP_NAME` VARCHAR(50) COMMENT '上级名称', + `VALID` TINYINT(1) NOT NULL COMMENT '是否有效', + `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', + `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', + `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', + `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', + `LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户', + `LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='资源'; diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/system/MySQL_RES.sql b/src/main/resources/modules/SpringBoot/resources/dbtool/system/MySQL_RES.sql index 0de877ac..0d7d9897 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/system/MySQL_RES.sql +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/system/MySQL_RES.sql @@ -7,9 +7,9 @@ CREATE TABLE `SYS_RES` ( `ID` BIGINT(20) NOT NULL COMMENT '主键', `RES_CODE` VARCHAR(50) NOT NULL COMMENT '资源代码', - `RES_NAME` VARCHAR(250) COMMENT '资源名称', + `RES_NAME` VARCHAR(50) NOT NULL COMMENT '资源名称', `RES_TYPE` VARCHAR(20) NOT NULL COMMENT '资源类型', - `RES_VALUE` VARCHAR(100) NOT NULL COMMENT '资源内容', + `RES_VALUE` VARCHAR(250) COMMENT '资源内容', `SUP_CODE` VARCHAR(50) COMMENT '上级代码', `SUP_NAME` VARCHAR(50) COMMENT '上级名称', `VALID` TINYINT(1) NOT NULL COMMENT '是否有效', diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/system/MySQL_RESOURCE.sql b/src/main/resources/modules/SpringBoot/resources/dbtool/system/MySQL_RESOURCE.sql deleted file mode 100644 index 3b29462f..00000000 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/system/MySQL_RESOURCE.sql +++ /dev/null @@ -1,21 +0,0 @@ --- ---------------------------- --- Table structure for RESOURCE - 资源 --- Target : MySQL --- Author : wangbing --- Date: : 2019-12-27 --- ---------------------------- -CREATE TABLE `SYS_RESOURCE` ( - `ID` BIGINT(20) NOT NULL COMMENT '主键', - `CODE` VARCHAR(50) NOT NULL COMMENT '资源代码', - `VALUE` VARCHAR(100) NOT NULL COMMENT '资源内容', - `COMMENT` VARCHAR(250) COMMENT '资源描述', - `RESOURCE_TYPE` VARCHAR(20) NOT NULL COMMENT '资源类型', - `VALID` TINYINT(1) NOT NULL COMMENT '是否有效', - `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', - `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', - `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户', - `LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间', -PRIMARY KEY (`ID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='资源'; diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/wadmin.xml b/src/main/resources/modules/SpringBoot/resources/dbtool/wadmin.xml index 79e049bd..fa797f12 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/wadmin.xml +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/wadmin.xml @@ -47,9 +47,9 @@ - + - + diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/res.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/res.ftl index 6e7ad817..022facf6 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/res.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/res.ftl @@ -276,7 +276,7 @@ ], resName: [ {required: true, message: '资源名称不能为空', trigger: 'blur'}, - {min: 1, max: 100, message: '资源名称长度在 1 到 100 个字符', trigger: 'blur'} + {min: 1, max: 50, message: '资源名称长度在 1 到 50 个字符', trigger: 'blur'} ], resType: [ {required: true, message: '资源类型不能为空', trigger: 'blur'}, diff --git a/src/main/resources/modules/SpringBoot/test/system/DeptTest.java b/src/main/resources/modules/SpringBoot/test/system/DeptTest.java index 209c8491..1c7db75d 100644 --- a/src/main/resources/modules/SpringBoot/test/system/DeptTest.java +++ b/src/main/resources/modules/SpringBoot/test/system/DeptTest.java @@ -9,12 +9,19 @@ import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; import ${basePackage}.frame.base.Token; import ${basePackage}.module.system.mgr.DeptManager; -import ${basePackage}.module.system.req.*; -import ${basePackage}.module.system.rsp.*; +import ${basePackage}.module.system.req.DeptCreateRequest; +import ${basePackage}.module.system.req.DeptDeleteRequest; +import ${basePackage}.module.system.req.DeptFindRequest; +import ${basePackage}.module.system.req.DeptGetRequest; +import ${basePackage}.module.system.req.DeptUpdateRequest; +import ${basePackage}.module.system.rsp.DeptCreateResponse; +import ${basePackage}.module.system.rsp.DeptDeleteResponse; +import ${basePackage}.module.system.rsp.DeptFindResponse; +import ${basePackage}.module.system.rsp.DeptGetResponse; +import ${basePackage}.module.system.rsp.DeptUpdateResponse; import static org.junit.Assert.assertTrue; - /** * DeptTest - - 部门测试用例 * @@ -42,7 +49,7 @@ public class DeptTest { request.setDeptName("开发部"); request.setDeptAlias("开发部"); request.setValid(true); - DeptCreateResponse response = deptManager.create(request,token); + DeptCreateResponse response = deptManager.create(request, token); assertTrue(!response.hasError()); } { @@ -51,7 +58,7 @@ public class DeptTest { request.setDeptName("开发部开发一组"); request.setDeptAlias("开发一组"); request.setValid(true); - DeptCreateResponse response = deptManager.create(request,token); + DeptCreateResponse response = deptManager.create(request, token); assertTrue(!response.hasError()); } } @@ -66,14 +73,14 @@ public class DeptTest { createRequest.setDeptAlias("开发部"); createRequest.setValid(true); - DeptCreateResponse createResponse = deptManager.create(createRequest,token); + DeptCreateResponse createResponse = deptManager.create(createRequest, token); assertTrue(!createResponse.hasError() && createResponse.getId() > 0); //删除数据 DeptDeleteRequest request = new DeptDeleteRequest(); request.setId(createResponse.getId()); - DeptDeleteResponse response = deptManager.delete(request,token); + DeptDeleteResponse response = deptManager.delete(request, token); assertTrue(!response.hasError() && response.getResult() == 1L); } @@ -99,7 +106,7 @@ public class DeptTest { request.setDeptAlias("开发部"); request.setValid(true); - DeptUpdateResponse response = deptManager.update(request,token); + DeptUpdateResponse response = deptManager.update(request, token); assertTrue(!response.hasError() && response.getResult() == 1L); } @@ -112,7 +119,7 @@ public class DeptTest { request.setDeptAlias("开发部"); request.setValid(true); - DeptFindResponse response = deptManager.find(request,token); + DeptFindResponse response = deptManager.find(request, token); assertTrue(!response.hasError()); } @@ -134,7 +141,7 @@ public class DeptTest { DeptGetRequest request = new DeptGetRequest(); request.setId(createResponse.getId()); - DeptGetResponse response = deptManager.get(request,token); + DeptGetResponse response = deptManager.get(request, token); assertTrue(!response.hasError() && response.getDept() != null); } diff --git a/src/main/resources/modules/SpringBoot/test/system/DictItemTest.java b/src/main/resources/modules/SpringBoot/test/system/DictItemTest.java index 09665bb8..6be31526 100644 --- a/src/main/resources/modules/SpringBoot/test/system/DictItemTest.java +++ b/src/main/resources/modules/SpringBoot/test/system/DictItemTest.java @@ -21,7 +21,6 @@ import ${basePackage}.module.system.rsp.DictItemUpdateResponse; import static org.junit.Assert.assertTrue; - /** * DictItemTest - - 字典项测试用例 * @@ -49,7 +48,7 @@ public class DictItemTest { request.setSort(1); request.setValid(true); - DictItemCreateResponse response = dictItemManager.create(request,token); + DictItemCreateResponse response = dictItemManager.create(request, token); assertTrue(!response.hasError()); } @@ -65,14 +64,14 @@ public class DictItemTest { createRequest.setSort(1); createRequest.setValid(true); - DictItemCreateResponse createResponse = dictItemManager.create(createRequest,token); + DictItemCreateResponse createResponse = dictItemManager.create(createRequest, token); assertTrue(!createResponse.hasError() && createResponse.getId() > 0); //删除数据 DictItemDeleteRequest request = new DictItemDeleteRequest(); request.setId(createResponse.getId()); - DictItemDeleteResponse response = dictItemManager.delete(request,token); + DictItemDeleteResponse response = dictItemManager.delete(request, token); assertTrue(!response.hasError() && response.getResult() == 1L); } @@ -97,7 +96,7 @@ public class DictItemTest { request.setSort(1); request.setValid(true); - DictItemUpdateResponse response = dictItemManager.update(request,token); + DictItemUpdateResponse response = dictItemManager.update(request, token); assertTrue(!response.hasError() && response.getResult() == 1L); } @@ -111,7 +110,7 @@ public class DictItemTest { request.setSort(1); request.setValid(true); - DictItemFindResponse response = dictItemManager.find(request,token); + DictItemFindResponse response = dictItemManager.find(request, token); assertTrue(!response.hasError()); } @@ -132,7 +131,7 @@ public class DictItemTest { DictItemGetRequest request = new DictItemGetRequest(); request.setId(createResponse.getId()); - DictItemGetResponse response = dictItemManager.get(request,token); + DictItemGetResponse response = dictItemManager.get(request, token); assertTrue(!response.hasError() && response.getDictItem() != null); } diff --git a/src/main/resources/modules/SpringBoot/test/system/DictTest.java b/src/main/resources/modules/SpringBoot/test/system/DictTest.java index efb02cd4..ec9dbb9a 100644 --- a/src/main/resources/modules/SpringBoot/test/system/DictTest.java +++ b/src/main/resources/modules/SpringBoot/test/system/DictTest.java @@ -26,7 +26,6 @@ import ${basePackage}.module.system.rsp.DictUpdateResponse; import static org.junit.Assert.assertTrue; - /** * DictTest - - 字典测试用例 * diff --git a/src/main/resources/modules/SpringBoot/test/system/FileTest.java b/src/main/resources/modules/SpringBoot/test/system/FileTest.java index 2b1065ee..cd5aa668 100644 --- a/src/main/resources/modules/SpringBoot/test/system/FileTest.java +++ b/src/main/resources/modules/SpringBoot/test/system/FileTest.java @@ -19,7 +19,6 @@ import ${basePackage}.module.system.rsp.FileGetResponse; import static org.junit.Assert.assertTrue; - /** * FileTest - - 字典测试用例 * diff --git a/src/main/resources/modules/SpringBoot/test/system/ResTest.java b/src/main/resources/modules/SpringBoot/test/system/ResTest.java new file mode 100644 index 00000000..b02a8c42 --- /dev/null +++ b/src/main/resources/modules/SpringBoot/test/system/ResTest.java @@ -0,0 +1,145 @@ +package ${basePackage}.system; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; +import ${basePackage}.frame.base.Token; +import ${basePackage}.module.system.mgr.ResManager; +import ${basePackage}.module.system.req.ResCreateRequest; +import ${basePackage}.module.system.req.ResDeleteRequest; +import ${basePackage}.module.system.req.ResFindRequest; +import ${basePackage}.module.system.req.ResGetRequest; +import ${basePackage}.module.system.req.ResUpdateRequest; +import ${basePackage}.module.system.rsp.ResCreateResponse; +import ${basePackage}.module.system.rsp.ResDeleteResponse; +import ${basePackage}.module.system.rsp.ResFindResponse; +import ${basePackage}.module.system.rsp.ResGetResponse; +import ${basePackage}.module.system.rsp.ResUpdateResponse; + +import static org.junit.Assert.assertTrue; + +/** + * ResTest - - 资源测试用例 + * + * @author wangbing + * @version 0.0.1 + * @since 2020-01-05 + */ +@RunWith(SpringRunner.class) +@SpringBootTest +@Transactional +public class ResTest { + + @Autowired + private Token token; + + @Autowired + private ResManager resManager; + + @Test + public void testCreate() { + ResCreateRequest request = new ResCreateRequest(); + request.setResCode("资源代码"); + request.setResName("资源名称"); + request.setResType("code"); + request.setResValue("资源内容"); + request.setValid(true); + + ResCreateResponse response = resManager.create(request, token); + + assertTrue(!response.hasError()); + } + + @Test + public void testDelete() { + + //创建数据 + ResCreateRequest createRequest = new ResCreateRequest(); + createRequest.setResCode("资源代码"); + createRequest.setResName("资源名称"); + createRequest.setResType("code"); + createRequest.setResValue("资源内容"); + createRequest.setValid(true); + + ResCreateResponse createResponse = resManager.create(createRequest, token); + + assertTrue(!createResponse.hasError() && createResponse.getId() > 0); + //删除数据 + ResDeleteRequest request = new ResDeleteRequest(); + request.setId(createResponse.getId()); + + ResDeleteResponse response = resManager.delete(request, token); + + assertTrue(!response.hasError() && response.getResult() == 1L); + } + + @Test + public void testUpdate() { + //创建数据 + ResCreateRequest createRequest = new ResCreateRequest(); + createRequest.setResCode("资源代码"); + createRequest.setResName("资源名称"); + createRequest.setResType("code"); + createRequest.setResValue("资源内容"); + createRequest.setValid(true); + + ResCreateResponse createResponse = resManager.create(createRequest, token); + + assertTrue(!createResponse.hasError()); + + //更新数据 + ResUpdateRequest request = new ResUpdateRequest(); + request.setId(createResponse.getId()); + request.setResCode("资源代码"); + request.setResName("资源名称"); + request.setResType("code"); + request.setResValue("资源内容"); + request.setValid(true); + + ResUpdateResponse response = resManager.update(request, token); + + assertTrue(!response.hasError() && response.getResult() == 1L); + } + + @Test + public void testFind() { + ResFindRequest request = new ResFindRequest(); + request.setResCode("资源代码"); + request.setResName("资源名称"); + request.setResType("code"); + request.setResValue("资源内容"); + request.setSupCode("上级代码"); + request.setSupName("上级名称"); + request.setValid(true); + + ResFindResponse response = resManager.find(request, token); + + assertTrue(!response.hasError()); + } + + @Test + public void testGet() { + //创建数据 + ResCreateRequest createRequest = new ResCreateRequest(); + createRequest.setResCode("资源代码"); + createRequest.setResName("资源名称"); + createRequest.setResType("code"); + createRequest.setResValue("资源内容"); + createRequest.setValid(true); + + ResCreateResponse createResponse = resManager.create(createRequest, token); + + assertTrue(!createResponse.hasError()); + + //获得数据 + ResGetRequest request = new ResGetRequest(); + request.setId(createResponse.getId()); + + ResGetResponse response = resManager.get(request, token); + + assertTrue(!response.hasError() && response.getRes() != null); + } +} diff --git a/src/main/resources/modules/SpringBoot/test/system/RoleResTest.java b/src/main/resources/modules/SpringBoot/test/system/RoleResTest.java new file mode 100644 index 00000000..1f2307a5 --- /dev/null +++ b/src/main/resources/modules/SpringBoot/test/system/RoleResTest.java @@ -0,0 +1,137 @@ +package ${basePackage}.system; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; +import ${basePackage}.frame.base.Token; +import ${basePackage}.module.system.mgr.RoleResManager; +import ${basePackage}.module.system.req.RoleResCreateRequest; +import ${basePackage}.module.system.req.RoleResDeleteRequest; +import ${basePackage}.module.system.req.RoleResFindRequest; +import ${basePackage}.module.system.req.RoleResGetRequest; +import ${basePackage}.module.system.req.RoleResUpdateRequest; +import ${basePackage}.module.system.rsp.RoleResCreateResponse; +import ${basePackage}.module.system.rsp.RoleResDeleteResponse; +import ${basePackage}.module.system.rsp.RoleResFindResponse; +import ${basePackage}.module.system.rsp.RoleResGetResponse; +import ${basePackage}.module.system.rsp.RoleResUpdateResponse; + +import static org.junit.Assert.assertTrue; + +/** + * RoleResTest - - 角色资源关系测试用例 + * + * @author wangbing + * @version 0.0.1 + * @since 2020-01-05 + */ +@RunWith(SpringRunner.class) +@SpringBootTest +@Transactional +public class RoleResTest { + + @Autowired + private Token token; + + @Autowired + private RoleResManager roleResManager; + + @Test + public void testCreate() { + RoleResCreateRequest request = new RoleResCreateRequest(); + request.setRoleId(1L); + request.setRoleCode("角色代码"); + request.setResId(1L); + request.setResCode("资源代码"); + + RoleResCreateResponse response = roleResManager.create(request, token); + + assertTrue(!response.hasError()); + } + + @Test + public void testDelete() { + + //创建数据 + RoleResCreateRequest createRequest = new RoleResCreateRequest(); + createRequest.setRoleId(1L); + createRequest.setRoleCode("角色代码"); + createRequest.setResId(1L); + createRequest.setResCode("资源代码"); + + RoleResCreateResponse createResponse = roleResManager.create(createRequest, token); + + assertTrue(!createResponse.hasError() && createResponse.getId() > 0); + //删除数据 + RoleResDeleteRequest request = new RoleResDeleteRequest(); + request.setId(createResponse.getId()); + + RoleResDeleteResponse response = roleResManager.delete(request, token); + + assertTrue(!response.hasError() && response.getResult() == 1L); + } + + @Test + public void testUpdate() { + //创建数据 + RoleResCreateRequest createRequest = new RoleResCreateRequest(); + createRequest.setRoleId(1L); + createRequest.setRoleCode("角色代码"); + createRequest.setResId(1L); + createRequest.setResCode("资源代码"); + + RoleResCreateResponse createResponse = roleResManager.create(createRequest, token); + + assertTrue(!createResponse.hasError()); + + //更新数据 + RoleResUpdateRequest request = new RoleResUpdateRequest(); + request.setId(createResponse.getId()); + request.setRoleId(1L); + request.setRoleCode("角色代码"); + request.setResId(1L); + request.setResCode("资源代码"); + + RoleResUpdateResponse response = roleResManager.update(request, token); + + assertTrue(!response.hasError() && response.getResult() == 1L); + } + + @Test + public void testFind() { + RoleResFindRequest request = new RoleResFindRequest(); + request.setRoleId(1L); + request.setRoleCode("角色代码"); + request.setResId(1L); + request.setResCode("资源代码"); + + RoleResFindResponse response = roleResManager.find(request, token); + + assertTrue(!response.hasError()); + } + + @Test + public void testGet() { + //创建数据 + RoleResCreateRequest createRequest = new RoleResCreateRequest(); + createRequest.setRoleId(1L); + createRequest.setRoleCode("角色代码"); + createRequest.setResId(1L); + createRequest.setResCode("资源代码"); + + RoleResCreateResponse createResponse = roleResManager.create(createRequest, token); + + assertTrue(!createResponse.hasError()); + + //获得数据 + RoleResGetRequest request = new RoleResGetRequest(); + request.setId(createResponse.getId()); + + RoleResGetResponse response = roleResManager.get(request, token); + + assertTrue(!response.hasError() && response.getRoleRes() != null); + } +} diff --git a/src/main/resources/modules/SpringBoot/test/system/RoleTest.java b/src/main/resources/modules/SpringBoot/test/system/RoleTest.java index a8dbb5b9..f7a74de6 100644 --- a/src/main/resources/modules/SpringBoot/test/system/RoleTest.java +++ b/src/main/resources/modules/SpringBoot/test/system/RoleTest.java @@ -8,12 +8,19 @@ import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; import ${basePackage}.frame.base.Token; import ${basePackage}.module.system.mgr.RoleManager; -import ${basePackage}.module.system.req.*; -import ${basePackage}.module.system.rsp.*; +import ${basePackage}.module.system.req.RoleCreateRequest; +import ${basePackage}.module.system.req.RoleDeleteRequest; +import ${basePackage}.module.system.req.RoleFindRequest; +import ${basePackage}.module.system.req.RoleGetRequest; +import ${basePackage}.module.system.req.RoleUpdateRequest; +import ${basePackage}.module.system.rsp.RoleCreateResponse; +import ${basePackage}.module.system.rsp.RoleDeleteResponse; +import ${basePackage}.module.system.rsp.RoleFindResponse; +import ${basePackage}.module.system.rsp.RoleGetResponse; +import ${basePackage}.module.system.rsp.RoleUpdateResponse; import static org.junit.Assert.assertTrue; - /** * RoleTest - - 角色测试用例 * @@ -39,7 +46,7 @@ public class RoleTest { request.setName("角色名称"); request.setComment("角色描述"); - RoleCreateResponse response = roleManager.create(request,token); + RoleCreateResponse response = roleManager.create(request, token); assertTrue(!response.hasError()); } @@ -53,14 +60,14 @@ public class RoleTest { createRequest.setName("角色名称"); createRequest.setComment("角色描述"); - RoleCreateResponse createResponse = roleManager.create(createRequest,token); + RoleCreateResponse createResponse = roleManager.create(createRequest, token); assertTrue(!createResponse.hasError() && createResponse.getId() > 0); //删除数据 RoleDeleteRequest request = new RoleDeleteRequest(); request.setId(createResponse.getId()); - RoleDeleteResponse response = roleManager.delete(request,token); + RoleDeleteResponse response = roleManager.delete(request, token); assertTrue(!response.hasError() && response.getResult() == 1L); } @@ -84,7 +91,7 @@ public class RoleTest { request.setName("角色名称"); request.setComment("角色描述"); - RoleUpdateResponse response = roleManager.update(request,token); + RoleUpdateResponse response = roleManager.update(request, token); assertTrue(!response.hasError() && response.getResult() == 1L); } @@ -96,7 +103,7 @@ public class RoleTest { request.setName("角色名称"); request.setComment("角色描述"); - RoleFindResponse response = roleManager.find(request,token); + RoleFindResponse response = roleManager.find(request, token); assertTrue(!response.hasError()); } @@ -117,7 +124,7 @@ public class RoleTest { RoleGetRequest request = new RoleGetRequest(); request.setId(createResponse.getId()); - RoleGetResponse response = roleManager.get(request,token); + RoleGetResponse response = roleManager.get(request, token); assertTrue(!response.hasError() && response.getRole() != null); } diff --git a/src/main/resources/modules/SpringBoot/test/system/TokensTest.java b/src/main/resources/modules/SpringBoot/test/system/TokensTest.java index a4fee066..8b389cad 100644 --- a/src/main/resources/modules/SpringBoot/test/system/TokensTest.java +++ b/src/main/resources/modules/SpringBoot/test/system/TokensTest.java @@ -23,7 +23,6 @@ import java.util.Date; import static org.junit.Assert.assertTrue; - /** * TokensTest - - 通行证测试用例 * diff --git a/src/main/resources/modules/SpringBoot/test/system/UserRoleTest.java b/src/main/resources/modules/SpringBoot/test/system/UserRoleTest.java index 0e80955a..9bb4e143 100644 --- a/src/main/resources/modules/SpringBoot/test/system/UserRoleTest.java +++ b/src/main/resources/modules/SpringBoot/test/system/UserRoleTest.java @@ -8,12 +8,19 @@ import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; import ${basePackage}.frame.base.Token; import ${basePackage}.module.system.mgr.UserRoleManager; -import ${basePackage}.module.system.req.*; -import ${basePackage}.module.system.rsp.*; +import ${basePackage}.module.system.req.UserRoleCreateRequest; +import ${basePackage}.module.system.req.UserRoleDeleteRequest; +import ${basePackage}.module.system.req.UserRoleFindRequest; +import ${basePackage}.module.system.req.UserRoleGetRequest; +import ${basePackage}.module.system.req.UserRoleUpdateRequest; +import ${basePackage}.module.system.rsp.UserRoleCreateResponse; +import ${basePackage}.module.system.rsp.UserRoleDeleteResponse; +import ${basePackage}.module.system.rsp.UserRoleFindResponse; +import ${basePackage}.module.system.rsp.UserRoleGetResponse; +import ${basePackage}.module.system.rsp.UserRoleUpdateResponse; import static org.junit.Assert.assertTrue; - /** * UserRoleTest - - 用户角色授权测试用例 * @@ -38,7 +45,7 @@ public class UserRoleTest { request.setUserId(1L); request.setRoleId(1L); - UserRoleCreateResponse response = userRoleManager.create(request,token); + UserRoleCreateResponse response = userRoleManager.create(request, token); assertTrue(!response.hasError()); } @@ -51,14 +58,14 @@ public class UserRoleTest { createRequest.setUserId(1L); createRequest.setRoleId(1L); - UserRoleCreateResponse createResponse = userRoleManager.create(createRequest,token); + UserRoleCreateResponse createResponse = userRoleManager.create(createRequest, token); assertTrue(!createResponse.hasError() && createResponse.getId() > 0); //删除数据 UserRoleDeleteRequest request = new UserRoleDeleteRequest(); request.setId(createResponse.getId()); - UserRoleDeleteResponse response = userRoleManager.delete(request,token); + UserRoleDeleteResponse response = userRoleManager.delete(request, token); assertTrue(!response.hasError() && response.getResult() == 1L); } @@ -80,7 +87,7 @@ public class UserRoleTest { request.setUserId(1L); request.setRoleId(1L); - UserRoleUpdateResponse response = userRoleManager.update(request,token); + UserRoleUpdateResponse response = userRoleManager.update(request, token); assertTrue(!response.hasError() && response.getResult() == 1L); } @@ -91,7 +98,7 @@ public class UserRoleTest { request.setUserId(1L); request.setRoleId(1L); - UserRoleFindResponse response = userRoleManager.find(request,token); + UserRoleFindResponse response = userRoleManager.find(request, token); assertTrue(!response.hasError()); } @@ -111,7 +118,7 @@ public class UserRoleTest { UserRoleGetRequest request = new UserRoleGetRequest(); request.setId(createResponse.getId()); - UserRoleGetResponse response = userRoleManager.get(request,token); + UserRoleGetResponse response = userRoleManager.get(request, token); assertTrue(!response.hasError() && response.getUserRole() != null); } diff --git a/src/main/resources/modules/SpringBoot/test/system/UserTest.java b/src/main/resources/modules/SpringBoot/test/system/UserTest.java index 0209e4a2..baf3ea5a 100644 --- a/src/main/resources/modules/SpringBoot/test/system/UserTest.java +++ b/src/main/resources/modules/SpringBoot/test/system/UserTest.java @@ -21,7 +21,6 @@ import ${basePackage}.module.system.rsp.UserUpdateResponse; import static org.junit.Assert.assertTrue; - /** * UserTest - - 用户测试用例 * diff --git a/src/main/resources/modules/SpringBoot/test/test.ftl b/src/main/resources/modules/SpringBoot/test/test.ftl index 5c9e8564..29133a06 100644 --- a/src/main/resources/modules/SpringBoot/test/test.ftl +++ b/src/main/resources/modules/SpringBoot/test/test.ftl @@ -2,16 +2,25 @@ package ${basePackage}.${moduleName}; import org.junit.Test; import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; -import static org.junit.Assert.assertTrue; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; -import ${basePackage}.module.${moduleName}.mgr.${table.getCName()}Manager; -import ${basePackage}.module.${moduleName}.req.*; -import ${basePackage}.module.${moduleName}.rsp.*; -import ${basePackage}.frame.base.Token; +<#if table.getImport()?length gt 1> ${table.getImport()} + +import ${basePackage}.frame.base.Token; +import ${basePackage}.module.${moduleName}.mgr.${table.getCName()}Manager; +import ${basePackage}.module.${moduleName}.req.${table.getCName()}CreateRequest; +import ${basePackage}.module.${moduleName}.req.${table.getCName()}DeleteRequest; +import ${basePackage}.module.${moduleName}.req.${table.getCName()}FindRequest; +import ${basePackage}.module.${moduleName}.req.${table.getCName()}GetRequest; +import ${basePackage}.module.${moduleName}.req.${table.getCName()}UpdateRequest; +import ${basePackage}.module.${moduleName}.rsp.${table.getCName()}CreateResponse; +import ${basePackage}.module.${moduleName}.rsp.${table.getCName()}DeleteResponse; +import ${basePackage}.module.${moduleName}.rsp.${table.getCName()}FindResponse; +import ${basePackage}.module.${moduleName}.rsp.${table.getCName()}GetResponse; +import ${basePackage}.module.${moduleName}.rsp.${table.getCName()}UpdateResponse; /** * ${table.getCName()}Test - - ${table.tableComment}测试用例