From 17fcfa53509a6dfd5589385081ceec6ad78066fc Mon Sep 17 00:00:00 2001 From: wangbing Date: Mon, 20 Jan 2020 17:28:31 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81Excel=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 37c0bb9c46f915b2709546723add4b2e29ae001e --- .../SpringBoot/java/action/ajax/Ajax.java | 6 ++-- .../java/action/ajax/system/DeptAjax.java | 4 +-- .../java/action/ajax/system/DictAjax.java | 6 ++-- .../java/action/ajax/system/DictItemAjax.java | 6 ++-- .../java/action/ajax/system/FileAjax.java | 4 +-- .../java/action/ajax/system/ResAjax.java | 4 +-- .../java/action/ajax/system/RoleAjax.java | 4 +-- .../java/action/ajax/system/TokensAjax.java | 4 +-- .../java/action/ajax/system/UserAjax.java | 24 ++++++------- .../java/config/SecurityConfig.java | 36 +++++++++++++++++-- .../SpringBoot/java/frame/auth/LocalData.java | 5 ++- .../SpringBoot/java/frame/excel/WExcel.java | 4 +++ .../java/frame/utils/CookieUtil.java | 28 +++++++++++---- .../java/module/system/ent/User.java | 10 ++++++ .../module/system/mgr/RoleManagerImpl.java | 13 +++++++ .../module/system/mgr/TokensManagerImpl.java | 2 +- .../module/system/mgr/UserManagerImpl.java | 27 +++++++++++--- .../module/system/mpr/MySQL_ResMapper.xml | 3 ++ .../module/system/mpr/MySQL_UserMapper.xml | 5 +-- .../module/system/req/UserCreateRequest.java | 10 +++--- .../SpringBoot/resources/application-dev.ftl | 2 +- .../SpringBoot/resources/application-prod.ftl | 2 +- .../resources/templates/control/nav.ftl | 3 +- .../resources/templates/screen/index.ftl | 2 +- .../templates/screen/module/system/user.ftl | 11 +++--- 25 files changed, 161 insertions(+), 64 deletions(-) diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/Ajax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/Ajax.java index cd5c1737..ed1a76fa 100644 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/Ajax.java +++ b/src/main/resources/modules/SpringBoot/java/action/ajax/Ajax.java @@ -76,15 +76,15 @@ public class ${table.getCName()}Ajax{ response.addError(ErrorType.BUSINESS_ERROR, "导出数据为空"); return response; } - return ResponseUtil.apply(new WExcel<>(response.getResult())); + return ResponseUtil.apply(new WExcel<>(${table.getCName()}.class).loadData(response.getResult())); } public Object imports(MultipartFile file) { BaseResponse baseResponse = new BaseResponse(); try { - WExcel<${table.getCName()}> sheet = new WExcel<>(file.getBytes(), ${table.getCName()}.class, new WExcel.Validator<${table.getCName()}>() { + WExcel sheet = new WExcel<>(${table.getCName()}.class).loadData(file.getBytes(), new WExcel.Processor<${table.getCName()}>() { @Override - public List validate(${table.getCName()} o) { + public List exec(${table.getCName()} o) { ${table.getCName()}CreateRequest request = MapperUtil.map(o, ${table.getCName()}CreateRequest.class); return ValidationUtil.validate(request); } diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/system/DeptAjax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/system/DeptAjax.java index 2d2eaac7..a77e2d0a 100644 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/system/DeptAjax.java +++ b/src/main/resources/modules/SpringBoot/java/action/ajax/system/DeptAjax.java @@ -79,9 +79,9 @@ public class DeptAjax { public Object imports(MultipartFile file) { BaseResponse baseResponse = new BaseResponse(); try { - WExcel sheet = new WExcel<>(file.getBytes(), Dept.class, new WExcel.Validator() { + WExcel sheet = new WExcel<>(Dept.class).loadData(file.getBytes(), new WExcel.Processor() { @Override - public List validate(Dept o) { + public List exec(Dept o) { DeptCreateRequest request = MapperUtil.map(o, DeptCreateRequest.class); return ValidationUtil.validate(request); } 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 99de7b1a..0b265da9 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 @@ -79,16 +79,16 @@ public class DictAjax { public Object imports(MultipartFile file) { BaseResponse baseResponse = new BaseResponse(); try { - WExcel sheet = new WExcel<>(file.getBytes(), Dict.class, new WExcel.Validator() { + WExcel sheet = new WExcel<>(Dict.class).loadData(file.getBytes(), new WExcel.Processor() { @Override - public List validate(Dict o) { + public List exec(Dict o) { DictCreateRequest request = MapperUtil.map(o, DictCreateRequest.class); return ValidationUtil.validate(request); } }); if (sheet.hasError()) { - return ResponseUtil.apply(sheet.getBytes(true), sheet.getName() + "-检查.xlsx"); + return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-检查.xlsx"); } else { return baseResponse; } 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 f9c7b793..cc7193e4 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 @@ -73,16 +73,16 @@ public class DictItemAjax { public Object imports(MultipartFile file) { BaseResponse baseResponse = new BaseResponse(); try { - WExcel sheet = new WExcel<>(file.getBytes(), DictItem.class, new WExcel.Validator() { + WExcel sheet = new WExcel<>(DictItem.class).loadData(file.getBytes(), new WExcel.Processor() { @Override - public List validate(DictItem o) { + public List exec(DictItem o) { DictItemCreateRequest request = MapperUtil.map(o, DictItemCreateRequest.class); return ValidationUtil.validate(request); } }); if (sheet.hasError()) { - return ResponseUtil.apply(sheet.getBytes(true), sheet.getName() + "-检查.xlsx"); + return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-检查.xlsx"); } else { return baseResponse; } 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 3f559484..27a158a8 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 @@ -73,9 +73,9 @@ public class FileAjax { public Object imports(MultipartFile file) { BaseResponse baseResponse = new BaseResponse(); try { - WExcel sheet = new WExcel<>(file.getBytes(), File.class, new WExcel.Validator() { + WExcel sheet = new WExcel<>(File.class).loadData(file.getBytes(), new WExcel.Processor() { @Override - public List validate(File o) { + public List exec(File o) { FileCreateRequest request = MapperUtil.map(o, FileCreateRequest.class); return ValidationUtil.validate(request); } diff --git a/src/main/resources/modules/SpringBoot/java/action/ajax/system/ResAjax.java b/src/main/resources/modules/SpringBoot/java/action/ajax/system/ResAjax.java index 7c3ef991..edde1e96 100644 --- a/src/main/resources/modules/SpringBoot/java/action/ajax/system/ResAjax.java +++ b/src/main/resources/modules/SpringBoot/java/action/ajax/system/ResAjax.java @@ -79,9 +79,9 @@ public class ResAjax { public Object imports(MultipartFile file) { BaseResponse baseResponse = new BaseResponse(); try { - WExcel sheet = new WExcel<>(file.getBytes(), Res.class, new WExcel.Validator() { + WExcel sheet = new WExcel<>(Res.class).loadData(file.getBytes(), new WExcel.Processor() { @Override - public List validate(Res o) { + public List exec(Res o) { ResCreateRequest request = MapperUtil.map(o, ResCreateRequest.class); return ValidationUtil.validate(request); } 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 92aa3d25..f9d8baf8 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 @@ -73,9 +73,9 @@ public class RoleAjax { public Object imports(MultipartFile file) { BaseResponse baseResponse = new BaseResponse(); try { - WExcel sheet = new WExcel<>(file.getBytes(), Role.class, new WExcel.Validator() { + WExcel sheet = new WExcel<>(Role.class).loadData(file.getBytes(), new WExcel.Processor() { @Override - public List validate(Role o) { + public List exec(Role o) { RoleCreateRequest request = MapperUtil.map(o, RoleCreateRequest.class); return ValidationUtil.validate(request); } 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 7330ca2e..3e2f8039 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 @@ -79,9 +79,9 @@ public class TokensAjax { public Object imports(MultipartFile file) { BaseResponse baseResponse = new BaseResponse(); try { - WExcel sheet = new WExcel<>(file.getBytes(), Tokens.class, new WExcel.Validator() { + WExcel sheet = new WExcel<>(Tokens.class).loadData(file.getBytes(), new WExcel.Processor() { @Override - public List validate(Tokens o) { + public List exec(Tokens o) { TokensCreateRequest request = MapperUtil.map(o, TokensCreateRequest.class); return ValidationUtil.validate(request); } 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 a96f147a..fccfb030 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 @@ -170,7 +170,6 @@ public class UserAjax { return response; } Cookie cookie = CookieUtil.newCookie("token", tokensCreateRequest.getToken()); - cookie.setPath("/"); httpServletResponse.addCookie(cookie); response.setToken(tokensCreateRequest.getToken()); } @@ -181,17 +180,16 @@ public class UserAjax { public UserLogoutResponse logout(UserLogoutRequest request) { UserLogoutResponse response = new UserLogoutResponse(); - TokensLogoutRequest tokensLogoutRequest = new TokensLogoutRequest(); - tokensLogoutRequest.setToken(LocalData.getToken().getToken()); - TokensLogoutResponse tokensLogoutResponse = tokensManager.logout(tokensLogoutRequest, LocalData.getSysToken()); - if (tokensLogoutResponse.hasError()) { - response.addErrors(tokensLogoutResponse.getErrors()); - return response; + if (LocalData.getToken() != null) { + TokensLogoutRequest tokensLogoutRequest = new TokensLogoutRequest(); + tokensLogoutRequest.setToken(LocalData.getToken().getToken()); + TokensLogoutResponse tokensLogoutResponse = tokensManager.logout(tokensLogoutRequest, LocalData.getSysToken()); + if (tokensLogoutResponse.hasError()) { + response.addErrors(tokensLogoutResponse.getErrors()); + return response; + } } - - HttpServletResponse HttpServletResponse = LocalData.getResponse(); - Cookie token = CookieUtil.newCookie("token", ""); - HttpServletResponse.addCookie(token); + CookieUtil.clearCookie("token"); return response; } @@ -214,9 +212,9 @@ public class UserAjax { public Object imports(MultipartFile file) { BaseResponse baseResponse = new BaseResponse(); try { - WExcel sheet = new WExcel<>(file.getBytes(), User.class, new WExcel.Validator() { + WExcel sheet = new WExcel<>(User.class).loadData(file.getBytes(), new WExcel.Processor() { @Override - public List validate(User o) { + public List exec(User o) { UserCreateRequest request = MapperUtil.map(o, UserCreateRequest.class); return ValidationUtil.validate(request); } diff --git a/src/main/resources/modules/SpringBoot/java/config/SecurityConfig.java b/src/main/resources/modules/SpringBoot/java/config/SecurityConfig.java index d5ce3ee8..95feeb3b 100644 --- a/src/main/resources/modules/SpringBoot/java/config/SecurityConfig.java +++ b/src/main/resources/modules/SpringBoot/java/config/SecurityConfig.java @@ -15,8 +15,13 @@ import org.springframework.security.web.access.intercept.FilterSecurityIntercept import ${basePackage}.frame.auth.LocalData; import ${basePackage}.frame.base.Token; import ${basePackage}.frame.utils.CookieUtil; +import ${basePackage}.frame.utils.IDgenerator; +import ${basePackage}.module.system.mgr.ResManager; import ${basePackage}.module.system.mgr.TokensManager; +import ${basePackage}.module.system.req.ResCreateRequest; +import ${basePackage}.module.system.req.ResFindRequest; import ${basePackage}.module.system.req.TokensBuildRequest; +import ${basePackage}.module.system.rsp.ResFindResponse; import ${basePackage}.module.system.rsp.TokensBuildResponse; import javax.servlet.Filter; @@ -119,9 +124,36 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { return new Object() { public boolean hasPermission(HttpServletRequest request, Authentication authentication) { - // 授权 Token token_ = LocalData.getToken(); - if (token_ != null && token_.hasRes(request.getServletPath())) { + if (token_ == null) { + return false; + } + + String path = request.getServletPath(); + + String[] profiles = LocalData.getEnvironment().getActiveProfiles(); + for (String profile : profiles) { + if (profile.contains("dev")) {//测试环境捕获资源 + ResFindRequest resFindRequest = new ResFindRequest(); + resFindRequest.setPageSize(0); + resFindRequest.setResValue(request.getServletPath()); + ResManager resManager = LocalData.getBean(ResManager.class); + ResFindResponse resFindResponse = resManager.find(resFindRequest, LocalData.getSysToken()); + + if (resFindResponse.getResult().size() == 0) {//资源不存在,主动收集资源 + ResCreateRequest resCreateRequest = new ResCreateRequest(); + resCreateRequest.setResCode(IDgenerator.nextUUID()); + resCreateRequest.setResName("默认"); + resCreateRequest.setResValue(path); + resCreateRequest.setValid(true); + resCreateRequest.setResType(""); + resManager.create(resCreateRequest, LocalData.getSysToken()); + } + } + } + + // 授权 + if (token_.hasRes(path)) { return true; } diff --git a/src/main/resources/modules/SpringBoot/java/frame/auth/LocalData.java b/src/main/resources/modules/SpringBoot/java/frame/auth/LocalData.java index 32d727ae..70662c51 100644 --- a/src/main/resources/modules/SpringBoot/java/frame/auth/LocalData.java +++ b/src/main/resources/modules/SpringBoot/java/frame/auth/LocalData.java @@ -81,8 +81,7 @@ public class LocalData { return getApplicationContext().getBean(t); } - public static String getProp(String key) { - Environment env = getBean(Environment.class); - return env.getProperty(key, ""); + public static Environment getEnvironment() { + return getBean(Environment.class); } } diff --git a/src/main/resources/modules/SpringBoot/java/frame/excel/WExcel.java b/src/main/resources/modules/SpringBoot/java/frame/excel/WExcel.java index aa825301..726c62df 100644 --- a/src/main/resources/modules/SpringBoot/java/frame/excel/WExcel.java +++ b/src/main/resources/modules/SpringBoot/java/frame/excel/WExcel.java @@ -198,6 +198,10 @@ public class WExcel implements Serializable, Cloneable { return columnList; } + public WExcel loadData(List list) { + return loadData(list, null); + } + /** * 此构造方法仅用于转换对象列表。
* 并不会对数据的格式和合法性进行检验。 diff --git a/src/main/resources/modules/SpringBoot/java/frame/utils/CookieUtil.java b/src/main/resources/modules/SpringBoot/java/frame/utils/CookieUtil.java index e18ede9a..187eded0 100644 --- a/src/main/resources/modules/SpringBoot/java/frame/utils/CookieUtil.java +++ b/src/main/resources/modules/SpringBoot/java/frame/utils/CookieUtil.java @@ -3,6 +3,7 @@ package ${basePackage}.frame.utils; import ${basePackage}.frame.auth.LocalData; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; /** * CookieUtil @@ -37,15 +38,30 @@ public class CookieUtil { /** * 生成一个默认的Cookie * - * @param key 键 + * @param name 键 * @param value 值 - * @return passportID */ - public static Cookie newCookie(String key, String value) { + public static Cookie newCookie(String name, String value) { HttpServletRequest request = LocalData.getRequest(); - Cookie cookie = new Cookie(key, value); + Cookie cookie = new Cookie(name, value); cookie.setDomain(request.getServerName()); - cookie.setPath(request.getContextPath()); + cookie.setMaxAge(-1); + cookie.setPath("/"); return cookie; } -} + + /** + * 删除一个Cookie + * + * @param name 键 + */ + public static void clearCookie(String name) { + HttpServletRequest request = LocalData.getRequest(); + HttpServletResponse response = LocalData.getResponse(); + Cookie cookie = new Cookie(name, null); + cookie.setDomain(request.getServerName()); + cookie.setMaxAge(0); + cookie.setPath("/"); + response.addCookie(cookie); + } +} \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/java/module/system/ent/User.java b/src/main/resources/modules/SpringBoot/java/module/system/ent/User.java index 51ccaee3..87fbad4a 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/ent/User.java +++ b/src/main/resources/modules/SpringBoot/java/module/system/ent/User.java @@ -66,6 +66,8 @@ public class User extends BaseEntity { private String roleNames; + private String roleCodes; + public String getUserName() { return this.userName; } @@ -137,4 +139,12 @@ public class User extends BaseEntity { public void setRoleNames(String roleNames) { this.roleNames = roleNames; } + + public String getRoleCodes() { + return roleCodes; + } + + public void setRoleCodes(String roleCodes) { + this.roleCodes = roleCodes; + } } \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleManagerImpl.java b/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleManagerImpl.java index 68bcf613..192d354a 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleManagerImpl.java +++ b/src/main/resources/modules/SpringBoot/java/module/system/mgr/RoleManagerImpl.java @@ -54,6 +54,19 @@ public class RoleManagerImpl implements RoleManager { return response; } + {//检查Code是否重复 + RoleFindRequest roleFindRequest = new RoleFindRequest(); + roleFindRequest.setCode(request.getCode()); + RoleFindResponse roleFindResponse = find(roleFindRequest, token); + if (roleFindResponse.hasError()) { + response.addErrors(roleFindResponse.getErrors()); + return response; + } else if (roleFindResponse.getResult().size() > 0) { + response.addError(ErrorType.BUSINESS_ERROR, "[" + request.getCode() + "]已存在"); + return response; + } + } + long id = IDgenerator.nextId(); Role entity = MapperUtil.map(request, Role.class); entity.setId(id); diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mgr/TokensManagerImpl.java b/src/main/resources/modules/SpringBoot/java/module/system/mgr/TokensManagerImpl.java index c2dedb9a..698ef551 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mgr/TokensManagerImpl.java +++ b/src/main/resources/modules/SpringBoot/java/module/system/mgr/TokensManagerImpl.java @@ -252,7 +252,7 @@ public class TokensManagerImpl implements xyz.wbsite.module.system.mgr.TokensMan // 获取用户的资源 ResFindRequest resFindRequest = new ResFindRequest(); resFindRequest.setPageSize(0); - resFindRequest.setUserId(token.getUserId()); + resFindRequest.setUserId(tokens.getUserId()); ResFindResponse resFindResponse = resManager.find(resFindRequest, token); if (resFindResponse.hasError()) { response.addErrors(resFindResponse.getErrors()); diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mgr/UserManagerImpl.java b/src/main/resources/modules/SpringBoot/java/module/system/mgr/UserManagerImpl.java index df30671d..b2ecfdac 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mgr/UserManagerImpl.java +++ b/src/main/resources/modules/SpringBoot/java/module/system/mgr/UserManagerImpl.java @@ -15,9 +15,11 @@ import ${basePackage}.frame.utils.MapperUtil; import ${basePackage}.frame.utils.Message; import ${basePackage}.frame.utils.ValidationUtil; import ${basePackage}.module.system.ent.Dept; +import ${basePackage}.module.system.ent.Role; import ${basePackage}.module.system.ent.User; import ${basePackage}.module.system.mpr.UserMapper; import ${basePackage}.module.system.req.DeptFindRequest; +import ${basePackage}.module.system.req.RoleFindRequest; import ${basePackage}.module.system.req.UserCreateRequest; import ${basePackage}.module.system.req.UserDeleteRequest; import ${basePackage}.module.system.req.UserFindRequest; @@ -25,6 +27,7 @@ import ${basePackage}.module.system.req.UserGetRequest; import ${basePackage}.module.system.req.UserRoleCreateRequest; import ${basePackage}.module.system.req.UserUpdateRequest; import ${basePackage}.module.system.rsp.DeptFindResponse; +import ${basePackage}.module.system.rsp.RoleFindResponse; import ${basePackage}.module.system.rsp.UserCreateResponse; import ${basePackage}.module.system.rsp.UserDeleteResponse; import ${basePackage}.module.system.rsp.UserFindResponse; @@ -48,6 +51,8 @@ public class UserManagerImpl implements UserManager { @Autowired private DeptManager deptManager; @Autowired + private RoleManager roleManager; + @Autowired private UserRoleManager userRoleManager; /** @@ -94,12 +99,26 @@ public class UserManagerImpl implements UserManager { return response; } - for (Long aLong : request.getRoleIdList()) { + for (String code : request.getRoleCodeList()) { + RoleFindRequest roleFindRequest = new RoleFindRequest(); + roleFindRequest.setCode(code); + RoleFindResponse roleFindResponse = roleManager.find(roleFindRequest, token); + if (roleFindResponse.hasError()) { + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + response.addErrors(roleFindResponse.getErrors()); + return response; + } else if (roleFindResponse.getResult().size() == 0) { + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + response.addError(ErrorType.BUSINESS_ERROR, "[" + code + "]角色代码不存在!"); + return response; + } + + Role role = roleFindResponse.getResult().get(0); UserRoleCreateRequest userRoleCreateRequest = new UserRoleCreateRequest(); userRoleCreateRequest.setUserId(id); - userRoleCreateRequest.setUserCode(null); - userRoleCreateRequest.setRoleId(aLong); - userRoleCreateRequest.setRoleCode(null); + userRoleCreateRequest.setUserCode(request.getUserCode()); + userRoleCreateRequest.setRoleId(role.getId()); + userRoleCreateRequest.setRoleCode(role.getCode()); UserRoleCreateResponse userRoleCreateResponse = userRoleManager.create(userRoleCreateRequest, token); if (userRoleCreateResponse.hasError()) { response.addErrors(userRoleCreateResponse.getErrors()); diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_ResMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_ResMapper.xml index 59176858..9ea64309 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_ResMapper.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_ResMapper.xml @@ -4,6 +4,9 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + + `SYS_RES` diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_UserMapper.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_UserMapper.xml index 1968769d..fcc53c05 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_UserMapper.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/MySQL_UserMapper.xml @@ -20,6 +20,7 @@ + @@ -31,12 +32,12 @@