From 1da4dd8c8fe502fa349a300c79c4943dc73ce32b Mon Sep 17 00:00:00 2001 From: Wizzercn Date: Sat, 30 Mar 2019 12:18:24 +0800 Subject: [PATCH] update: for 5.2.2 --- README.md | 17 +++-- pom.xml | 7 +- wk-app/pom.xml | 2 +- wk-app/wk-common/pom.xml | 2 +- .../sys/modules/services/SysRoleService.java | 6 ++ wk-app/wk-model/pom.xml | 4 +- wk-app/wk-nb-service-cms/pom.xml | 2 +- .../src/main/resources/application.properties | 6 +- wk-app/wk-nb-service-sys/pom.xml | 2 +- .../services/impl/SysRoleServiceImpl.java | 66 +++++++++++-------- .../services/impl/SysUserServiceImpl.java | 29 ++------ .../src/main/resources/application.properties | 6 +- wk-app/wk-nb-service-wx/pom.xml | 2 +- .../src/main/resources/application.properties | 6 +- wk-app/wk-nb-task/pom.xml | 2 +- .../src/main/resources/application.properties | 6 +- .../src/main/resources/application.properties | 4 ++ .../src/main/resources/application.properties | 6 +- wk-app/wk-nb-web-vue/pom.xml | 2 +- .../platform/sys/SysRoleController.java | 27 +------- .../src/main/resources/application.properties | 4 ++ wk-code/wk-code-generator-nb/pom.xml | 4 +- wk-framework/pom.xml | 2 +- wk-wiki/pom.xml | 4 +- 24 files changed, 114 insertions(+), 104 deletions(-) diff --git a/README.md b/README.md index 701ac2192..2782fa1fd 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ https://wizzer.cn/donation 捐赠者列表 我们有强大的后援 —— Nutz 社区支持 https://nutz.cn 及 Nutz 使用手册 https://nutzam.com/core/nutz_preface.html ### QQ交流群 -* 1群: 68428921 (已满) +* 1群: 68428921 * 2群: 24457628 # 版本说明 @@ -87,22 +87,27 @@ https://wizzer.cn/donation 捐赠者列表 ### 分布式事务 -*   涉及分布式的NB模块 pom.xml 添加 +*   业务走过的链路所有NB模块, pom.xml 添加 ```xml org.nutz nutzboot-starter-fescar + + com.alibaba.fescar + fescar-dubbo-alibaba + ${fescar.version} + ``` -*   涉及分布式的NB模块,配置文件中添加 +*   业务走过的链路所有NB模块, 配置文件中添加 ```text fescar.enabled=true - # applicationId 无需设置,会自动获取 + # applicationId 在本项目中会自动获取无需赋值 # fescar.applicationId= - fescar.txServiceGroup=wk_nb_tx_group + fescar.txServiceGroup=my_test_tx_group ``` *   下载并启动 [fescar服务端](https://github.com/alibaba/fescar/releases) -*   业务方法上加上注解 `@GlobalTransactional(timeoutMills = 300000, name = "dubbo-demo-tx")` 即可 +*   业务方法上加上注解 `@GlobalTransactional` 即可,可选参数 `timeoutMills = 300000, name = "my_test_tx_group"` *   与本地事务注解 `@Aop(TransAop.READ_COMMITTED)` 不冲突 *   业务方法内不要加 try catch (与本地事务注解一样)要让异常抛出来事务才能工作 *   分布式事务不是越多越好,可以在核心业务如交易环节增加,建议实现乐观锁来预防脏数据产生 diff --git a/pom.xml b/pom.xml index 14a912afb..6f70875bf 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cn.wizzer wk-parent - 5.2.2-SNAPSHOT + 5.2.2 wk-framework wk-app @@ -16,8 +16,8 @@ NutzWk-NB - 2.3.3-SNAPSHOT - 1.r.68-SNAPSHOT + 2.3.3.v20190329 + 1.r.68.v20190329 0.11 5.1.47 2.3.1 @@ -25,6 +25,7 @@ 1.2.3 4.1.34.Final + 0.4.1 nutzwk UTF-8 diff --git a/wk-app/pom.xml b/wk-app/pom.xml index 2a8885735..c69b7466f 100644 --- a/wk-app/pom.xml +++ b/wk-app/pom.xml @@ -5,7 +5,7 @@ wk-parent cn.wizzer - 5.2.2-SNAPSHOT + 5.2.2 4.0.0 pom diff --git a/wk-app/wk-common/pom.xml b/wk-app/wk-common/pom.xml index 0e1ca2fe3..30fb53017 100644 --- a/wk-app/wk-common/pom.xml +++ b/wk-app/wk-common/pom.xml @@ -5,7 +5,7 @@ wk-app cn.wizzer.app - 5.2.2-SNAPSHOT + 5.2.2 4.0.0 jar diff --git a/wk-app/wk-common/src/main/java/cn/wizzer/app/sys/modules/services/SysRoleService.java b/wk-app/wk-common/src/main/java/cn/wizzer/app/sys/modules/services/SysRoleService.java index e35f19257..74c33d3f9 100644 --- a/wk-app/wk-common/src/main/java/cn/wizzer/app/sys/modules/services/SysRoleService.java +++ b/wk-app/wk-common/src/main/java/cn/wizzer/app/sys/modules/services/SysRoleService.java @@ -56,6 +56,12 @@ public interface SysRoleService extends BaseService { */ void del(String[] roleids); + /** + * 保存菜单数据 + * @param menuIds + * @param roleId + */ + void saveMenu(String[] menuIds,String roleId); /** * 通过角色ID和菜单父ID获取下级权限菜单 * diff --git a/wk-app/wk-model/pom.xml b/wk-app/wk-model/pom.xml index 078dc3e0d..9d881ccf9 100644 --- a/wk-app/wk-model/pom.xml +++ b/wk-app/wk-model/pom.xml @@ -5,7 +5,7 @@ wk-app cn.wizzer.app - 5.2.2-SNAPSHOT + 5.2.2 4.0.0 jar @@ -20,7 +20,7 @@ cn.wizzer.app wk-code-generator-nb - 5.2.2-SNAPSHOT + 5.2.2 runtime diff --git a/wk-app/wk-nb-service-cms/pom.xml b/wk-app/wk-nb-service-cms/pom.xml index c9f1ea408..63c8a10aa 100644 --- a/wk-app/wk-nb-service-cms/pom.xml +++ b/wk-app/wk-nb-service-cms/pom.xml @@ -5,7 +5,7 @@ wk-app cn.wizzer.app - 5.2.2-SNAPSHOT + 5.2.2 4.0.0 diff --git a/wk-app/wk-nb-service-cms/src/main/resources/application.properties b/wk-app/wk-nb-service-cms/src/main/resources/application.properties index a2a252a87..5c7ef5173 100644 --- a/wk-app/wk-nb-service-cms/src/main/resources/application.properties +++ b/wk-app/wk-nb-service-cms/src/main/resources/application.properties @@ -66,4 +66,8 @@ logback.exts.loglevel.heartbeat=10 # 详见 https://github.com/Wizzercn/PythonWk logback.exts.deploy.enabled=false #为应用管理提供支持,部署根路径 -logback.exts.deploy.root=C://data/nutzwk \ No newline at end of file +logback.exts.deploy.root=C://data/nutzwk + +#fescar分布式事务,使用说明见 README +fescar.enabled=false +fescar.txServiceGroup=my_test_tx_group \ No newline at end of file diff --git a/wk-app/wk-nb-service-sys/pom.xml b/wk-app/wk-nb-service-sys/pom.xml index c1d2853f6..b4deba1cc 100644 --- a/wk-app/wk-nb-service-sys/pom.xml +++ b/wk-app/wk-nb-service-sys/pom.xml @@ -5,7 +5,7 @@ wk-app cn.wizzer.app - 5.2.2-SNAPSHOT + 5.2.2 4.0.0 jar diff --git a/wk-app/wk-nb-service-sys/src/main/java/cn/wizzer/app/sys/modules/services/impl/SysRoleServiceImpl.java b/wk-app/wk-nb-service-sys/src/main/java/cn/wizzer/app/sys/modules/services/impl/SysRoleServiceImpl.java index c8a791878..01af6fb24 100644 --- a/wk-app/wk-nb-service-sys/src/main/java/cn/wizzer/app/sys/modules/services/impl/SysRoleServiceImpl.java +++ b/wk-app/wk-nb-service-sys/src/main/java/cn/wizzer/app/sys/modules/services/impl/SysRoleServiceImpl.java @@ -3,18 +3,17 @@ import cn.wizzer.app.sys.modules.models.Sys_menu; import cn.wizzer.app.sys.modules.models.Sys_role; import cn.wizzer.app.sys.modules.models.Sys_unit; +import cn.wizzer.app.sys.modules.services.SysMenuService; import cn.wizzer.app.sys.modules.services.SysRoleService; import cn.wizzer.framework.base.service.BaseServiceImpl; import cn.wizzer.framework.page.Pagination; import com.alibaba.dubbo.config.annotation.Service; +import org.nutz.aop.interceptor.async.Async; import org.nutz.aop.interceptor.ioc.TransAop; -import org.nutz.dao.Cnd; -import org.nutz.dao.DB; -import org.nutz.dao.Dao; -import org.nutz.dao.Sqls; -import org.nutz.dao.entity.Entity; +import org.nutz.dao.*; import org.nutz.dao.sql.Sql; import org.nutz.ioc.aop.Aop; +import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Strings; import org.nutz.plugins.wkcache.annotation.CacheDefaults; @@ -34,6 +33,8 @@ public class SysRoleServiceImpl extends BaseServiceImpl implements Sys public SysRoleServiceImpl(Dao dao) { super(dao); } + @Inject + private SysMenuService sysMenuService; @CacheResult public List getMenusAndButtons(String roleId) { @@ -41,11 +42,7 @@ public List getMenusAndButtons(String roleId) { " b.roleId=@roleId and a.disabled=@f order by a.location ASC,a.path asc"); sql.params().set("roleId", roleId); sql.params().set("f", false); - Entity entity = dao().getEntity(Sys_menu.class); - sql.setEntity(entity); - sql.setCallback(Sqls.callback.entities()); - dao().execute(sql); - return sql.getList(Sys_menu.class); + return sysMenuService.listEntity(sql); } @CacheResult @@ -54,21 +51,13 @@ public List getDatas(String roleId) { " b.roleId=@roleId and a.type='data' and a.disabled=@f order by a.location ASC,a.path asc"); sql.params().set("roleId", roleId); sql.params().set("f", false); - Entity entity = dao().getEntity(Sys_menu.class); - sql.setEntity(entity); - sql.setCallback(Sqls.callback.entities()); - dao().execute(sql); - return sql.getList(Sys_menu.class); + return sysMenuService.listEntity(sql); } @CacheResult public List getDatas() { Sql sql = Sqls.create("select distinct a.* from sys_menu a,sys_role_menu b where a.id=b.menuId and a.type='data' order by a.location ASC,a.path asc"); - Entity entity = dao().getEntity(Sys_menu.class); - sql.setEntity(entity); - sql.setCallback(Sqls.callback.entities()); - dao().execute(sql); - return sql.getList(Sys_menu.class); + return sysMenuService.listEntity(sql); } /** @@ -91,6 +80,7 @@ public List getPermissionNameList(Sys_role role) { } @Aop(TransAop.READ_COMMITTED) + @Async public void del(String roleid) { this.dao().clear("sys_user_role", Cnd.where("roleId", "=", roleid)); this.dao().clear("sys_role_menu", Cnd.where("roleId", "=", roleid)); @@ -98,12 +88,36 @@ public void del(String roleid) { } @Aop(TransAop.READ_COMMITTED) + @Async public void del(String[] roleids) { this.dao().clear("sys_user_role", Cnd.where("roleId", "in", roleids)); this.dao().clear("sys_role_menu", Cnd.where("roleId", "in", roleids)); this.delete(roleids); } + /** + * 保存菜单数据 + * @param menuIds + * @param roleId + */ + @Aop(TransAop.READ_COMMITTED) + @Async + public void saveMenu(String[] menuIds,String roleId){ + this.clear("sys_role_menu", Cnd.where("roleId", "=", roleId)); + for (String s : menuIds) { + this.insert("sys_role_menu", Chain.make("roleId", roleId).add("menuId", s)); + Sys_menu menu = sysMenuService.fetch(s); + //要把上级菜单插入关联表 + for (int i = 4; i < menu.getPath().length(); i = i + 4) { + Sys_menu tMenu = sysMenuService.fetch(Cnd.where("path", "=", menu.getPath().substring(0, i))); + int c = this.count("sys_role_menu", Cnd.where("roleId", "=", roleId).and("menuId", "=", tMenu.getId())); + if (c == 0) { + this.insert("sys_role_menu", Chain.make("roleId", roleId).add("menuId", tMenu.getId())); + } + } + } + } + /** * @param roleId * @param pid @@ -120,11 +134,7 @@ public List getRoleMenus(String roleId, String pid) { } else { sql.vars().set("m", "(a.parentId='' or a.parentId is null)"); } - Entity entity = dao().getEntity(Sys_menu.class); - sql.setEntity(entity); - sql.setCallback(Sqls.callback.entities()); - dao().execute(sql); - return sql.getList(Sys_menu.class); + return sysMenuService.listEntity(sql); } /** @@ -143,9 +153,7 @@ public boolean hasChildren(String roleId, String pid) { } else { sql.vars().set("m", "(a.parentId='' or a.parentId is null)"); } - sql.setCallback(Sqls.callback.integer()); - dao().execute(sql); - return sql.getInt() > 0; + return sysMenuService.count(sql) > 0; } /** @@ -159,7 +167,7 @@ public boolean hasChildren(String roleId, String pid) { */ public Pagination userSearch(String roleId, String keyword, boolean isAdmin, Sys_unit sysUnit) { Sql sql; - if (DB.ORACLE.name().equals(this.dao().getJdbcExpert().getDatabaseType())) { + if (DB.ORACLE.name().equals(this.dao().getJdbcExpert().getDatabaseType())||DB.DM.name().equals(this.dao().getJdbcExpert().getDatabaseType())) { //拼接字符串兼容oracle sql = Sqls.create("SELECT a.id AS VALUE,a.loginname||'('||a.username||')' AS label,a.disabled,a.unitid,b.name as unitname FROM sys_user a,sys_unit b WHERE a.unitid=b.id and a.id NOT IN(SELECT b.userId FROM sys_user_role b WHERE b.roleId=@roleId) $s1 $s2 order by a.opAt desc"); } else { diff --git a/wk-app/wk-nb-service-sys/src/main/java/cn/wizzer/app/sys/modules/services/impl/SysUserServiceImpl.java b/wk-app/wk-nb-service-sys/src/main/java/cn/wizzer/app/sys/modules/services/impl/SysUserServiceImpl.java index 1233c1081..2bf5a4fab 100644 --- a/wk-app/wk-nb-service-sys/src/main/java/cn/wizzer/app/sys/modules/services/impl/SysUserServiceImpl.java +++ b/wk-app/wk-nb-service-sys/src/main/java/cn/wizzer/app/sys/modules/services/impl/SysUserServiceImpl.java @@ -101,11 +101,7 @@ public List getMenus(String userId) { sql.params().set("userId", userId); sql.params().set("f", false); sql.params().set("t", true); - Entity entity = dao().getEntity(Sys_menu.class); - sql.setEntity(entity); - sql.setCallback(Sqls.callback.entities()); - dao().execute(sql); - return sql.getList(Sys_menu.class); + return sysMenuService.listEntity(sql); } /** @@ -120,11 +116,7 @@ public List getMenusAndButtons(String userId) { " b.roleId in(select c.roleId from sys_user_role c,sys_role d where c.roleId=d.id and c.userId=@userId and d.disabled=@f) and a.disabled=@f order by a.location ASC,a.path asc"); sql.params().set("userId", userId); sql.params().set("f", false); - Entity entity = dao().getEntity(Sys_menu.class); - sql.setEntity(entity); - sql.setCallback(Sqls.callback.entities()); - dao().execute(sql); - return sql.getList(Sys_menu.class); + return sysMenuService.listEntity(sql); } /** @@ -139,11 +131,7 @@ public List getDatas(String userId) { " b.roleId in(select c.roleId from sys_user_role c,sys_role d where c.roleId=d.id and c.userId=@userId and d.disabled=@f) and a.disabled=@f and a.type='data' order by a.location ASC,a.path asc"); sql.params().set("userId", userId); sql.params().set("f", false); - Entity entity = dao().getEntity(Sys_menu.class); - sql.setEntity(entity); - sql.setCallback(Sqls.callback.entities()); - dao().execute(sql); - return sql.getList(Sys_menu.class); + return sysMenuService.listEntity(sql); } /** @@ -186,11 +174,8 @@ public List getRoleMenus(String userId, String pid) { } else { sql.vars().set("m", "(a.parentId='' or a.parentId is null)"); } - Entity entity = dao().getEntity(Sys_menu.class); - sql.setEntity(entity); - sql.setCallback(Sqls.callback.entities()); - dao().execute(sql); - return sql.getList(Sys_menu.class); + return sysMenuService.listEntity(sql); + } /** @@ -209,9 +194,7 @@ public boolean hasChildren(String userId, String pid) { } else { sql.vars().set("m", "(a.parentId='' or a.parentId is null)"); } - sql.setCallback(Sqls.callback.integer()); - dao().execute(sql); - return sql.getInt() > 0; + return sysMenuService.count(sql) > 0; } @CacheRemove(cacheKey = "${args[0]}_*") diff --git a/wk-app/wk-nb-service-sys/src/main/resources/application.properties b/wk-app/wk-nb-service-sys/src/main/resources/application.properties index 3528a1c0b..12765789f 100644 --- a/wk-app/wk-nb-service-sys/src/main/resources/application.properties +++ b/wk-app/wk-nb-service-sys/src/main/resources/application.properties @@ -69,4 +69,8 @@ logback.exts.loglevel.heartbeat=10 # 详见 https://github.com/Wizzercn/PythonWk logback.exts.deploy.enabled=false #为应用管理提供支持,部署根路径 -logback.exts.deploy.root=C://data/nutzwk \ No newline at end of file +logback.exts.deploy.root=C://data/nutzwk + +#fescar分布式事务,使用说明见 README +fescar.enabled=false +fescar.txServiceGroup=my_test_tx_group \ No newline at end of file diff --git a/wk-app/wk-nb-service-wx/pom.xml b/wk-app/wk-nb-service-wx/pom.xml index 117525444..b2a2f41a4 100644 --- a/wk-app/wk-nb-service-wx/pom.xml +++ b/wk-app/wk-nb-service-wx/pom.xml @@ -5,7 +5,7 @@ wk-app cn.wizzer.app - 5.2.2-SNAPSHOT + 5.2.2 4.0.0 diff --git a/wk-app/wk-nb-service-wx/src/main/resources/application.properties b/wk-app/wk-nb-service-wx/src/main/resources/application.properties index cc19bfa5c..4719be70f 100644 --- a/wk-app/wk-nb-service-wx/src/main/resources/application.properties +++ b/wk-app/wk-nb-service-wx/src/main/resources/application.properties @@ -59,4 +59,8 @@ logback.exts.loglevel.heartbeat=10 # 详见 https://github.com/Wizzercn/PythonWk logback.exts.deploy.enabled=false #为应用管理提供支持,部署根路径 -logback.exts.deploy.root=C://data/nutzwk \ No newline at end of file +logback.exts.deploy.root=C://data/nutzwk + +#fescar分布式事务,使用说明见 README +fescar.enabled=false +fescar.txServiceGroup=my_test_tx_group \ No newline at end of file diff --git a/wk-app/wk-nb-task/pom.xml b/wk-app/wk-nb-task/pom.xml index f1a5fc412..3fa40bb07 100644 --- a/wk-app/wk-nb-task/pom.xml +++ b/wk-app/wk-nb-task/pom.xml @@ -5,7 +5,7 @@ wk-app cn.wizzer.app - 5.2.2-SNAPSHOT + 5.2.2 4.0.0 jar diff --git a/wk-app/wk-nb-task/src/main/resources/application.properties b/wk-app/wk-nb-task/src/main/resources/application.properties index 6e8a7252a..dac33909a 100644 --- a/wk-app/wk-nb-task/src/main/resources/application.properties +++ b/wk-app/wk-nb-task/src/main/resources/application.properties @@ -94,4 +94,8 @@ logback.exts.loglevel.heartbeat=10 #为应用管理提供支持,启用获取部署版本号,结合守护进程使用 logback.exts.deploy.enabled=false #为应用管理提供支持,部署根路径 -logback.exts.deploy.root=C://data/nutzwk \ No newline at end of file +logback.exts.deploy.root=C://data/nutzwk + +#fescar分布式事务,使用说明见 README +fescar.enabled=false +fescar.txServiceGroup=my_test_tx_group \ No newline at end of file diff --git a/wk-app/wk-nb-web-api/src/main/resources/application.properties b/wk-app/wk-nb-web-api/src/main/resources/application.properties index b7b4bcfa9..7b430ea50 100644 --- a/wk-app/wk-nb-web-api/src/main/resources/application.properties +++ b/wk-app/wk-nb-web-api/src/main/resources/application.properties @@ -66,3 +66,7 @@ logback.exts.deploy.root=C://data/nutzwk #应用管理通信接口签名,正式环境务必更改 deploy.appid=wizzer deploy.appkey=nutzwk + +#fescar分布式事务,使用说明见 README +fescar.enabled=false +fescar.txServiceGroup=my_test_tx_group \ No newline at end of file diff --git a/wk-app/wk-nb-web-platform/src/main/resources/application.properties b/wk-app/wk-nb-web-platform/src/main/resources/application.properties index 87ba29d14..e66c9d9f4 100644 --- a/wk-app/wk-nb-web-platform/src/main/resources/application.properties +++ b/wk-app/wk-nb-web-platform/src/main/resources/application.properties @@ -101,4 +101,8 @@ logback.exts.loglevel.heartbeat=10 # 详见 https://github.com/Wizzercn/PythonWk logback.exts.deploy.enabled=false #为应用管理提供支持,部署根路径 -logback.exts.deploy.root=C://data/nutzwk \ No newline at end of file +logback.exts.deploy.root=C://data/nutzwk + +#fescar分布式事务,使用说明见 README +fescar.enabled=false +fescar.txServiceGroup=my_test_tx_group \ No newline at end of file diff --git a/wk-app/wk-nb-web-vue/pom.xml b/wk-app/wk-nb-web-vue/pom.xml index 01e1712f1..d030bae87 100644 --- a/wk-app/wk-nb-web-vue/pom.xml +++ b/wk-app/wk-nb-web-vue/pom.xml @@ -5,7 +5,7 @@ wk-app cn.wizzer.app - 5.2.2-SNAPSHOT + 5.2.2 4.0.0 jar diff --git a/wk-app/wk-nb-web-vue/src/main/java/cn/wizzer/app/web/modules/controllers/platform/sys/SysRoleController.java b/wk-app/wk-nb-web-vue/src/main/java/cn/wizzer/app/web/modules/controllers/platform/sys/SysRoleController.java index db6a98b10..8dfee124e 100644 --- a/wk-app/wk-nb-web-vue/src/main/java/cn/wizzer/app/web/modules/controllers/platform/sys/SysRoleController.java +++ b/wk-app/wk-nb-web-vue/src/main/java/cn/wizzer/app/web/modules/controllers/platform/sys/SysRoleController.java @@ -278,17 +278,8 @@ public Object addDo(@Param("menuIds") String menuIds, @Param("..") Sys_role role role.setUnitid(""); role.setOpBy(StringUtil.getPlatformUid()); Sys_role r = sysRoleService.insert(role); - for (String s : ids) { - sysRoleService.insert("sys_role_menu", Chain.make("roleId", r.getId()).add("menuId", s)); - Sys_menu menu = sysMenuService.fetch(s); - //要把上级菜单插入关联表 - for (int i = 4; i < menu.getPath().length(); i = i + 4) { - Sys_menu tMenu = sysMenuService.fetch(Cnd.where("path", "=", menu.getPath().substring(0, i))); - int c = sysRoleService.count("sys_role_menu", Cnd.where("roleId", "=", r.getId()).and("menuId", "=", tMenu.getId())); - if (c == 0) { - sysRoleService.insert("sys_role_menu", Chain.make("roleId", r.getId()).add("menuId", tMenu.getId())); - } - } + if (r != null) { + sysRoleService.saveMenu(ids, r.getId()); } sysRoleService.clearCache(); sysUserService.clearCache(); @@ -386,19 +377,7 @@ public Object editDo(@Param("..") Sys_role role, HttpServletRequest req) { public Object menuDo(@Param("menuIds") String menuIds, @Param("roleId") String roleId, HttpServletRequest req) { try { String[] ids = StringUtils.split(menuIds, ","); - sysRoleService.clear("sys_role_menu", Cnd.where("roleId", "=", roleId)); - for (String s : ids) { - sysRoleService.insert("sys_role_menu", Chain.make("roleId", roleId).add("menuId", s)); - Sys_menu menu = sysMenuService.fetch(s); - //要把上级菜单插入关联表 - for (int i = 4; i < menu.getPath().length(); i = i + 4) { - Sys_menu tMenu = sysMenuService.fetch(Cnd.where("path", "=", menu.getPath().substring(0, i))); - int c = sysRoleService.count("sys_role_menu", Cnd.where("roleId", "=", roleId).and("menuId", "=", tMenu.getId())); - if (c == 0) { - sysRoleService.insert("sys_role_menu", Chain.make("roleId", roleId).add("menuId", tMenu.getId())); - } - } - } + sysRoleService.saveMenu(ids, roleId); Sys_role role = sysRoleService.fetch(roleId); sysRoleService.clearCache(); sysUserService.clearCache(); diff --git a/wk-app/wk-nb-web-vue/src/main/resources/application.properties b/wk-app/wk-nb-web-vue/src/main/resources/application.properties index 75dc2f7c3..58d98025e 100644 --- a/wk-app/wk-nb-web-vue/src/main/resources/application.properties +++ b/wk-app/wk-nb-web-vue/src/main/resources/application.properties @@ -109,3 +109,7 @@ logback.exts.loglevel.heartbeat=10 logback.exts.deploy.enabled=false #为应用管理提供支持,部署根路径 logback.exts.deploy.root=C://data/nutzwk + +#fescar分布式事务,使用说明见 README +fescar.enabled=false +fescar.txServiceGroup=my_test_tx_group \ No newline at end of file diff --git a/wk-code/wk-code-generator-nb/pom.xml b/wk-code/wk-code-generator-nb/pom.xml index f8f052bdc..151e530dc 100644 --- a/wk-code/wk-code-generator-nb/pom.xml +++ b/wk-code/wk-code-generator-nb/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> cn.wizzer.app wk-code-generator-nb - 5.2.2-SNAPSHOT + 5.2.2 4.0.0 jar wk-code-generator-nb @@ -12,7 +12,7 @@ 1.0.1 1.7 1.2 - 1.r.68-SNAPSHOT + 1.r.68.v20190329 1.7.25 1.2.3 diff --git a/wk-framework/pom.xml b/wk-framework/pom.xml index 6144236f6..b4a699639 100644 --- a/wk-framework/pom.xml +++ b/wk-framework/pom.xml @@ -5,7 +5,7 @@ wk-parent cn.wizzer - 5.2.2-SNAPSHOT + 5.2.2 jar 4.0.0 diff --git a/wk-wiki/pom.xml b/wk-wiki/pom.xml index 5dfca63fe..73a894b6a 100644 --- a/wk-wiki/pom.xml +++ b/wk-wiki/pom.xml @@ -6,10 +6,10 @@ wk-parent cn.wizzer - 5.2.2-SNAPSHOT + 5.2.2 wk-wiki - 5.2.2-SNAPSHOT + 5.2.2 pom wk-wiki https://www.wizzer.cn