From cc9c67cdfbe1c3675dfc6caf93d01281933093e6 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sun, 22 Jul 2018 23:05:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8B=A5=E4=BE=9D2.2=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- sql/{ry_20180720.sql => ry_20180723.sql} | 165 +++---- .../aspectj/lang/constant/BusinessType.java | 16 +- .../framework/shiro/service/LoginService.java | 2 +- .../web/controller/BaseController.java | 11 + .../framework/web/service/ConfigService.java | 6 +- .../framework/web/service/DictService.java | 18 +- .../service/PermissionService.java | 6 +- .../project/common/CommonController.java | 27 +- .../monitor/job/controller/JobController.java | 55 +-- .../job/controller/JobLogController.java | 11 +- .../monitor/job/service/IJobService.java | 11 +- .../job/service/JobLogServiceImpl.java | 2 +- .../monitor/job/service/JobServiceImpl.java | 32 +- .../controller/LogininforController.java | 7 +- .../monitor/logininfor/domain/Logininfor.java | 6 +- .../service/LogininforServiceImpl.java | 2 +- .../online/service/UserOnlineServiceImpl.java | 2 +- .../operlog/controller/OperlogController.java | 14 +- .../monitor/operlog/domain/OperLog.java | 6 +- .../operlog/service/OperLogServiceImpl.java | 2 +- .../config/controller/ConfigController.java | 48 +- .../project/system/config/domain/Config.java | 6 +- .../system/config/mapper/ConfigMapper.java | 29 +- .../config/service/ConfigServiceImpl.java | 60 +-- .../system/config/service/IConfigService.java | 18 +- .../dept/controller/DeptController.java | 60 ++- .../system/dept/service/DeptServiceImpl.java | 42 +- .../system/dept/service/IDeptService.java | 12 +- .../dict/controller/DictDataController.java | 66 ++- .../dict/controller/DictTypeController.java | 66 +-- .../project/system/dict/domain/DictData.java | 13 + .../system/dict/mapper/DictDataMapper.java | 20 +- .../dict/service/DictDataServiceImpl.java | 45 +- .../dict/service/DictTypeServiceImpl.java | 38 +- .../system/dict/service/IDictDataService.java | 27 +- .../system/dict/service/IDictTypeService.java | 19 +- .../menu/controller/MenuController.java | 69 ++- .../system/menu/service/IMenuService.java | 12 +- .../system/menu/service/MenuServiceImpl.java | 45 +- .../notice/controller/NoticeController.java | 52 +- .../project/system/notice/domain/Notice.java | 14 +- .../system/notice/mapper/NoticeMapper.java | 2 +- .../system/notice/service/INoticeService.java | 10 +- .../notice/service/NoticeServiceImpl.java | 31 +- .../post/controller/PostController.java | 44 +- .../system/post/mapper/PostMapper.java | 8 - .../system/post/service/IPostService.java | 24 +- .../system/post/service/PostServiceImpl.java | 54 +- .../role/controller/RoleController.java | 46 +- .../system/role/service/IRoleService.java | 18 +- .../system/role/service/RoleServiceImpl.java | 54 +- .../user/controller/IndexController.java | 14 +- .../user/controller/LoginController.java | 3 +- .../user/controller/ProfileController.java | 51 +- .../user/controller/UserController.java | 117 ++--- .../system/user/service/IUserService.java | 14 +- .../system/user/service/UserServiceImpl.java | 92 ++-- .../tool/gen/service/GenServiceImpl.java | 2 +- src/main/resources/application.yml | 2 +- .../resources/mybatis/system/ConfigMapper.xml | 28 +- .../mybatis/system/DictDataMapper.xml | 13 +- .../resources/mybatis/system/NoticeMapper.xml | 2 +- .../resources/mybatis/system/PostMapper.xml | 4 - src/main/resources/static/ruoyi/index.js | 10 +- src/main/resources/static/ruoyi/js/ry-ui.js | 11 + .../resources/static/ruoyi/js/ry-ui.min.js | 463 +++++++++++++++++- src/main/resources/templates/include.html | 4 +- src/main/resources/templates/index.html | 6 +- src/main/resources/templates/login.html | 4 +- src/main/resources/templates/main.html | 28 +- .../resources/templates/monitor/job/add.html | 4 +- .../resources/templates/monitor/job/edit.html | 4 +- .../resources/templates/monitor/job/job.html | 15 +- .../templates/monitor/job/jobLog.html | 11 +- .../monitor/logininfor/logininfor.html | 11 +- .../templates/monitor/online/online.html | 2 +- .../templates/monitor/operlog/detail.html | 2 +- .../templates/monitor/operlog/operlog.html | 27 +- .../templates/system/config/add.html | 4 +- .../templates/system/config/config.html | 13 +- .../templates/system/config/edit.html | 4 +- .../resources/templates/system/dept/add.html | 4 +- .../resources/templates/system/dept/dept.html | 15 +- .../resources/templates/system/dept/edit.html | 4 +- .../templates/system/dict/data/add.html | 12 +- .../templates/system/dict/data/data.html | 13 +- .../templates/system/dict/data/edit.html | 12 +- .../templates/system/dict/type/add.html | 4 +- .../templates/system/dict/type/edit.html | 4 +- .../templates/system/dict/type/type.html | 15 +- .../resources/templates/system/menu/add.html | 4 +- .../resources/templates/system/menu/edit.html | 4 +- .../resources/templates/system/menu/menu.html | 15 +- .../templates/system/notice/add.html | 6 +- .../templates/system/notice/edit.html | 6 +- .../templates/system/notice/notice.html | 20 +- .../resources/templates/system/post/add.html | 4 +- .../resources/templates/system/post/edit.html | 4 +- .../resources/templates/system/post/post.html | 13 +- .../resources/templates/system/role/add.html | 2 +- .../resources/templates/system/role/edit.html | 2 +- .../resources/templates/system/role/role.html | 14 +- .../resources/templates/system/user/add.html | 6 +- .../resources/templates/system/user/edit.html | 4 +- .../system/user/profile/profile.html | 2 +- .../resources/templates/system/user/user.html | 15 +- .../resources/templates/vm/html/add.html.vm | 2 +- .../resources/templates/vm/html/edit.html.vm | 2 +- .../templates/vm/java/Controller.java.vm | 49 +- .../templates/vm/java/Service.java.vm | 11 +- .../templates/vm/java/ServiceImpl.java.vm | 25 +- src/main/resources/templates/vm/sql/sql.vm | 3 - .../ruoyi/common/utils/AddressUtilsTest.java | 17 +- .../dept/service/DeptServiceImplTest.java | 62 ++- 115 files changed, 1579 insertions(+), 1216 deletions(-) rename sql/{ry_20180720.sql => ry_20180723.sql} (78%) rename src/main/java/com/ruoyi/framework/{shiro => web}/service/PermissionService.java (78%) diff --git a/pom.xml b/pom.xml index 5e69599f9..0fe7d3309 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.ruoyi RuoYi - 2.1.0 + 2.2.0 jar RuoYi diff --git a/sql/ry_20180720.sql b/sql/ry_20180723.sql similarity index 78% rename from sql/ry_20180720.sql rename to sql/ry_20180723.sql index f52cddf97..e068c1e3c 100644 --- a/sql/ry_20180720.sql +++ b/sql/ry_20180723.sql @@ -146,9 +146,9 @@ create table sys_menu ( -- 初始化-菜单信息表数据 -- ---------------------------- -- 一级菜单 -insert into sys_menu values('1', '系统管理', '0', '1', '#', 'M', '0', '#', 'fa fa-gear', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统管理目录'); -insert into sys_menu values('2', '系统监控', '0', '2', '#', 'M', '0', '#', 'fa fa-video-camera', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统监控目录'); -insert into sys_menu values('3', '系统工具', '0', '3', '#', 'M', '0', '#', 'fa fa-bars', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统工具目录'); +insert into sys_menu values('1', '系统管理', '0', '1', '#', 'M', '0', '', 'fa fa-gear', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统管理目录'); +insert into sys_menu values('2', '系统监控', '0', '2', '#', 'M', '0', '', 'fa fa-video-camera', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统监控目录'); +insert into sys_menu values('3', '系统工具', '0', '3', '#', 'M', '0', '', 'fa fa-bars', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统工具目录'); -- 二级菜单 insert into sys_menu values('100', '用户管理', '1', '1', '/system/user', 'C', '0', 'system:user:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '用户管理菜单'); insert into sys_menu values('101', '角色管理', '1', '2', '/system/role', 'C', '0', 'system:role:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '角色管理菜单'); @@ -173,71 +173,62 @@ insert into sys_menu values('1000', '用户查询', '100', '1', '#', 'F', '0', insert into sys_menu values('1001', '用户新增', '100', '2', '#', 'F', '0', 'system:user:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); insert into sys_menu values('1002', '用户修改', '100', '3', '#', 'F', '0', 'system:user:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); insert into sys_menu values('1003', '用户删除', '100', '4', '#', 'F', '0', 'system:user:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1004', '用户保存', '100', '5', '#', 'F', '0', 'system:user:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1005', '重置密码', '100', '6', '#', 'F', '0', 'system:user:resetPwd', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1004', '重置密码', '100', '5', '#', 'F', '0', 'system:user:resetPwd', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- 角色管理按钮 -insert into sys_menu values('1006', '角色查询', '101', '1', '#', 'F', '0', 'system:role:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1007', '角色新增', '101', '2', '#', 'F', '0', 'system:role:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1008', '角色修改', '101', '3', '#', 'F', '0', 'system:role:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1009', '角色删除', '101', '4', '#', 'F', '0', 'system:role:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1010', '角色保存', '101', '5', '#', 'F', '0', 'system:role:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1005', '角色查询', '101', '1', '#', 'F', '0', 'system:role:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1006', '角色新增', '101', '2', '#', 'F', '0', 'system:role:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1007', '角色修改', '101', '3', '#', 'F', '0', 'system:role:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1008', '角色删除', '101', '4', '#', 'F', '0', 'system:role:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- 菜单管理按钮 -insert into sys_menu values('1011', '菜单查询', '102', '1', '#', 'F', '0', 'system:menu:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1012', '菜单新增', '102', '2', '#', 'F', '0', 'system:menu:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1013', '菜单修改', '102', '3', '#', 'F', '0', 'system:menu:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1014', '菜单删除', '102', '4', '#', 'F', '0', 'system:menu:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1015', '菜单保存', '102', '5', '#', 'F', '0', 'system:menu:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1009', '菜单查询', '102', '1', '#', 'F', '0', 'system:menu:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1010', '菜单新增', '102', '2', '#', 'F', '0', 'system:menu:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1011', '菜单修改', '102', '3', '#', 'F', '0', 'system:menu:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1012', '菜单删除', '102', '4', '#', 'F', '0', 'system:menu:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- 部门管理按钮 -insert into sys_menu values('1016', '部门查询', '103', '1', '#', 'F', '0', 'system:dept:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1017', '部门新增', '103', '2', '#', 'F', '0', 'system:dept:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1018', '部门修改', '103', '3', '#', 'F', '0', 'system:dept:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1019', '部门删除', '103', '4', '#', 'F', '0', 'system:dept:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1020', '部门保存', '103', '5', '#', 'F', '0', 'system:dept:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1013', '部门查询', '103', '1', '#', 'F', '0', 'system:dept:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1014', '部门新增', '103', '2', '#', 'F', '0', 'system:dept:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1015', '部门修改', '103', '3', '#', 'F', '0', 'system:dept:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1016', '部门删除', '103', '4', '#', 'F', '0', 'system:dept:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- 岗位管理按钮 -insert into sys_menu values('1021', '岗位查询', '104', '1', '#', 'F', '0', 'system:post:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1022', '岗位新增', '104', '2', '#', 'F', '0', 'system:post:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1023', '岗位修改', '104', '3', '#', 'F', '0', 'system:post:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1024', '岗位删除', '104', '4', '#', 'F', '0', 'system:post:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1025', '岗位保存', '104', '5', '#', 'F', '0', 'system:post:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1017', '岗位查询', '104', '1', '#', 'F', '0', 'system:post:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1018', '岗位新增', '104', '2', '#', 'F', '0', 'system:post:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1019', '岗位修改', '104', '3', '#', 'F', '0', 'system:post:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1020', '岗位删除', '104', '4', '#', 'F', '0', 'system:post:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- 字典管理按钮 -insert into sys_menu values('1026', '字典查询', '105', '1', '#', 'F', '0', 'system:dict:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1027', '字典新增', '105', '2', '#', 'F', '0', 'system:dict:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1028', '字典修改', '105', '3', '#', 'F', '0', 'system:dict:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1029', '字典删除', '105', '4', '#', 'F', '0', 'system:dict:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1030', '字典保存', '105', '5', '#', 'F', '0', 'system:dict:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1021', '字典查询', '105', '1', '#', 'F', '0', 'system:dict:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1022', '字典新增', '105', '2', '#', 'F', '0', 'system:dict:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1023', '字典修改', '105', '3', '#', 'F', '0', 'system:dict:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1024', '字典删除', '105', '4', '#', 'F', '0', 'system:dict:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- 参数设置按钮 -insert into sys_menu values('1031', '参数查询', '106', '1', '#', 'F', '0', 'system:config:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1032', '参数新增', '106', '2', '#', 'F', '0', 'system:config:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1033', '参数修改', '106', '3', '#', 'F', '0', 'system:config:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1034', '参数删除', '106', '4', '#', 'F', '0', 'system:config:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1035', '参数保存', '106', '5', '#', 'F', '0', 'system:config:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1025', '参数查询', '106', '1', '#', 'F', '0', 'system:config:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1026', '参数新增', '106', '2', '#', 'F', '0', 'system:config:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1027', '参数修改', '106', '3', '#', 'F', '0', 'system:config:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1028', '参数删除', '106', '4', '#', 'F', '0', 'system:config:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- 通知公告按钮 -insert into sys_menu values('1036', '公告查询', '107', '1', '#', 'F', '0', 'system:notice:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1037', '公告新增', '107', '2', '#', 'F', '0', 'system:notice:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1038', '公告修改', '107', '3', '#', 'F', '0', 'system:notice:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1039', '公告删除', '107', '4', '#', 'F', '0', 'system:notice:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1040', '公告保存', '107', '5', '#', 'F', '0', 'system:notice:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1029', '公告查询', '107', '1', '#', 'F', '0', 'system:notice:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1030', '公告新增', '107', '2', '#', 'F', '0', 'system:notice:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1031', '公告修改', '107', '3', '#', 'F', '0', 'system:notice:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1032', '公告删除', '107', '4', '#', 'F', '0', 'system:notice:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- 操作日志按钮 -insert into sys_menu values('1041', '操作查询', '500', '1', '#', 'F', '0', 'monitor:operlog:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1042', '操作删除', '500', '2', '#', 'F', '0', 'monitor:operlog:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1043', '详细信息', '500', '3', '#', 'F', '0', 'monitor:operlog:detail', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1033', '操作查询', '500', '1', '#', 'F', '0', 'monitor:operlog:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1034', '操作删除', '500', '2', '#', 'F', '0', 'monitor:operlog:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1035', '详细信息', '500', '3', '#', 'F', '0', 'monitor:operlog:detail', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- 登录日志按钮 -insert into sys_menu values('1044', '登录查询', '501', '1', '#', 'F', '0', 'monitor:logininfor:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1045', '登录删除', '501', '2', '#', 'F', '0', 'monitor:logininfor:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1036', '登录查询', '501', '1', '#', 'F', '0', 'monitor:logininfor:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1037', '登录删除', '501', '2', '#', 'F', '0', 'monitor:logininfor:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- 在线用户按钮 -insert into sys_menu values('1046', '在线查询', '109', '1', '#', 'F', '0', 'monitor:online:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1047', '批量强退', '109', '2', '#', 'F', '0', 'monitor:online:batchForceLogout', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1048', '单条强退', '109', '3', '#', 'F', '0', 'monitor:online:forceLogout', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1038', '在线查询', '109', '1', '#', 'F', '0', 'monitor:online:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1039', '批量强退', '109', '2', '#', 'F', '0', 'monitor:online:batchForceLogout', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1040', '单条强退', '109', '3', '#', 'F', '0', 'monitor:online:forceLogout', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- 定时任务按钮 -insert into sys_menu values('1049', '任务查询', '110', '1', '#', 'F', '0', 'monitor:job:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1050', '任务新增', '110', '2', '#', 'F', '0', 'monitor:job:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1051', '任务修改', '110', '3', '#', 'F', '0', 'monitor:job:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1052', '任务删除', '110', '4', '#', 'F', '0', 'monitor:job:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1053', '任务保存', '110', '5', '#', 'F', '0', 'monitor:job:save', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1054', '状态修改', '110', '6', '#', 'F', '0', 'monitor:job:changeStatus', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1041', '任务查询', '110', '1', '#', 'F', '0', 'monitor:job:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1042', '任务新增', '110', '2', '#', 'F', '0', 'monitor:job:add', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1043', '任务修改', '110', '3', '#', 'F', '0', 'monitor:job:edit', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1044', '任务删除', '110', '4', '#', 'F', '0', 'monitor:job:remove', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1045', '状态修改', '110', '5', '#', 'F', '0', 'monitor:job:changeStatus', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- 代码生成按钮 -insert into sys_menu values('1055', '生成查询', '113', '1', '#', 'F', '0', 'tool:gen:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_menu values('1056', '生成代码', '113', '2', '#', 'F', '0', 'tool:gen:code', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1046', '生成查询', '113', '1', '#', 'F', '0', 'tool:gen:list', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_menu values('1047', '生成代码', '113', '2', '#', 'F', '0', 'tool:gen:code', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- ---------------------------- @@ -338,15 +329,6 @@ insert into sys_role_menu values ('1', '1044'); insert into sys_role_menu values ('1', '1045'); insert into sys_role_menu values ('1', '1046'); insert into sys_role_menu values ('1', '1047'); -insert into sys_role_menu values ('1', '1048'); -insert into sys_role_menu values ('1', '1049'); -insert into sys_role_menu values ('1', '1050'); -insert into sys_role_menu values ('1', '1051'); -insert into sys_role_menu values ('1', '1052'); -insert into sys_role_menu values ('1', '1053'); -insert into sys_role_menu values ('1', '1054'); -insert into sys_role_menu values ('1', '1055'); -insert into sys_role_menu values ('1', '1056'); -- ---------------------------- -- 8、用户与岗位关联表 用户1-N岗位 @@ -430,6 +412,7 @@ create table sys_dict_data dict_value varchar(100) default '' comment '字典键值', dict_type varchar(100) default '' comment '字典类型', css_class varchar(500) default '' comment '样式属性', + list_class varchar(500) default '' comment '回显样式', is_default char(1) default 'N' comment '是否默认(Y是 N否)', status char(1) default '0' comment '状态(0正常 1停用)', create_by varchar(64) default '' comment '创建者', @@ -441,33 +424,31 @@ create table sys_dict_data ) engine=innodb auto_increment=100 default charset=utf8 comment = '字典数据表'; -insert into sys_dict_data values(1, 1, '男', '0', 'sys_user_sex', '', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别男'); -insert into sys_dict_data values(2, 2, '女', '1', 'sys_user_sex', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别女'); -insert into sys_dict_data values(3, 3, '未知', '2', 'sys_user_sex', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别未知'); -insert into sys_dict_data values(4, 1, '显示', '0', 'sys_show_hide', 'radio radio-info radio-inline', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '显示菜单'); -insert into sys_dict_data values(5, 2, '隐藏', '1', 'sys_show_hide', 'radio radio-danger radio-inline', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '隐藏菜单'); -insert into sys_dict_data values(6, 1, '正常', '0', 'sys_normal_disable', 'radio radio-info radio-inline', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); -insert into sys_dict_data values(7, 2, '停用', '1', 'sys_normal_disable', 'radio radio-danger radio-inline', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态'); -insert into sys_dict_data values(8, 1, '正常', '0', 'sys_job_status', 'radio radio-info radio-inline', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); -insert into sys_dict_data values(9, 2, '暂停', '1', 'sys_job_status', 'radio radio-danger radio-inline', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态'); -insert into sys_dict_data values(10, 1, '是', 'Y', 'sys_yes_no', 'radio radio-info radio-inline', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认是'); -insert into sys_dict_data values(11, 2, '否', 'N', 'sys_yes_no', 'radio radio-danger radio-inline', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认否'); -insert into sys_dict_data values(12, 1, '通知', '1', 'sys_notice_type', '', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '通知'); -insert into sys_dict_data values(13, 2, '公告', '2', 'sys_notice_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '公告'); -insert into sys_dict_data values(14, 1, '正常', '0', 'sys_notice_status', 'radio radio-info radio-inline', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); -insert into sys_dict_data values(15, 2, '关闭', '1', 'sys_notice_status', 'radio radio-danger radio-inline', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '关闭状态'); -insert into sys_dict_data values(16, 1, '新增', '1', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(17, 2, '修改', '2', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(18, 3, '保存', '3', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(19, 4, '删除', '4', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(20, 5, '授权', '5', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(21, 6, '导出', '6', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(22, 7, '导入', '7', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(23, 8, '强退', '8', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(24, 9, '禁止访问', '9', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(25, 10, '生成代码', '10', 'sys_oper_type', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(26, 1, '成功', '0', 'sys_common_status', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); -insert into sys_dict_data values(27, 2, '失败', '1', 'sys_common_status', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态'); +insert into sys_dict_data values(1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别男'); +insert into sys_dict_data values(2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别女'); +insert into sys_dict_data values(3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别未知'); +insert into sys_dict_data values(4, 1, '显示', '0', 'sys_show_hide', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '显示菜单'); +insert into sys_dict_data values(5, 2, '隐藏', '1', 'sys_show_hide', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '隐藏菜单'); +insert into sys_dict_data values(6, 1, '正常', '0', 'sys_normal_disable', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); +insert into sys_dict_data values(7, 2, '停用', '1', 'sys_normal_disable', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态'); +insert into sys_dict_data values(8, 1, '正常', '0', 'sys_job_status', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); +insert into sys_dict_data values(9, 2, '暂停', '1', 'sys_job_status', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态'); +insert into sys_dict_data values(10, 1, '是', 'Y', 'sys_yes_no', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认是'); +insert into sys_dict_data values(11, 2, '否', 'N', 'sys_yes_no', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认否'); +insert into sys_dict_data values(12, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '通知'); +insert into sys_dict_data values(13, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '公告'); +insert into sys_dict_data values(14, 1, '正常', '0', 'sys_notice_status', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); +insert into sys_dict_data values(15, 2, '关闭', '1', 'sys_notice_status', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '关闭状态'); +insert into sys_dict_data values(16, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(17, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(18, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(19, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(20, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(21, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(22, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(23, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(24, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); +insert into sys_dict_data values(25, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态'); -- ---------------------------- -- 12、参数配置表 diff --git a/src/main/java/com/ruoyi/framework/aspectj/lang/constant/BusinessType.java b/src/main/java/com/ruoyi/framework/aspectj/lang/constant/BusinessType.java index d2d0ddbd2..2990630df 100644 --- a/src/main/java/com/ruoyi/framework/aspectj/lang/constant/BusinessType.java +++ b/src/main/java/com/ruoyi/framework/aspectj/lang/constant/BusinessType.java @@ -14,20 +14,16 @@ public class BusinessType public static final String INSERT = "1"; /** 修改 */ public static final String UPDATE = "2"; - /** 保存 */ - public static final String SAVE = "3"; /** 删除 */ - public static final String DELETE = "4"; + public static final String DELETE = "3"; /** 授权 */ - public static final String GRANT = "5"; + public static final String GRANT = "4"; /** 导出 */ - public static final String EXPORT = "6"; + public static final String EXPORT = "5"; /** 导入 */ - public static final String IMPORT = "7"; + public static final String IMPORT = "6"; /** 强退 */ - public static final String FORCE = "8"; - /** 禁止访问 */ - public static final String FORBID = "9"; + public static final String FORCE = "7"; /** 生成代码 */ - public static final String GENCODE = "10"; + public static final String GENCODE = "8"; } diff --git a/src/main/java/com/ruoyi/framework/shiro/service/LoginService.java b/src/main/java/com/ruoyi/framework/shiro/service/LoginService.java index 5ca358be9..8d4e73c78 100644 --- a/src/main/java/com/ruoyi/framework/shiro/service/LoginService.java +++ b/src/main/java/com/ruoyi/framework/shiro/service/LoginService.java @@ -122,7 +122,7 @@ public class LoginService { user.setLoginIp(ShiroUtils.getIp()); user.setLoginDate(DateUtils.getNowDate()); - userService.updateUser(user); + userService.updateUserInfo(user); } } diff --git a/src/main/java/com/ruoyi/framework/web/controller/BaseController.java b/src/main/java/com/ruoyi/framework/web/controller/BaseController.java index 36e6b65ee..7e4da4755 100644 --- a/src/main/java/com/ruoyi/framework/web/controller/BaseController.java +++ b/src/main/java/com/ruoyi/framework/web/controller/BaseController.java @@ -61,6 +61,17 @@ public class BaseController return rspData; } + /** + * 响应返回结果 + * + * @param rows 影响行数 + * @return 操作结果 + */ + protected AjaxResult toAjax(int rows) + { + return rows > 0 ? success() : error(); + } + /** * 返回成功 */ diff --git a/src/main/java/com/ruoyi/framework/web/service/ConfigService.java b/src/main/java/com/ruoyi/framework/web/service/ConfigService.java index f0cfefaf9..2b69ee0da 100644 --- a/src/main/java/com/ruoyi/framework/web/service/ConfigService.java +++ b/src/main/java/com/ruoyi/framework/web/service/ConfigService.java @@ -1,7 +1,7 @@ package com.ruoyi.framework.web.service; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; import com.ruoyi.project.system.config.service.IConfigService; /** @@ -9,7 +9,7 @@ import com.ruoyi.project.system.config.service.IConfigService; * * @author ruoyi */ -@Component +@Service("config") public class ConfigService { @Autowired @@ -21,7 +21,7 @@ public class ConfigService * @param configName 参数名称 * @return 参数键值 */ - public String selectConfigByKey(String configKey) + public String getKey(String configKey) { return configService.selectConfigByKey(configKey); } diff --git a/src/main/java/com/ruoyi/framework/web/service/DictService.java b/src/main/java/com/ruoyi/framework/web/service/DictService.java index 0b207164f..c917fc739 100644 --- a/src/main/java/com/ruoyi/framework/web/service/DictService.java +++ b/src/main/java/com/ruoyi/framework/web/service/DictService.java @@ -2,7 +2,7 @@ package com.ruoyi.framework.web.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; import com.ruoyi.project.system.dict.domain.DictData; import com.ruoyi.project.system.dict.service.IDictDataService; @@ -11,7 +11,7 @@ import com.ruoyi.project.system.dict.service.IDictDataService; * * @author ruoyi */ -@Component +@Service("dict") public class DictService { @Autowired @@ -23,8 +23,20 @@ public class DictService * @param dictType 字典类型 * @return 参数键值 */ - public List selectDictData(String dictType) + public List getType(String dictType) { return dictDataService.selectDictDataByType(dictType); } + + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + public String getLabel(String dictType, String dictValue) + { + return dictDataService.selectDictLabel(dictType, dictValue); + } } diff --git a/src/main/java/com/ruoyi/framework/shiro/service/PermissionService.java b/src/main/java/com/ruoyi/framework/web/service/PermissionService.java similarity index 78% rename from src/main/java/com/ruoyi/framework/shiro/service/PermissionService.java rename to src/main/java/com/ruoyi/framework/web/service/PermissionService.java index 71b7cb4d0..013deca0d 100644 --- a/src/main/java/com/ruoyi/framework/shiro/service/PermissionService.java +++ b/src/main/java/com/ruoyi/framework/web/service/PermissionService.java @@ -1,14 +1,14 @@ -package com.ruoyi.framework.shiro.service; +package com.ruoyi.framework.web.service; import org.apache.shiro.SecurityUtils; -import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; /** * RuoYi首创 js调用 thymeleaf 实现按钮权限可见性 * * @author ruoyi */ -@Component +@Service("permission") public class PermissionService { public String hasPermi(String permission) diff --git a/src/main/java/com/ruoyi/project/common/CommonController.java b/src/main/java/com/ruoyi/project/common/CommonController.java index 31b1cb8a6..d5807f854 100644 --- a/src/main/java/com/ruoyi/project/common/CommonController.java +++ b/src/main/java/com/ruoyi/project/common/CommonController.java @@ -2,12 +2,15 @@ package com.ruoyi.project.common; import java.io.File; import java.io.FileInputStream; +import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.util.ResourceUtils; import org.springframework.web.bind.annotation.RequestMapping; @@ -20,10 +23,14 @@ import org.springframework.web.bind.annotation.RequestMapping; @Controller public class CommonController { + private static final Logger log = LoggerFactory.getLogger(CommonController.class); + @RequestMapping("common/download") public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) { String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); + InputStream inputStream = null; + OutputStream os = null; try { String filePath = ResourceUtils.getURL("classpath:").getPath() + "static/file/" + fileName; @@ -32,16 +39,14 @@ public class CommonController response.setContentType("multipart/form-data"); response.setHeader("Content-Disposition", "attachment;fileName=" + setFileDownloadHeader(request, realFileName)); File file = new File(filePath); - InputStream inputStream = new FileInputStream(file); - OutputStream os = response.getOutputStream(); + inputStream = new FileInputStream(file); + os = response.getOutputStream(); byte[] b = new byte[1024]; int length; while ((length = inputStream.read(b)) > 0) { os.write(b, 0, length); } - os.close(); - inputStream.close(); if (delete && file.exists()) { file.delete(); @@ -49,7 +54,19 @@ public class CommonController } catch (Exception e) { - e.printStackTrace(); + log.error("下载文件失败", e); + } + finally + { + try + { + os.close(); + inputStream.close(); + } + catch (IOException e) + { + log.error("close close fail ", e); + } } } diff --git a/src/main/java/com/ruoyi/project/monitor/job/controller/JobController.java b/src/main/java/com/ruoyi/project/monitor/job/controller/JobController.java index 6144a5d45..cd10488d6 100644 --- a/src/main/java/com/ruoyi/project/monitor/job/controller/JobController.java +++ b/src/main/java/com/ruoyi/project/monitor/job/controller/JobController.java @@ -4,7 +4,7 @@ import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -94,13 +94,9 @@ public class JobController extends BaseController @ResponseBody public AjaxResult changeStatus(Job job) { - if (jobService.changeStatus(job) > 0) - { - return success(); - } - return error(); + return toAjax(jobService.changeStatus(job)); } - + /** * 任务调度立即执行一次 */ @@ -110,50 +106,49 @@ public class JobController extends BaseController @ResponseBody public AjaxResult run(Job job) { - if (jobService.run(job) > 0) - { - return success(); - } - return error(); + return toAjax(jobService.run(job)); } /** * 新增调度 */ - @Log(title = "定时任务", action = BusinessType.INSERT) - @RequiresPermissions("monitor:job:add") @GetMapping("/add") - public String add(Model model) + public String add() { return prefix + "/add"; } + /** + * 新增保存调度 + */ + @Log(title = "定时任务", action = BusinessType.INSERT) + @RequiresPermissions("monitor:job:add") + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(Job job) + { + return toAjax(jobService.insertJobCron(job)); + } + /** * 修改调度 */ - @Log(title = "定时任务", action = BusinessType.UPDATE) - @RequiresPermissions("monitor:job:edit") @GetMapping("/edit/{jobId}") - public String edit(@PathVariable("jobId") Long jobId, Model model) + public String edit(@PathVariable("jobId") Long jobId, ModelMap mmap) { - Job job = jobService.selectJobById(jobId); - model.addAttribute("job", job); + mmap.put("job", jobService.selectJobById(jobId)); return prefix + "/edit"; } /** - * 保存调度 + * 修改保存调度 */ - @Log(title = "定时任务", action = BusinessType.SAVE) - @RequiresPermissions("monitor:job:save") - @PostMapping("/save") + @Log(title = "定时任务", action = BusinessType.UPDATE) + @RequiresPermissions("monitor:job:edit") + @PostMapping("/edit") @ResponseBody - public AjaxResult save(Job job) + public AjaxResult editSave(Job job) { - if (jobService.saveJobCron(job) > 0) - { - return success(); - } - return error(); + return toAjax(jobService.updateJobCron(job)); } } diff --git a/src/main/java/com/ruoyi/project/monitor/job/controller/JobLogController.java b/src/main/java/com/ruoyi/project/monitor/job/controller/JobLogController.java index 4f27e3f84..ac8a0a315 100644 --- a/src/main/java/com/ruoyi/project/monitor/job/controller/JobLogController.java +++ b/src/main/java/com/ruoyi/project/monitor/job/controller/JobLogController.java @@ -71,15 +71,6 @@ public class JobLogController extends BaseController @ResponseBody public AjaxResult remove(String ids) { - try - { - jobLogService.deleteJobLogByIds(ids); - return success(); - } - catch (Exception e) - { - e.printStackTrace(); - return error(e.getMessage()); - } + return toAjax(jobLogService.deleteJobLogByIds(ids)); } } diff --git a/src/main/java/com/ruoyi/project/monitor/job/service/IJobService.java b/src/main/java/com/ruoyi/project/monitor/job/service/IJobService.java index b700d2acc..13e4bec2c 100644 --- a/src/main/java/com/ruoyi/project/monitor/job/service/IJobService.java +++ b/src/main/java/com/ruoyi/project/monitor/job/service/IJobService.java @@ -66,7 +66,7 @@ public interface IJobService * @return 结果 */ public int changeStatus(Job job); - + /** * 立即运行任务 * @@ -81,7 +81,7 @@ public interface IJobService * @param job 调度信息 * @return 结果 */ - public int addJobCron(Job job); + public int insertJobCron(Job job); /** * 更新任务的时间表达式 @@ -91,11 +91,4 @@ public interface IJobService */ public int updateJobCron(Job job); - /** - * 保存任务的时间表达式 - * - * @param job 调度信息 - * @return 结果 - */ - public int saveJobCron(Job job); } diff --git a/src/main/java/com/ruoyi/project/monitor/job/service/JobLogServiceImpl.java b/src/main/java/com/ruoyi/project/monitor/job/service/JobLogServiceImpl.java index 6fb01bf17..44e612664 100644 --- a/src/main/java/com/ruoyi/project/monitor/job/service/JobLogServiceImpl.java +++ b/src/main/java/com/ruoyi/project/monitor/job/service/JobLogServiceImpl.java @@ -12,7 +12,7 @@ import com.ruoyi.project.monitor.job.mapper.JobLogMapper; * * @author ruoyi */ -@Service("jobLogService") +@Service public class JobLogServiceImpl implements IJobLogService { diff --git a/src/main/java/com/ruoyi/project/monitor/job/service/JobServiceImpl.java b/src/main/java/com/ruoyi/project/monitor/job/service/JobServiceImpl.java index cde60bd46..32bdf2c6a 100644 --- a/src/main/java/com/ruoyi/project/monitor/job/service/JobServiceImpl.java +++ b/src/main/java/com/ruoyi/project/monitor/job/service/JobServiceImpl.java @@ -1,17 +1,13 @@ package com.ruoyi.project.monitor.job.service; import java.util.List; - import javax.annotation.PostConstruct; - import org.quartz.CronTrigger; import org.quartz.Scheduler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - import com.ruoyi.common.constant.ScheduleConstants; import com.ruoyi.common.support.Convert; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.security.ShiroUtils; import com.ruoyi.project.monitor.job.domain.Job; import com.ruoyi.project.monitor.job.mapper.JobMapper; @@ -22,7 +18,7 @@ import com.ruoyi.project.monitor.job.util.ScheduleUtils; * * @author ruoyi */ -@Service("jobService") +@Service public class JobServiceImpl implements IJobService { @Autowired @@ -166,7 +162,7 @@ public class JobServiceImpl implements IJobService } return rows; } - + /** * 立即运行任务 * @@ -184,7 +180,7 @@ public class JobServiceImpl implements IJobService * @param job 调度信息 调度信息 */ @Override - public int addJobCron(Job job) + public int insertJobCron(Job job) { job.setCreateBy(ShiroUtils.getLoginName()); job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); @@ -204,6 +200,7 @@ public class JobServiceImpl implements IJobService @Override public int updateJobCron(Job job) { + job.setUpdateBy(ShiroUtils.getLoginName()); int rows = jobMapper.updateJob(job); if (rows > 0) { @@ -212,25 +209,4 @@ public class JobServiceImpl implements IJobService return rows; } - /** - * 保存任务的时间表达式 - * - * @param job 调度信息 - */ - @Override - public int saveJobCron(Job job) - { - Long jobId = job.getJobId(); - int rows = 0; - if (StringUtils.isNotNull(jobId)) - { - rows = updateJobCron(job); - } - else - { - rows = addJobCron(job); - } - return rows; - } - } diff --git a/src/main/java/com/ruoyi/project/monitor/logininfor/controller/LogininforController.java b/src/main/java/com/ruoyi/project/monitor/logininfor/controller/LogininforController.java index ec1e8e6b5..7a785b291 100644 --- a/src/main/java/com/ruoyi/project/monitor/logininfor/controller/LogininforController.java +++ b/src/main/java/com/ruoyi/project/monitor/logininfor/controller/LogininforController.java @@ -71,11 +71,6 @@ public class LogininforController extends BaseController @ResponseBody public AjaxResult remove(String ids) { - int rows = logininforService.deleteLogininforByIds(ids); - if (rows > 0) - { - return success(); - } - return error(); + return toAjax(logininforService.deleteLogininforByIds(ids)); } } diff --git a/src/main/java/com/ruoyi/project/monitor/logininfor/domain/Logininfor.java b/src/main/java/com/ruoyi/project/monitor/logininfor/domain/Logininfor.java index 130796757..51bc15502 100644 --- a/src/main/java/com/ruoyi/project/monitor/logininfor/domain/Logininfor.java +++ b/src/main/java/com/ruoyi/project/monitor/logininfor/domain/Logininfor.java @@ -14,7 +14,7 @@ public class Logininfor extends BaseEntity private static final long serialVersionUID = 1L; /** ID */ @Excel(name = "序号") - private Integer infoId; + private Long infoId; /** 用户账号 */ @Excel(name = "用户账号") private String loginName; @@ -40,12 +40,12 @@ public class Logininfor extends BaseEntity @Excel(name = "访问时间") private Date loginTime; - public Integer getInfoId() + public Long getInfoId() { return infoId; } - public void setInfoId(Integer infoId) + public void setInfoId(Long infoId) { this.infoId = infoId; } diff --git a/src/main/java/com/ruoyi/project/monitor/logininfor/service/LogininforServiceImpl.java b/src/main/java/com/ruoyi/project/monitor/logininfor/service/LogininforServiceImpl.java index b23d1257e..35b2bf18f 100644 --- a/src/main/java/com/ruoyi/project/monitor/logininfor/service/LogininforServiceImpl.java +++ b/src/main/java/com/ruoyi/project/monitor/logininfor/service/LogininforServiceImpl.java @@ -12,7 +12,7 @@ import com.ruoyi.project.monitor.logininfor.mapper.LogininforMapper; * * @author ruoyi */ -@Service("logininforService") +@Service public class LogininforServiceImpl implements ILogininforService { diff --git a/src/main/java/com/ruoyi/project/monitor/online/service/UserOnlineServiceImpl.java b/src/main/java/com/ruoyi/project/monitor/online/service/UserOnlineServiceImpl.java index be584773c..a61b17484 100644 --- a/src/main/java/com/ruoyi/project/monitor/online/service/UserOnlineServiceImpl.java +++ b/src/main/java/com/ruoyi/project/monitor/online/service/UserOnlineServiceImpl.java @@ -15,7 +15,7 @@ import com.ruoyi.project.monitor.online.mapper.UserOnlineMapper; * * @author ruoyi */ -@Service("userOnlineService") +@Service public class UserOnlineServiceImpl implements IUserOnlineService { @Autowired diff --git a/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java b/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java index cd308722c..42e8be1de 100644 --- a/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java +++ b/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java @@ -4,7 +4,7 @@ import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -72,20 +72,14 @@ public class OperlogController extends BaseController @ResponseBody public AjaxResult remove(String ids) { - int rows = operLogService.deleteOperLogByIds(ids); - if (rows > 0) - { - return success(); - } - return error(); + return toAjax(operLogService.deleteOperLogByIds(ids)); } @RequiresPermissions("monitor:operlog:detail") @GetMapping("/detail/{operId}") - public String detail(@PathVariable("operId") Long deptId, Model model) + public String detail(@PathVariable("operId") Long deptId, ModelMap mmap) { - OperLog operLog = operLogService.selectOperLogById(deptId); - model.addAttribute("operLog", operLog); + mmap.put("operLog", operLogService.selectOperLogById(deptId)); return prefix + "/detail"; } } diff --git a/src/main/java/com/ruoyi/project/monitor/operlog/domain/OperLog.java b/src/main/java/com/ruoyi/project/monitor/operlog/domain/OperLog.java index a996f5ff0..c28553d1c 100644 --- a/src/main/java/com/ruoyi/project/monitor/operlog/domain/OperLog.java +++ b/src/main/java/com/ruoyi/project/monitor/operlog/domain/OperLog.java @@ -16,7 +16,7 @@ public class OperLog extends BaseEntity /** 日志主键 */ @Excel(name = "操作序号") - private Integer operId; + private Long operId; /** 操作模块 */ @Excel(name = "操作模块") @@ -70,12 +70,12 @@ public class OperLog extends BaseEntity @Excel(name = "操作时间") private Date operTime; - public Integer getOperId() + public Long getOperId() { return operId; } - public void setOperId(Integer operId) + public void setOperId(Long operId) { this.operId = operId; } diff --git a/src/main/java/com/ruoyi/project/monitor/operlog/service/OperLogServiceImpl.java b/src/main/java/com/ruoyi/project/monitor/operlog/service/OperLogServiceImpl.java index 83f42df21..b2f01b982 100644 --- a/src/main/java/com/ruoyi/project/monitor/operlog/service/OperLogServiceImpl.java +++ b/src/main/java/com/ruoyi/project/monitor/operlog/service/OperLogServiceImpl.java @@ -12,7 +12,7 @@ import com.ruoyi.project.monitor.operlog.mapper.OperLogMapper; * * @author ruoyi */ -@Service("operLogService") +@Service public class OperLogServiceImpl implements IOperLogService { @Autowired diff --git a/src/main/java/com/ruoyi/project/system/config/controller/ConfigController.java b/src/main/java/com/ruoyi/project/system/config/controller/ConfigController.java index 612869b19..b88d71408 100644 --- a/src/main/java/com/ruoyi/project/system/config/controller/ConfigController.java +++ b/src/main/java/com/ruoyi/project/system/config/controller/ConfigController.java @@ -4,7 +4,7 @@ import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -35,7 +35,7 @@ public class ConfigController extends BaseController @RequiresPermissions("system:config:view") @GetMapping() - public String index() + public String config() { return prefix + "/config"; } @@ -52,7 +52,6 @@ public class ConfigController extends BaseController List list = configService.selectConfigList(config); return getDataTable(list); } - @Log(title = "参数管理", action = BusinessType.EXPORT) @PostMapping("/export") @@ -74,41 +73,44 @@ public class ConfigController extends BaseController /** * 新增参数配置 */ - @RequiresPermissions("system:config:add") - @Log(title = "参数管理", action = BusinessType.INSERT) @GetMapping("/add") public String add() { return prefix + "/add"; } + /** + * 新增保存参数配置 + */ + @RequiresPermissions("system:config:add") + @Log(title = "参数管理", action = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(Config config) + { + return toAjax(configService.insertConfig(config)); + } + /** * 修改参数配置 */ - @RequiresPermissions("system:config:edit") - @Log(title = "参数管理", action = BusinessType.UPDATE) @GetMapping("/edit/{configId}") - public String edit(@PathVariable("configId") Integer configId, Model model) + public String edit(@PathVariable("configId") Long configId, ModelMap mmap) { - Config config = configService.selectConfigById(configId); - model.addAttribute("config", config); + mmap.addAttribute("config", configService.selectConfigById(configId)); return prefix + "/edit"; } /** - * 保存参数配置 + * 修改保存参数配置 */ - @RequiresPermissions("system:config:save") - @Log(title = "参数管理", action = BusinessType.SAVE) - @PostMapping("/save") + @RequiresPermissions("system:config:edit") + @Log(title = "参数管理", action = BusinessType.UPDATE) + @PostMapping("/edit") @ResponseBody - public AjaxResult save(Config config) + public AjaxResult editSave(Config config) { - if (configService.saveConfig(config) > 0) - { - return success(); - } - return error(); + return toAjax(configService.updateConfig(config)); } /** @@ -120,11 +122,7 @@ public class ConfigController extends BaseController @ResponseBody public AjaxResult remove(String ids) { - if (configService.deleteConfigByIds(ids) > 0) - { - return success(); - } - return error(); + return toAjax(configService.deleteConfigByIds(ids)); } /** diff --git a/src/main/java/com/ruoyi/project/system/config/domain/Config.java b/src/main/java/com/ruoyi/project/system/config/domain/Config.java index 82811fda9..bc7f806ea 100644 --- a/src/main/java/com/ruoyi/project/system/config/domain/Config.java +++ b/src/main/java/com/ruoyi/project/system/config/domain/Config.java @@ -14,7 +14,7 @@ public class Config extends BaseEntity /** 参数主键 */ @Excel(name = "参数主键") - private Integer configId; + private Long configId; /** 参数名称 */ @Excel(name = "参数名称") @@ -32,12 +32,12 @@ public class Config extends BaseEntity @Excel(name = "系统内置") private String configType; - public Integer getConfigId() + public Long getConfigId() { return configId; } - public void setConfigId(Integer configId) + public void setConfigId(Long configId) { this.configId = configId; } diff --git a/src/main/java/com/ruoyi/project/system/config/mapper/ConfigMapper.java b/src/main/java/com/ruoyi/project/system/config/mapper/ConfigMapper.java index 6c75ae15e..9711fd652 100644 --- a/src/main/java/com/ruoyi/project/system/config/mapper/ConfigMapper.java +++ b/src/main/java/com/ruoyi/project/system/config/mapper/ConfigMapper.java @@ -10,22 +10,13 @@ import java.util.List; */ public interface ConfigMapper { - /** * 查询参数配置信息 * - * @param configId 参数配置ID + * @param configId 参数配置信息 * @return 参数配置信息 */ - public Config selectConfigById(Integer configId); - - /** - * 根据键名查询参数配置信息 - * - * @param configKey 参数键名 - * @return 参数配置信息 - */ - public Config selectConfigByKey(String configKey); + public Config selectConfig(Config config); /** * 查询参数配置列表 @@ -35,6 +26,14 @@ public interface ConfigMapper */ public List selectConfigList(Config config); + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数键名 + * @return 参数配置信息 + */ + public Config checkConfigKeyUnique(String configKey); + /** * 新增参数配置 * @@ -51,14 +50,6 @@ public interface ConfigMapper */ public int updateConfig(Config config); - /** - * 删除参数配置 - * - * @param configId 参数配置ID - * @return 结果 - */ - public int deleteConfigById(Integer configId); - /** * 批量删除参数配置 * diff --git a/src/main/java/com/ruoyi/project/system/config/service/ConfigServiceImpl.java b/src/main/java/com/ruoyi/project/system/config/service/ConfigServiceImpl.java index aba3c2430..495e1691a 100644 --- a/src/main/java/com/ruoyi/project/system/config/service/ConfigServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/config/service/ConfigServiceImpl.java @@ -6,6 +6,7 @@ import org.springframework.stereotype.Service; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.support.Convert; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.security.ShiroUtils; import com.ruoyi.project.system.config.domain.Config; import com.ruoyi.project.system.config.mapper.ConfigMapper; @@ -27,9 +28,11 @@ public class ConfigServiceImpl implements IConfigService * @return 参数配置信息 */ @Override - public Config selectConfigById(Integer configId) + public Config selectConfigById(Long configId) { - return configMapper.selectConfigById(configId); + Config config = new Config(); + config.setConfigId(configId); + return configMapper.selectConfig(config); } /** @@ -41,8 +44,10 @@ public class ConfigServiceImpl implements IConfigService @Override public String selectConfigByKey(String configKey) { - Config config = configMapper.selectConfigByKey(configKey); - return StringUtils.isNotNull(config) ? config.getConfigValue() : ""; + Config config = new Config(); + config.setConfigKey(configKey); + Config retConfig = configMapper.selectConfig(config); + return StringUtils.isNotNull(retConfig) ? retConfig.getConfigValue() : ""; } /** @@ -66,6 +71,7 @@ public class ConfigServiceImpl implements IConfigService @Override public int insertConfig(Config config) { + config.setCreateBy(ShiroUtils.getLoginName()); return configMapper.insertConfig(config); } @@ -78,43 +84,10 @@ public class ConfigServiceImpl implements IConfigService @Override public int updateConfig(Config config) { + config.setUpdateBy(ShiroUtils.getLoginName()); return configMapper.updateConfig(config); } - /** - * 保存参数配置 - * - * @param config 参数配置信息 - * @return 结果 - */ - @Override - public int saveConfig(Config config) - { - Integer configId = config.getConfigId(); - int rows = 0; - if (StringUtils.isNotNull(configId)) - { - rows = configMapper.updateConfig(config); - } - else - { - rows = configMapper.insertConfig(config); - } - return rows; - } - - /** - * 删除参数配置信息 - * - * @param configId 参数配置ID - * @return 结果 - */ - @Override - public int deleteConfigById(Integer configId) - { - return configMapper.deleteConfigById(configId); - } - /** * 批量删除参数配置对象 * @@ -136,14 +109,9 @@ public class ConfigServiceImpl implements IConfigService @Override public String checkConfigKeyUnique(Config config) { - if (config.getConfigId() == null) - { - config.setConfigId(-1); - } - Integer configId = config.getConfigId(); - Config info = configMapper.selectConfigByKey(config.getConfigKey()); - if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getConfigId()) - && info.getConfigId().intValue() != configId.intValue()) + Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); + Config info = configMapper.checkConfigKeyUnique(config.getConfigKey()); + if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) { return UserConstants.CONFIG_KEY_NOT_UNIQUE; } diff --git a/src/main/java/com/ruoyi/project/system/config/service/IConfigService.java b/src/main/java/com/ruoyi/project/system/config/service/IConfigService.java index f05bd2c48..8b0c91abb 100644 --- a/src/main/java/com/ruoyi/project/system/config/service/IConfigService.java +++ b/src/main/java/com/ruoyi/project/system/config/service/IConfigService.java @@ -17,7 +17,7 @@ public interface IConfigService * @param configId 参数配置ID * @return 参数配置信息 */ - public Config selectConfigById(Integer configId); + public Config selectConfigById(Long configId); /** * 根据键名查询参数配置信息 @@ -51,22 +51,6 @@ public interface IConfigService */ public int updateConfig(Config config); - /** - * 保存参数配置 - * - * @param config 参数配置信息 - * @return 结果 - */ - public int saveConfig(Config config); - - /** - * 删除参数配置信息 - * - * @param configId 参数配置ID - * @return 结果 - */ - public int deleteConfigById(Integer configId); - /** * 批量删除参数配置信息 * diff --git a/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java b/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java index 695fbab4c..5b3ff6fc0 100644 --- a/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java +++ b/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java @@ -5,7 +5,7 @@ import java.util.Map; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -49,45 +49,47 @@ public class DeptController extends BaseController } /** - * 修改 + * 新增部门 */ - @Log(title = "部门管理", action = BusinessType.UPDATE) - @RequiresPermissions("system:dept:edit") - @GetMapping("/edit/{deptId}") - public String edit(@PathVariable("deptId") Long deptId, Model model) + @GetMapping("/add/{parentId}") + public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) { - Dept dept = deptService.selectDeptById(deptId); - model.addAttribute("dept", dept); - return prefix + "/edit"; + mmap.put("dept", deptService.selectDeptById(parentId)); + return prefix + "/add"; } /** - * 新增 + * 新增保存部门 */ @Log(title = "部门管理", action = BusinessType.INSERT) @RequiresPermissions("system:dept:add") - @GetMapping("/add/{parentId}") - public String add(@PathVariable("parentId") Long parentId, Model model) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(Dept dept) { - Dept dept = deptService.selectDeptById(parentId); - model.addAttribute("dept", dept); - return prefix + "/add"; + return toAjax(deptService.insertDept(dept)); + } + + /** + * 修改 + */ + @GetMapping("/edit/{deptId}") + public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap) + { + mmap.put("dept", deptService.selectDeptById(deptId)); + return prefix + "/edit"; } /** * 保存 */ - @Log(title = "部门管理", action = BusinessType.SAVE) - @RequiresPermissions("system:dept:save") - @PostMapping("/save") + @Log(title = "部门管理", action = BusinessType.UPDATE) + @RequiresPermissions("system:dept:edit") + @PostMapping("/edit") @ResponseBody - public AjaxResult save(Dept dept) + public AjaxResult editSave(Dept dept) { - if (deptService.saveDept(dept) > 0) - { - return success(); - } - return error(); + return toAjax(deptService.updateDept(dept)); } /** @@ -107,11 +109,7 @@ public class DeptController extends BaseController { return error(1, "部门存在用户,不允许删除"); } - if (deptService.deleteDeptById(deptId) > 0) - { - return success(); - } - return error(); + return toAjax(deptService.deleteDeptById(deptId)); } /** @@ -133,9 +131,9 @@ public class DeptController extends BaseController * 选择部门树 */ @GetMapping("/selectDeptTree/{deptId}") - public String selectDeptTree(@PathVariable("deptId") Long deptId, Model model) + public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap) { - model.addAttribute("treeName", deptService.selectDeptById(deptId).getDeptName()); + mmap.put("treeName", deptService.selectDeptById(deptId).getDeptName()); return prefix + "/tree"; } diff --git a/src/main/java/com/ruoyi/project/system/dept/service/DeptServiceImpl.java b/src/main/java/com/ruoyi/project/system/dept/service/DeptServiceImpl.java index 416b8bcbe..4cea018c9 100644 --- a/src/main/java/com/ruoyi/project/system/dept/service/DeptServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/dept/service/DeptServiceImpl.java @@ -5,7 +5,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; +import org.springframework.stereotype.Service; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.security.ShiroUtils; @@ -17,7 +17,7 @@ import com.ruoyi.project.system.dept.mapper.DeptMapper; * * @author ruoyi */ -@Repository("deptService") +@Service public class DeptServiceImpl implements IDeptService { @Autowired @@ -111,24 +111,29 @@ public class DeptServiceImpl implements IDeptService } /** - * 保存部门信息 + * 新增保存部门信息 * * @param dept 部门信息 * @return 结果 */ @Override - public int saveDept(Dept dept) + public int insertDept(Dept dept) { - if (StringUtils.isNotNull(dept.getDeptId())) - { - dept.setUpdateBy(ShiroUtils.getLoginName()); - return deptMapper.updateDept(dept); - } - else - { - dept.setCreateBy(ShiroUtils.getLoginName()); - return deptMapper.insertDept(dept); - } + dept.setCreateBy(ShiroUtils.getLoginName()); + return deptMapper.insertDept(dept); + } + + /** + * 修改保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + @Override + public int updateDept(Dept dept) + { + dept.setUpdateBy(ShiroUtils.getLoginName()); + return deptMapper.updateDept(dept); } /** @@ -152,14 +157,9 @@ public class DeptServiceImpl implements IDeptService @Override public String checkDeptNameUnique(Dept dept) { - if (dept.getDeptId() == null) - { - dept.setDeptId(-1L); - } - Long deptId = dept.getDeptId(); + Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId(); Dept info = deptMapper.checkDeptNameUnique(dept.getDeptName()); - if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getDeptId()) - && info.getDeptId().longValue() != deptId.longValue()) + if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) { return UserConstants.DEPT_NAME_NOT_UNIQUE; } diff --git a/src/main/java/com/ruoyi/project/system/dept/service/IDeptService.java b/src/main/java/com/ruoyi/project/system/dept/service/IDeptService.java index 3b40d267b..b42d437dc 100644 --- a/src/main/java/com/ruoyi/project/system/dept/service/IDeptService.java +++ b/src/main/java/com/ruoyi/project/system/dept/service/IDeptService.java @@ -58,12 +58,20 @@ public interface IDeptService public int deleteDeptById(Long deptId); /** - * 保存部门信息 + * 新增保存部门信息 * * @param dept 部门信息 * @return 结果 */ - public int saveDept(Dept dept); + public int insertDept(Dept dept); + + /** + * 修改保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int updateDept(Dept dept); /** * 根据部门ID查询信息 diff --git a/src/main/java/com/ruoyi/project/system/dict/controller/DictDataController.java b/src/main/java/com/ruoyi/project/system/dict/controller/DictDataController.java index d713bfa46..3edbce92f 100644 --- a/src/main/java/com/ruoyi/project/system/dict/controller/DictDataController.java +++ b/src/main/java/com/ruoyi/project/system/dict/controller/DictDataController.java @@ -4,7 +4,7 @@ import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -67,45 +67,48 @@ public class DictDataController extends BaseController } } - /** - * 修改字典类型 - */ - @Log(title = "字典数据", action = BusinessType.UPDATE) - @RequiresPermissions("system:dict:edit") - @GetMapping("/edit/{dictCode}") - public String edit(@PathVariable("dictCode") Long dictCode, Model model) - { - DictData dict = dictDataService.selectDictDataById(dictCode); - model.addAttribute("dict", dict); - return prefix + "/edit"; - } - /** * 新增字典类型 */ - @Log(title = "字典数据", action = BusinessType.INSERT) - @RequiresPermissions("system:dict:add") @GetMapping("/add/{dictType}") - public String add(@PathVariable("dictType") String dictType, Model model) + public String add(@PathVariable("dictType") String dictType, ModelMap mmap) { - model.addAttribute("dictType", dictType); + mmap.put("dictType", dictType); return prefix + "/add"; } /** - * 保存字典类型 + * 新增保存字典类型 */ - @Log(title = "字典数据", action = BusinessType.SAVE) - @RequiresPermissions("system:dict:save") - @PostMapping("/save") + @Log(title = "字典数据", action = BusinessType.INSERT) + @RequiresPermissions("system:dict:add") + @PostMapping("/add") @ResponseBody - public AjaxResult save(DictData dict) + public AjaxResult addSave(DictData dict) { - if (dictDataService.saveDictData(dict) > 0) - { - return success(); - } - return error(); + return toAjax(dictDataService.insertDictData(dict)); + } + + /** + * 修改字典类型 + */ + @GetMapping("/edit/{dictCode}") + public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap) + { + mmap.put("dict", dictDataService.selectDictDataById(dictCode)); + return prefix + "/edit"; + } + + /** + * 修改保存字典类型 + */ + @Log(title = "字典数据", action = BusinessType.UPDATE) + @RequiresPermissions("system:dict:edit") + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(DictData dict) + { + return toAjax(dictDataService.updateDictData(dict)); } @Log(title = "字典数据", action = BusinessType.DELETE) @@ -114,11 +117,6 @@ public class DictDataController extends BaseController @ResponseBody public AjaxResult remove(String ids) { - int rows = dictDataService.deleteDictDataByIds(ids); - if (rows > 0) - { - return success(); - } - return error(); + return toAjax(dictDataService.deleteDictDataByIds(ids)); } } diff --git a/src/main/java/com/ruoyi/project/system/dict/controller/DictTypeController.java b/src/main/java/com/ruoyi/project/system/dict/controller/DictTypeController.java index 943750811..07796f3c5 100644 --- a/src/main/java/com/ruoyi/project/system/dict/controller/DictTypeController.java +++ b/src/main/java/com/ruoyi/project/system/dict/controller/DictTypeController.java @@ -4,7 +4,7 @@ import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -67,24 +67,9 @@ public class DictTypeController extends BaseController } } - /** - * 修改字典类型 - */ - @Log(title = "字典类型", action = BusinessType.UPDATE) - @RequiresPermissions("system:dict:edit") - @GetMapping("/edit/{dictId}") - public String edit(@PathVariable("dictId") Long dictId, Model model) - { - DictType dict = dictTypeService.selectDictTypeById(dictId); - model.addAttribute("dict", dict); - return prefix + "/edit"; - } - /** * 新增字典类型 */ - @Log(title = "字典类型", action = BusinessType.INSERT) - @RequiresPermissions("system:dict:add") @GetMapping("/add") public String add() { @@ -92,19 +77,37 @@ public class DictTypeController extends BaseController } /** - * 保存字典类型 + * 新增保存字典类型 */ - @Log(title = "字典类型", action = BusinessType.SAVE) - @RequiresPermissions("system:dict:save") - @PostMapping("/save") + @Log(title = "字典类型", action = BusinessType.INSERT) + @RequiresPermissions("system:dict:add") + @PostMapping("/add") @ResponseBody - public AjaxResult save(DictType dict) + public AjaxResult addSave(DictType dict) { - if (dictTypeService.saveDictType(dict) > 0) - { - return success(); - } - return error(); + return toAjax(dictTypeService.insertDictType(dict)); + } + + /** + * 修改字典类型 + */ + @GetMapping("/edit/{dictId}") + public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap) + { + mmap.put("dict", dictTypeService.selectDictTypeById(dictId)); + return prefix + "/edit"; + } + + /** + * 修改保存字典类型 + */ + @Log(title = "字典类型", action = BusinessType.UPDATE) + @RequiresPermissions("system:dict:edit") + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(DictType dict) + { + return toAjax(dictTypeService.updateDictType(dict)); } @Log(title = "字典类型", action = BusinessType.DELETE) @@ -115,8 +118,7 @@ public class DictTypeController extends BaseController { try { - dictTypeService.deleteDictTypeByIds(ids); - return success(); + return toAjax(dictTypeService.deleteDictTypeByIds(ids)); } catch (Exception e) { @@ -129,12 +131,10 @@ public class DictTypeController extends BaseController */ @RequiresPermissions("system:dict:list") @GetMapping("/detail/{dictId}") - public String detail(@PathVariable("dictId") Long dictId, Model model) + public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap) { - DictType dict = dictTypeService.selectDictTypeById(dictId); - List dictTypeList = dictTypeService.selectDictTypeAll(); - model.addAttribute("dict", dict); - model.addAttribute("dictList", dictTypeList); + mmap.put("dict", dictTypeService.selectDictTypeById(dictId)); + mmap.put("dictList", dictTypeService.selectDictTypeAll()); return "system/dict/data/data"; } diff --git a/src/main/java/com/ruoyi/project/system/dict/domain/DictData.java b/src/main/java/com/ruoyi/project/system/dict/domain/DictData.java index 09d83a2c2..b2351923e 100644 --- a/src/main/java/com/ruoyi/project/system/dict/domain/DictData.java +++ b/src/main/java/com/ruoyi/project/system/dict/domain/DictData.java @@ -36,6 +36,9 @@ public class DictData extends BaseEntity @Excel(name = "字典样式") private String cssClass; + /** 表格字典样式 */ + private String listClass; + /** 是否默认(Y是 N否) */ @Excel(name = "是否默认") private String isDefault; @@ -104,6 +107,16 @@ public class DictData extends BaseEntity this.cssClass = cssClass; } + public String getListClass() + { + return listClass; + } + + public void setListClass(String listClass) + { + this.listClass = listClass; + } + public String getIsDefault() { return isDefault; diff --git a/src/main/java/com/ruoyi/project/system/dict/mapper/DictDataMapper.java b/src/main/java/com/ruoyi/project/system/dict/mapper/DictDataMapper.java index b18ade9e9..79fd2b780 100644 --- a/src/main/java/com/ruoyi/project/system/dict/mapper/DictDataMapper.java +++ b/src/main/java/com/ruoyi/project/system/dict/mapper/DictDataMapper.java @@ -1,6 +1,9 @@ package com.ruoyi.project.system.dict.mapper; import java.util.List; + +import org.apache.ibatis.annotations.Param; + import com.ruoyi.project.system.dict.domain.DictData; /** @@ -18,7 +21,7 @@ public interface DictDataMapper * @return 字典数据集合信息 */ public List selectDictDataList(DictData dictData); - + /** * 根据字典类型查询字典数据 * @@ -27,6 +30,15 @@ public interface DictDataMapper */ public List selectDictDataByType(String dictType); + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue); + /** * 根据字典数据ID查询信息 * @@ -34,7 +46,7 @@ public interface DictDataMapper * @return 字典数据 */ public DictData selectDictDataById(Long dictCode); - + /** * 查询字典数据 * @@ -42,7 +54,7 @@ public interface DictDataMapper * @return 字典数据 */ public int countDictDataByType(String dictType); - + /** * 通过字典ID删除字典数据信息 * @@ -50,7 +62,7 @@ public interface DictDataMapper * @return 结果 */ public int deleteDictDataById(Long dictCode); - + /** * 批量删除字典数据 * diff --git a/src/main/java/com/ruoyi/project/system/dict/service/DictDataServiceImpl.java b/src/main/java/com/ruoyi/project/system/dict/service/DictDataServiceImpl.java index d4c0f00fd..c93f4e944 100644 --- a/src/main/java/com/ruoyi/project/system/dict/service/DictDataServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/dict/service/DictDataServiceImpl.java @@ -4,7 +4,6 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.support.Convert; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.security.ShiroUtils; import com.ruoyi.project.system.dict.domain.DictData; import com.ruoyi.project.system.dict.mapper.DictDataMapper; @@ -14,7 +13,7 @@ import com.ruoyi.project.system.dict.mapper.DictDataMapper; * * @author ruoyi */ -@Service("dictDataService") +@Service public class DictDataServiceImpl implements IDictDataService { @Autowired @@ -44,6 +43,18 @@ public class DictDataServiceImpl implements IDictDataService return dictDataMapper.selectDictDataByType(dictType); } + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + public String selectDictLabel(String dictType, String dictValue) + { + return dictDataMapper.selectDictLabel(dictType, dictValue); + } + /** * 根据字典数据ID查询信息 * @@ -81,25 +92,29 @@ public class DictDataServiceImpl implements IDictDataService } /** - * 保存字典数据信息 + * 新增保存字典数据信息 * * @param dictData 字典数据信息 * @return 结果 */ @Override - public int saveDictData(DictData dictData) + public int insertDictData(DictData dictData) { - Long dictCode = dictData.getDictCode(); - if (StringUtils.isNotNull(dictCode)) - { - dictData.setUpdateBy(ShiroUtils.getLoginName()); - return dictDataMapper.updateDictData(dictData); - } - else - { - dictData.setCreateBy(ShiroUtils.getLoginName()); - return dictDataMapper.insertDictData(dictData); - } + dictData.setCreateBy(ShiroUtils.getLoginName()); + return dictDataMapper.insertDictData(dictData); + } + + /** + * 修改保存字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + @Override + public int updateDictData(DictData dictData) + { + dictData.setUpdateBy(ShiroUtils.getLoginName()); + return dictDataMapper.updateDictData(dictData); } } diff --git a/src/main/java/com/ruoyi/project/system/dict/service/DictTypeServiceImpl.java b/src/main/java/com/ruoyi/project/system/dict/service/DictTypeServiceImpl.java index 74d13c25e..51583e328 100644 --- a/src/main/java/com/ruoyi/project/system/dict/service/DictTypeServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/dict/service/DictTypeServiceImpl.java @@ -16,7 +16,7 @@ import com.ruoyi.project.system.dict.mapper.DictTypeMapper; * * @author ruoyi */ -@Service("dictTypeService") +@Service public class DictTypeServiceImpl implements IDictTypeService { @Autowired @@ -95,25 +95,29 @@ public class DictTypeServiceImpl implements IDictTypeService } /** - * 保存字典类型信息 + * 新增保存字典类型信息 * * @param dictType 字典类型信息 * @return 结果 */ @Override - public int saveDictType(DictType dictType) + public int insertDictType(DictType dictType) { - Long dictId = dictType.getDictId(); - if (StringUtils.isNotNull(dictId)) - { - dictType.setUpdateBy(ShiroUtils.getLoginName()); - return dictTypeMapper.updateDictType(dictType); - } - else - { - dictType.setCreateBy(ShiroUtils.getLoginName()); - return dictTypeMapper.insertDictType(dictType); - } + dictType.setCreateBy(ShiroUtils.getLoginName()); + return dictTypeMapper.insertDictType(dictType); + } + + /** + * 修改保存字典类型信息 + * + * @param dictType 字典类型信息 + * @return 结果 + */ + @Override + public int updateDictType(DictType dictType) + { + dictType.setUpdateBy(ShiroUtils.getLoginName()); + return dictTypeMapper.updateDictType(dictType); } /** @@ -125,11 +129,7 @@ public class DictTypeServiceImpl implements IDictTypeService @Override public String checkDictTypeUnique(DictType dict) { - if (dict.getDictId() == null) - { - dict.setDictId(-1L); - } - Long dictId = dict.getDictId(); + Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId(); DictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType()); if (StringUtils.isNotNull(dictType) && dictType.getDictId() != dictId) { diff --git a/src/main/java/com/ruoyi/project/system/dict/service/IDictDataService.java b/src/main/java/com/ruoyi/project/system/dict/service/IDictDataService.java index f9c4eba1d..f56486312 100644 --- a/src/main/java/com/ruoyi/project/system/dict/service/IDictDataService.java +++ b/src/main/java/com/ruoyi/project/system/dict/service/IDictDataService.java @@ -18,7 +18,7 @@ public interface IDictDataService * @return 字典数据集合信息 */ public List selectDictDataList(DictData dictData); - + /** * 根据字典类型查询字典数据 * @@ -26,7 +26,16 @@ public interface IDictDataService * @return 字典数据集合信息 */ public List selectDictDataByType(String dictType); - + + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + public String selectDictLabel(String dictType, String dictValue); + /** * 根据字典数据ID查询信息 * @@ -34,7 +43,7 @@ public interface IDictDataService * @return 字典数据 */ public DictData selectDictDataById(Long dictCode); - + /** * 通过字典ID删除字典数据信息 * @@ -52,11 +61,19 @@ public interface IDictDataService public int deleteDictDataByIds(String ids); /** - * 保存字典数据信息 + * 新增保存字典数据信息 * * @param dictData 字典数据信息 * @return 结果 */ - public int saveDictData(DictData dictData); + public int insertDictData(DictData dictData); + + /** + * 修改保存字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + public int updateDictData(DictData dictData); } diff --git a/src/main/java/com/ruoyi/project/system/dict/service/IDictTypeService.java b/src/main/java/com/ruoyi/project/system/dict/service/IDictTypeService.java index 7a6037a58..cd814d69d 100644 --- a/src/main/java/com/ruoyi/project/system/dict/service/IDictTypeService.java +++ b/src/main/java/com/ruoyi/project/system/dict/service/IDictTypeService.java @@ -17,7 +17,7 @@ public interface IDictTypeService * @return 字典类型集合信息 */ public List selectDictTypeList(DictType dictType); - + /** * 根据所有字典类型 * @@ -32,7 +32,7 @@ public interface IDictTypeService * @return 字典类型 */ public DictType selectDictTypeById(Long dictId); - + /** * 通过字典ID删除字典信息 * @@ -41,22 +41,29 @@ public interface IDictTypeService */ public int deleteDictTypeById(Long dictId); - /** * 批量删除字典类型 * * @param ids 需要删除的数据 * @return 结果 */ - public int deleteDictTypeByIds(String ids) throws Exception; + public int deleteDictTypeByIds(String ids) throws Exception; /** - * 保存字典类型信息 + * 新增保存字典类型信息 * * @param dictType 字典类型信息 * @return 结果 */ - public int saveDictType(DictType dictType); + public int insertDictType(DictType dictType); + + /** + * 修改保存字典类型信息 + * + * @param dictType 字典类型信息 + * @return 结果 + */ + public int updateDictType(DictType dictType); /** * 校验字典类型称是否唯一 diff --git a/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java b/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java index b90e38b77..d5a7cf6d0 100644 --- a/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java +++ b/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java @@ -5,7 +5,7 @@ import java.util.Map; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -67,33 +67,14 @@ public class MenuController extends BaseController { return error(1, "菜单已分配,不允许删除"); } - if (menuService.deleteMenuById(menuId) > 0) - { - return success(); - } - return error(); - } - - /** - * 修改菜单 - */ - @Log(title = "菜单管理", action = BusinessType.UPDATE) - @RequiresPermissions("system:menu:edit") - @GetMapping("/edit/{menuId}") - public String edit(@PathVariable("menuId") Long menuId, Model model) - { - Menu menu = menuService.selectMenuById(menuId); - model.addAttribute("menu", menu); - return prefix + "/edit"; + return toAjax(menuService.deleteMenuById(menuId)); } /** * 新增 */ - @Log(title = "菜单管理", action = BusinessType.INSERT) - @RequiresPermissions("system:menu:add") @GetMapping("/add/{parentId}") - public String add(@PathVariable("parentId") Long parentId, Model model) + public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) { Menu menu = null; if (0L != parentId) @@ -106,24 +87,42 @@ public class MenuController extends BaseController menu.setMenuId(0L); menu.setMenuName("主目录"); } - model.addAttribute("menu", menu); + mmap.put("menu", menu); return prefix + "/add"; } /** - * 保存菜单 + * 新增保存菜单 */ - @Log(title = "菜单管理", action = BusinessType.SAVE) - @RequiresPermissions("system:menu:save") - @PostMapping("/save") + @Log(title = "菜单管理", action = BusinessType.INSERT) + @RequiresPermissions("system:menu:add") + @PostMapping("/add") @ResponseBody - public AjaxResult save(Menu menu) + public AjaxResult addSave(Menu menu) { - if (menuService.saveMenu(menu) > 0) - { - return success(); - } - return error(); + return toAjax(menuService.insertMenu(menu)); + } + + /** + * 修改菜单 + */ + @GetMapping("/edit/{menuId}") + public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap) + { + mmap.put("menu", menuService.selectMenuById(menuId)); + return prefix + "/edit"; + } + + /** + * 修改保存菜单 + */ + @Log(title = "菜单管理", action = BusinessType.UPDATE) + @RequiresPermissions("system:menu:edit") + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(Menu menu) + { + return toAjax(menuService.updateMenu(menu)); } /** @@ -176,9 +175,9 @@ public class MenuController extends BaseController * 选择菜单树 */ @GetMapping("/selectMenuTree/{menuId}") - public String selectMenuTree(@PathVariable("menuId") Long menuId, Model model) + public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap) { - model.addAttribute("treeName", menuService.selectMenuById(menuId).getMenuName()); + mmap.put("treeName", menuService.selectMenuById(menuId).getMenuName()); return prefix + "/tree"; } } \ No newline at end of file diff --git a/src/main/java/com/ruoyi/project/system/menu/service/IMenuService.java b/src/main/java/com/ruoyi/project/system/menu/service/IMenuService.java index 0f91cd494..845efb42d 100644 --- a/src/main/java/com/ruoyi/project/system/menu/service/IMenuService.java +++ b/src/main/java/com/ruoyi/project/system/menu/service/IMenuService.java @@ -100,12 +100,20 @@ public interface IMenuService public int selectCountRoleMenuByMenuId(Long menuId); /** - * 保存菜单信息 + * 新增保存菜单信息 * * @param menu 菜单信息 * @return 结果 */ - public int saveMenu(Menu menu); + public int insertMenu(Menu menu); + + /** + * 修改保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public int updateMenu(Menu menu); /** * 校验菜单名称是否唯一 diff --git a/src/main/java/com/ruoyi/project/system/menu/service/MenuServiceImpl.java b/src/main/java/com/ruoyi/project/system/menu/service/MenuServiceImpl.java index 28e692180..61df2a684 100644 --- a/src/main/java/com/ruoyi/project/system/menu/service/MenuServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/menu/service/MenuServiceImpl.java @@ -25,7 +25,7 @@ import com.ruoyi.project.system.role.mapper.RoleMenuMapper; * * @author ruoyi */ -@Service("menuService") +@Service public class MenuServiceImpl implements IMenuService { public static final String PREMISSION_STRING = "perms[\"{0}\"]"; @@ -245,27 +245,31 @@ public class MenuServiceImpl implements IMenuService } /** - * 保存菜单信息 + * 新增保存菜单信息 * * @param menu 菜单信息 * @return 结果 */ @Override - public int saveMenu(Menu menu) + public int insertMenu(Menu menu) { - Long menuId = menu.getMenuId(); - if (StringUtils.isNotNull(menuId)) - { - menu.setUpdateBy(ShiroUtils.getLoginName()); - ShiroUtils.clearCachedAuthorizationInfo(); - return menuMapper.updateMenu(menu); - } - else - { - menu.setCreateBy(ShiroUtils.getLoginName()); - ShiroUtils.clearCachedAuthorizationInfo(); - return menuMapper.insertMenu(menu); - } + menu.setCreateBy(ShiroUtils.getLoginName()); + ShiroUtils.clearCachedAuthorizationInfo(); + return menuMapper.insertMenu(menu); + } + + /** + * 修改保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + @Override + public int updateMenu(Menu menu) + { + menu.setUpdateBy(ShiroUtils.getLoginName()); + ShiroUtils.clearCachedAuthorizationInfo(); + return menuMapper.updateMenu(menu); } /** @@ -277,14 +281,9 @@ public class MenuServiceImpl implements IMenuService @Override public String checkMenuNameUnique(Menu menu) { - if (menu.getMenuId() == null) - { - menu.setMenuId(-1L); - } - Long menuId = menu.getMenuId(); + Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId(); Menu info = menuMapper.checkMenuNameUnique(menu.getMenuName()); - if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getMenuId()) - && info.getMenuId().longValue() != menuId.longValue()) + if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) { return UserConstants.MENU_NAME_NOT_UNIQUE; } diff --git a/src/main/java/com/ruoyi/project/system/notice/controller/NoticeController.java b/src/main/java/com/ruoyi/project/system/notice/controller/NoticeController.java index 14ca29d78..bbda522c2 100644 --- a/src/main/java/com/ruoyi/project/system/notice/controller/NoticeController.java +++ b/src/main/java/com/ruoyi/project/system/notice/controller/NoticeController.java @@ -4,19 +4,19 @@ import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.project.system.notice.domain.Notice; -import com.ruoyi.project.system.notice.service.INoticeService; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.constant.BusinessType; import com.ruoyi.framework.web.controller.BaseController; -import com.ruoyi.framework.web.page.TableDataInfo; import com.ruoyi.framework.web.domain.AjaxResult; +import com.ruoyi.framework.web.page.TableDataInfo; +import com.ruoyi.project.system.notice.domain.Notice; +import com.ruoyi.project.system.notice.service.INoticeService; /** * 公告 信息操作处理 @@ -55,41 +55,44 @@ public class NoticeController extends BaseController /** * 新增公告 */ - @RequiresPermissions("system:notice:add") - @Log(title = "通知公告", action = BusinessType.INSERT) @GetMapping("/add") public String add() { return prefix + "/add"; } + /** + * 新增保存公告 + */ + @RequiresPermissions("system:notice:add") + @Log(title = "通知公告", action = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(Notice notice) + { + return toAjax(noticeService.insertNotice(notice)); + } + /** * 修改公告 */ - @RequiresPermissions("system:notice:edit") - @Log(title = "通知公告", action = BusinessType.UPDATE) @GetMapping("/edit/{noticeId}") - public String edit(@PathVariable("noticeId") Integer noticeId, Model model) + public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap) { - Notice notice = noticeService.selectNoticeById(noticeId); - model.addAttribute("notice", notice); + mmap.put("notice", noticeService.selectNoticeById(noticeId)); return prefix + "/edit"; } /** - * 保存公告 + * 修改保存公告 */ - @RequiresPermissions("system:notice:save") - @Log(title = "通知公告", action = BusinessType.SAVE) - @PostMapping("/save") + @RequiresPermissions("system:notice:edit") + @Log(title = "通知公告", action = BusinessType.UPDATE) + @PostMapping("/edit") @ResponseBody - public AjaxResult save(Notice notice) + public AjaxResult editSave(Notice notice) { - if (noticeService.saveNotice(notice) > 0) - { - return success(); - } - return error(); + return toAjax(noticeService.updateNotice(notice)); } /** @@ -101,12 +104,7 @@ public class NoticeController extends BaseController @ResponseBody public AjaxResult remove(String ids) { - int rows = noticeService.deleteNoticeByIds(ids); - if (rows > 0) - { - return success(); - } - return error(); + return toAjax(noticeService.deleteNoticeByIds(ids)); } } diff --git a/src/main/java/com/ruoyi/project/system/notice/domain/Notice.java b/src/main/java/com/ruoyi/project/system/notice/domain/Notice.java index b0eceb72f..1fe8a29cc 100644 --- a/src/main/java/com/ruoyi/project/system/notice/domain/Notice.java +++ b/src/main/java/com/ruoyi/project/system/notice/domain/Notice.java @@ -12,7 +12,7 @@ public class Notice extends BaseEntity private static final long serialVersionUID = 1L; /** 公告ID */ - private Integer noticeId; + private Long noticeId; /** 公告标题 */ private String noticeTitle; /** 公告类型(1通知 2公告) */ @@ -22,16 +22,16 @@ public class Notice extends BaseEntity /** 公告状态(0正常 1关闭) */ private String status; - public void setNoticeId(Integer noticeId) - { - this.noticeId = noticeId; - } - - public Integer getNoticeId() + public Long getNoticeId() { return noticeId; } + public void setNoticeId(Long noticeId) + { + this.noticeId = noticeId; + } + public void setNoticeTitle(String noticeTitle) { this.noticeTitle = noticeTitle; diff --git a/src/main/java/com/ruoyi/project/system/notice/mapper/NoticeMapper.java b/src/main/java/com/ruoyi/project/system/notice/mapper/NoticeMapper.java index 828209d95..9b676c55b 100644 --- a/src/main/java/com/ruoyi/project/system/notice/mapper/NoticeMapper.java +++ b/src/main/java/com/ruoyi/project/system/notice/mapper/NoticeMapper.java @@ -16,7 +16,7 @@ public interface NoticeMapper * @param noticeId 公告ID * @return 公告信息 */ - public Notice selectNoticeById(Integer noticeId); + public Notice selectNoticeById(Long noticeId); /** * 查询公告列表 diff --git a/src/main/java/com/ruoyi/project/system/notice/service/INoticeService.java b/src/main/java/com/ruoyi/project/system/notice/service/INoticeService.java index 5c279e0c1..bd6f3f883 100644 --- a/src/main/java/com/ruoyi/project/system/notice/service/INoticeService.java +++ b/src/main/java/com/ruoyi/project/system/notice/service/INoticeService.java @@ -16,7 +16,7 @@ public interface INoticeService * @param noticeId 公告ID * @return 公告信息 */ - public Notice selectNoticeById(Integer noticeId); + public Notice selectNoticeById(Long noticeId); /** * 查询公告列表 @@ -42,14 +42,6 @@ public interface INoticeService */ public int updateNotice(Notice notice); - /** - * 保存公告 - * - * @param notice 公告信息 - * @return 结果 - */ - public int saveNotice(Notice notice); - /** * 删除公告信息 * diff --git a/src/main/java/com/ruoyi/project/system/notice/service/NoticeServiceImpl.java b/src/main/java/com/ruoyi/project/system/notice/service/NoticeServiceImpl.java index 541636dc5..25ade1390 100644 --- a/src/main/java/com/ruoyi/project/system/notice/service/NoticeServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/notice/service/NoticeServiceImpl.java @@ -3,7 +3,6 @@ package com.ruoyi.project.system.notice.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.security.ShiroUtils; import com.ruoyi.project.system.notice.mapper.NoticeMapper; import com.ruoyi.project.system.notice.domain.Notice; @@ -29,7 +28,7 @@ public class NoticeServiceImpl implements INoticeService * @return 公告信息 */ @Override - public Notice selectNoticeById(Integer noticeId) + public Notice selectNoticeById(Long noticeId) { return noticeMapper.selectNoticeById(noticeId); } @@ -55,6 +54,7 @@ public class NoticeServiceImpl implements INoticeService @Override public int insertNotice(Notice notice) { + notice.setCreateBy(ShiroUtils.getLoginName()); return noticeMapper.insertNotice(notice); } @@ -67,35 +67,10 @@ public class NoticeServiceImpl implements INoticeService @Override public int updateNotice(Notice notice) { + notice.setUpdateBy(ShiroUtils.getLoginName()); return noticeMapper.updateNotice(notice); } - /** - * 保存公告 - * - * @param notice 公告信息 - * @return 结果 - */ - @Override - public int saveNotice(Notice notice) - { - Integer noticeId = notice.getNoticeId(); - int rows = 0; - if (StringUtils.isNotNull(noticeId)) - { - notice.setUpdateBy(ShiroUtils.getLoginName()); - // 修改公告 - rows = noticeMapper.updateNotice(notice); - } - else - { - notice.setCreateBy(ShiroUtils.getLoginName()); - // 新增公告 - rows = noticeMapper.insertNotice(notice); - } - return rows; - } - /** * 删除公告对象 * diff --git a/src/main/java/com/ruoyi/project/system/post/controller/PostController.java b/src/main/java/com/ruoyi/project/system/post/controller/PostController.java index ac526971c..5dde51d90 100644 --- a/src/main/java/com/ruoyi/project/system/post/controller/PostController.java +++ b/src/main/java/com/ruoyi/project/system/post/controller/PostController.java @@ -4,7 +4,7 @@ import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -75,8 +75,7 @@ public class PostController extends BaseController { try { - postService.deletePostByIds(ids); - return success(); + return toAjax(postService.deletePostByIds(ids)); } catch (Exception e) { @@ -87,41 +86,44 @@ public class PostController extends BaseController /** * 新增岗位 */ - @Log(title = "岗位管理", action = BusinessType.INSERT) - @RequiresPermissions("system:post:add") @GetMapping("/add") - public String add(Model model) + public String add() { return prefix + "/add"; } + /** + * 新增保存岗位 + */ + @RequiresPermissions("system:post:add") + @Log(title = "岗位管理", action = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(Post post) + { + return toAjax(postService.insertPost(post)); + } + /** * 修改岗位 */ - @Log(title = "岗位管理", action = BusinessType.UPDATE) - @RequiresPermissions("system:post:edit") @GetMapping("/edit/{postId}") - public String edit(@PathVariable("postId") Long postId, Model model) + public String edit(@PathVariable("postId") Long postId, ModelMap mmap) { - Post post = postService.selectPostById(postId); - model.addAttribute("post", post); + mmap.put("post", postService.selectPostById(postId)); return prefix + "/edit"; } /** - * 保存岗位 + * 修改保存岗位 */ - @Log(title = "岗位管理", action = BusinessType.SAVE) - @RequiresPermissions("system:post:save") - @PostMapping("/save") + @RequiresPermissions("system:post:edit") + @Log(title = "岗位管理", action = BusinessType.UPDATE) + @PostMapping("/edit") @ResponseBody - public AjaxResult save(Post post) + public AjaxResult editSave(Post post) { - if (postService.savePost(post) > 0) - { - return success(); - } - return error(); + return toAjax(postService.updatePost(post)); } } diff --git a/src/main/java/com/ruoyi/project/system/post/mapper/PostMapper.java b/src/main/java/com/ruoyi/project/system/post/mapper/PostMapper.java index 8d4f00759..ffeeb865d 100644 --- a/src/main/java/com/ruoyi/project/system/post/mapper/PostMapper.java +++ b/src/main/java/com/ruoyi/project/system/post/mapper/PostMapper.java @@ -42,14 +42,6 @@ public interface PostMapper */ public Post selectPostById(Long postId); - /** - * 通过岗位ID删除岗位信息 - * - * @param postId 岗位ID - * @return 结果 - */ - public int deletePostById(Long postId); - /** * 批量删除岗位信息 * diff --git a/src/main/java/com/ruoyi/project/system/post/service/IPostService.java b/src/main/java/com/ruoyi/project/system/post/service/IPostService.java index a559b14ff..c10912352 100644 --- a/src/main/java/com/ruoyi/project/system/post/service/IPostService.java +++ b/src/main/java/com/ruoyi/project/system/post/service/IPostService.java @@ -41,29 +41,29 @@ public interface IPostService */ public Post selectPostById(Long postId); - /** - * 通过岗位ID删除岗位信息 - * - * @param postId 岗位ID - * @return 结果 - */ - public boolean deletePostById(Long postId); - /** * 批量删除岗位信息 * * @param ids 需要删除的数据ID */ - public void deletePostByIds(String ids) throws Exception; + public int deletePostByIds(String ids) throws Exception; /** - * 保存岗位信息 + * 新增保存岗位信息 * * @param post 岗位信息 * @return 结果 */ - public int savePost(Post post); - + public int insertPost(Post post); + + /** + * 修改保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public int updatePost(Post post); + /** * 通过岗位ID查询岗位使用数量 * diff --git a/src/main/java/com/ruoyi/project/system/post/service/PostServiceImpl.java b/src/main/java/com/ruoyi/project/system/post/service/PostServiceImpl.java index 79ddfe89f..70cf47770 100644 --- a/src/main/java/com/ruoyi/project/system/post/service/PostServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/post/service/PostServiceImpl.java @@ -3,9 +3,7 @@ package com.ruoyi.project.system.post.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - import com.ruoyi.common.support.Convert; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.security.ShiroUtils; import com.ruoyi.project.system.post.domain.Post; import com.ruoyi.project.system.post.mapper.PostMapper; @@ -16,7 +14,7 @@ import com.ruoyi.project.system.user.mapper.UserPostMapper; * * @author ruoyi */ -@Service("postService") +@Service public class PostServiceImpl implements IPostService { @Autowired @@ -85,18 +83,6 @@ public class PostServiceImpl implements IPostService return postMapper.selectPostById(postId); } - /** - * 通过岗位ID删除岗位信息 - * - * @param postId 岗位ID - * @return 结果 - */ - @Override - public boolean deletePostById(Long postId) - { - return postMapper.deletePostById(postId) > 0 ? true : false; - } - /** * 批量删除岗位信息 * @@ -104,7 +90,7 @@ public class PostServiceImpl implements IPostService * @throws Exception */ @Override - public void deletePostByIds(String ids) throws Exception + public int deletePostByIds(String ids) throws Exception { Long[] postIds = Convert.toLongArray(ids); for (Long postId : postIds) @@ -115,33 +101,33 @@ public class PostServiceImpl implements IPostService throw new Exception(String.format("%1$s已分配,不能删除", post.getPostName())); } } - postMapper.deletePostByIds(postIds); + return postMapper.deletePostByIds(postIds); } /** - * 保存岗位信息 + * 新增保存岗位信息 * * @param post 岗位信息 * @return 结果 */ @Override - public int savePost(Post post) + public int insertPost(Post post) { - Long postId = post.getPostId(); - int count = 0; - if (StringUtils.isNotNull(postId)) - { - post.setUpdateBy(ShiroUtils.getLoginName()); - // 修改岗位信息 - count = postMapper.updatePost(post); - } - else - { - post.setCreateBy(ShiroUtils.getLoginName()); - // 新增岗位信息 - count = postMapper.insertPost(post); - } - return count; + post.setCreateBy(ShiroUtils.getLoginName()); + return postMapper.insertPost(post); + } + + /** + * 修改保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + @Override + public int updatePost(Post post) + { + post.setUpdateBy(ShiroUtils.getLoginName()); + return postMapper.updatePost(post); } /** diff --git a/src/main/java/com/ruoyi/project/system/role/controller/RoleController.java b/src/main/java/com/ruoyi/project/system/role/controller/RoleController.java index 9de710078..a05fbb45f 100644 --- a/src/main/java/com/ruoyi/project/system/role/controller/RoleController.java +++ b/src/main/java/com/ruoyi/project/system/role/controller/RoleController.java @@ -5,7 +5,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; -import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -72,42 +72,47 @@ public class RoleController extends BaseController /** * 新增角色 */ - @RequiresPermissions("system:role:add") - @Log(title = "角色管理", action = BusinessType.INSERT) @GetMapping("/add") - public String add(Model model) + public String add() { return prefix + "/add"; } + /** + * 新增保存角色 + */ + @RequiresPermissions("system:role:add") + @Log(title = "角色管理", action = BusinessType.INSERT) + @PostMapping("/add") + @Transactional(rollbackFor = Exception.class) + @ResponseBody + public AjaxResult addSave(Role role) + { + return toAjax(roleService.insertRole(role)); + + } + /** * 修改角色 */ - @RequiresPermissions("system:role:edit") - @Log(title = "角色管理", action = BusinessType.UPDATE) @GetMapping("/edit/{roleId}") - public String edit(@PathVariable("roleId") Long roleId, Model model) + public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap) { - Role role = roleService.selectRoleById(roleId); - model.addAttribute("role", role); + mmap.put("role", roleService.selectRoleById(roleId)); return prefix + "/edit"; } /** - * 保存角色 + * 修改保存角色 */ - @RequiresPermissions("system:role:save") - @Log(title = "角色管理", action = BusinessType.SAVE) - @PostMapping("/save") + @RequiresPermissions("system:role:edit") + @Log(title = "角色管理", action = BusinessType.UPDATE) + @PostMapping("/edit") @Transactional(rollbackFor = Exception.class) @ResponseBody - public AjaxResult save(Role role) + public AjaxResult editSave(Role role) { - if (roleService.saveRole(role) > 0) - { - return success(); - } - return error(); + return toAjax(roleService.updateRole(role)); } @RequiresPermissions("system:role:remove") @@ -118,8 +123,7 @@ public class RoleController extends BaseController { try { - roleService.deleteRoleByIds(ids); - return success(); + return toAjax(roleService.deleteRoleByIds(ids)); } catch (Exception e) { diff --git a/src/main/java/com/ruoyi/project/system/role/service/IRoleService.java b/src/main/java/com/ruoyi/project/system/role/service/IRoleService.java index e2247263b..7eb182740 100644 --- a/src/main/java/com/ruoyi/project/system/role/service/IRoleService.java +++ b/src/main/java/com/ruoyi/project/system/role/service/IRoleService.java @@ -64,16 +64,24 @@ public interface IRoleService * * @param ids 需要删除的数据ID */ - public void deleteRoleByIds(String ids) throws Exception; + public int deleteRoleByIds(String ids) throws Exception; /** - * 保存角色信息 + * 新增保存角色信息 * * @param role 角色信息 * @return 结果 */ - public int saveRole(Role role); - + public int insertRole(Role role); + + /** + * 修改保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int updateRole(Role role); + /** * 校验角色名称是否唯一 * @@ -81,7 +89,7 @@ public interface IRoleService * @return 结果 */ public String checkRoleNameUnique(Role role); - + /** * 通过角色ID查询角色使用数量 * diff --git a/src/main/java/com/ruoyi/project/system/role/service/RoleServiceImpl.java b/src/main/java/com/ruoyi/project/system/role/service/RoleServiceImpl.java index d9be9d51f..e582c7f43 100644 --- a/src/main/java/com/ruoyi/project/system/role/service/RoleServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/role/service/RoleServiceImpl.java @@ -22,7 +22,7 @@ import com.ruoyi.project.system.user.mapper.UserRoleMapper; * * @author ruoyi */ -@Service("roleService") +@Service public class RoleServiceImpl implements IRoleService { @@ -135,7 +135,7 @@ public class RoleServiceImpl implements IRoleService * @throws Exception */ @Override - public void deleteRoleByIds(String ids) throws Exception + public int deleteRoleByIds(String ids) throws Exception { Long[] roleIds = Convert.toLongArray(ids); for (Long roleId : roleIds) @@ -146,33 +146,39 @@ public class RoleServiceImpl implements IRoleService throw new Exception(String.format("%1$s已分配,不能删除", role.getRoleName())); } } - roleMapper.deleteRoleByIds(roleIds); + return roleMapper.deleteRoleByIds(roleIds); } /** - * 保存角色信息 + * 新增保存角色信息 * * @param role 角色信息 * @return 结果 */ @Override - public int saveRole(Role role) + public int insertRole(Role role) { - Long roleId = role.getRoleId(); - if (StringUtils.isNotNull(roleId)) - { - role.setUpdateBy(ShiroUtils.getLoginName()); - // 修改角色信息 - roleMapper.updateRole(role); - // 删除角色与菜单关联 - roleMenuMapper.deleteRoleMenuByRoleId(roleId); - } - else - { - role.setCreateBy(ShiroUtils.getLoginName()); - // 新增角色信息 - roleMapper.insertRole(role); - } + role.setCreateBy(ShiroUtils.getLoginName()); + // 新增角色信息 + roleMapper.insertRole(role); + ShiroUtils.clearCachedAuthorizationInfo(); + return insertRoleMenu(role); + } + + /** + * 修改保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + public int updateRole(Role role) + { + role.setUpdateBy(ShiroUtils.getLoginName()); + // 修改角色信息 + roleMapper.updateRole(role); + // 删除角色与菜单关联 + roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId()); ShiroUtils.clearCachedAuthorizationInfo(); return insertRoleMenu(role); } @@ -210,13 +216,9 @@ public class RoleServiceImpl implements IRoleService @Override public String checkRoleNameUnique(Role role) { - if (role.getRoleId() == null) - { - role.setRoleId(-1L); - } - Long roleId = role.getRoleId(); + Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); Role info = roleMapper.checkRoleNameUnique(role.getRoleName()); - if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getRoleId()) && info.getRoleId() != roleId) + if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) { return UserConstants.ROLE_NAME_NOT_UNIQUE; } diff --git a/src/main/java/com/ruoyi/project/system/user/controller/IndexController.java b/src/main/java/com/ruoyi/project/system/user/controller/IndexController.java index 458c9110d..a6fd97247 100644 --- a/src/main/java/com/ruoyi/project/system/user/controller/IndexController.java +++ b/src/main/java/com/ruoyi/project/system/user/controller/IndexController.java @@ -3,7 +3,7 @@ package com.ruoyi.project.system.user.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import com.ruoyi.framework.config.RuoYiConfig; import com.ruoyi.framework.web.controller.BaseController; @@ -27,23 +27,23 @@ public class IndexController extends BaseController // 系统首页 @GetMapping("/index") - public String index(Model model) + public String index(ModelMap mmap) { // 取身份信息 User user = getUser(); // 根据用户id取出菜单 List menus = menuService.selectMenusByUserId(user.getUserId()); - model.addAttribute("menus", menus); - model.addAttribute("user", user); - model.addAttribute("copyrightYear", ruoYiConfig.getCopyrightYear()); + mmap.put("menus", menus); + mmap.put("user", user); + mmap.put("copyrightYear", ruoYiConfig.getCopyrightYear()); return "index"; } // 系统介绍 @GetMapping("/system/main") - public String main(Model model) + public String main(ModelMap mmap) { - model.addAttribute("version", ruoYiConfig.getVersion()); + mmap.put("version", ruoYiConfig.getVersion()); return "main"; } diff --git a/src/main/java/com/ruoyi/project/system/user/controller/LoginController.java b/src/main/java/com/ruoyi/project/system/user/controller/LoginController.java index 8b338cf75..0eabb72c5 100644 --- a/src/main/java/com/ruoyi/project/system/user/controller/LoginController.java +++ b/src/main/java/com/ruoyi/project/system/user/controller/LoginController.java @@ -7,7 +7,6 @@ import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.subject.Subject; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -26,7 +25,7 @@ public class LoginController extends BaseController { @GetMapping("/login") - public String login(HttpServletRequest request, HttpServletResponse response, Model model) + public String login(HttpServletRequest request, HttpServletResponse response) { // 如果是Ajax请求,返回Json字符串。 if (ServletUtils.isAjaxRequest((HttpServletRequest) request)) diff --git a/src/main/java/com/ruoyi/project/system/user/controller/ProfileController.java b/src/main/java/com/ruoyi/project/system/user/controller/ProfileController.java index 498990fcc..3cd5c33fc 100644 --- a/src/main/java/com/ruoyi/project/system/user/controller/ProfileController.java +++ b/src/main/java/com/ruoyi/project/system/user/controller/ProfileController.java @@ -5,7 +5,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -18,6 +18,7 @@ import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.constant.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; +import com.ruoyi.framework.web.service.DictService; import com.ruoyi.project.system.user.domain.User; import com.ruoyi.project.system.user.service.IUserService; @@ -37,27 +38,20 @@ public class ProfileController extends BaseController @Autowired private IUserService userService; + @Autowired + private DictService dict; + /** * 个人信息 */ @GetMapping() - public String profile(Model model) + public String profile(ModelMap mmap) { User user = getUser(); - String sex = user.getSex(); - if ("0".equals(sex)) - { - user.setSex("性别:男"); - } - else if ("1".equals(sex)) - { - user.setSex("性别:女"); - } - String roleGroup = userService.selectUserRoleGroup(user.getUserId()); - String postGroup = userService.selectUserPostGroup(user.getUserId()); - model.addAttribute("user", user); - model.addAttribute("roleGroup", roleGroup); - model.addAttribute("postGroup", postGroup); + user.setSex(dict.getLabel("sys_user_sex", user.getSex())); + mmap.put("user", user); + mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId())); + mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId())); return prefix + "/profile"; } @@ -75,10 +69,9 @@ public class ProfileController extends BaseController } @GetMapping("/resetPwd/{userId}") - public String resetPwd(@PathVariable("userId") Long userId, Model model) + public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap) { - User user = userService.selectUserById(userId); - model.addAttribute("user", user); + mmap.put("user", userService.selectUserById(userId)); return prefix + "/resetPwd"; } @@ -99,36 +92,32 @@ public class ProfileController extends BaseController /** * 修改用户 */ - @Log(title = "个人信息", action = BusinessType.UPDATE) @GetMapping("/edit/{userId}") - public String edit(@PathVariable("userId") Long userId, Model model) + public String edit(@PathVariable("userId") Long userId, ModelMap mmap) { - User user = userService.selectUserById(userId); - model.addAttribute("user", user); + mmap.put("user", userService.selectUserById(userId)); return prefix + "/edit"; } /** * 修改头像 */ - @Log(title = "个人信息", action = BusinessType.UPDATE) @GetMapping("/avatar/{userId}") - public String avatar(@PathVariable("userId") Long userId, Model model) + public String avatar(@PathVariable("userId") Long userId, ModelMap mmap) { - User user = userService.selectUserById(userId); - model.addAttribute("user", user); + mmap.put("user", userService.selectUserById(userId)); return prefix + "/avatar"; } /** * 修改用户 */ - @Log(title = "个人信息", action = BusinessType.SAVE) + @Log(title = "个人信息", action = BusinessType.UPDATE) @PostMapping("/update") @ResponseBody public AjaxResult update(User user) { - if (userService.updateUser(user) > 0) + if (userService.updateUserInfo(user) > 0) { setUser(userService.selectUserById(user.getUserId())); return success(); @@ -139,7 +128,7 @@ public class ProfileController extends BaseController /** * 保存头像 */ - @Log(title = "个人信息", action = BusinessType.SAVE) + @Log(title = "个人信息", action = BusinessType.UPDATE) @PostMapping("/updateAvatar") @ResponseBody public AjaxResult updateAvatar(User user, @RequestParam("avatarfile") MultipartFile file) @@ -150,7 +139,7 @@ public class ProfileController extends BaseController { String avatar = FileUploadUtils.upload(file); user.setAvatar(avatar); - if (userService.updateUser(user) > 0) + if (userService.updateUserInfo(user) > 0) { setUser(userService.selectUserById(user.getUserId())); return success(); diff --git a/src/main/java/com/ruoyi/project/system/user/controller/UserController.java b/src/main/java/com/ruoyi/project/system/user/controller/UserController.java index e7d84ae5a..cb0693a13 100644 --- a/src/main/java/com/ruoyi/project/system/user/controller/UserController.java +++ b/src/main/java/com/ruoyi/project/system/user/controller/UserController.java @@ -1,5 +1,16 @@ package com.ruoyi.project.system.user.controller; +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; @@ -7,19 +18,10 @@ import com.ruoyi.framework.aspectj.lang.constant.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; -import com.ruoyi.project.system.post.domain.Post; import com.ruoyi.project.system.post.service.IPostService; -import com.ruoyi.project.system.role.domain.Role; import com.ruoyi.project.system.role.service.IRoleService; import com.ruoyi.project.system.user.domain.User; import com.ruoyi.project.system.user.service.IUserService; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.*; -import java.util.List; /** * 用户信息 @@ -75,60 +77,79 @@ public class UserController extends BaseController } } + /** + * 新增用户 + */ + @GetMapping("/add") + public String add(ModelMap mmap) + { + mmap.put("roles", roleService.selectRoleAll()); + mmap.put("posts", postService.selectPostAll()); + return prefix + "/add"; + } + + /** + * 新增保存用户 + */ + @RequiresPermissions("system:user:add") + @Log(title = "用户管理", action = BusinessType.INSERT) + @PostMapping("/add") + @Transactional(rollbackFor = Exception.class) + @ResponseBody + public AjaxResult addSave(User user) + { + if (StringUtils.isNotNull(user.getUserId()) && User.isAdmin(user.getUserId())) + { + return error("不允许修改超级管理员用户"); + } + return toAjax(userService.insertUser(user)); + } + /** * 修改用户 */ - @RequiresPermissions("system:user:edit") - @Log(title = "用户管理", action = BusinessType.UPDATE) @GetMapping("/edit/{userId}") - public String edit(@PathVariable("userId") Long userId, Model model) + public String edit(@PathVariable("userId") Long userId, ModelMap mmap) { - User user = userService.selectUserById(userId); - List roles = roleService.selectRolesByUserId(userId); - List posts = postService.selectPostsByUserId(userId); - model.addAttribute("roles", roles); - model.addAttribute("posts", posts); - model.addAttribute("user", user); + mmap.put("user", userService.selectUserById(userId)); + mmap.put("roles", roleService.selectRolesByUserId(userId)); + mmap.put("posts", postService.selectPostsByUserId(userId)); return prefix + "/edit"; } /** - * 新增用户 + * 修改保存用户 */ - @RequiresPermissions("system:user:add") - @Log(title = "用户管理", action = BusinessType.INSERT) - @GetMapping("/add") - public String add(Model model) + @RequiresPermissions("system:user:edit") + @Log(title = "用户管理", action = BusinessType.UPDATE) + @PostMapping("/edit") + @Transactional(rollbackFor = Exception.class) + @ResponseBody + public AjaxResult editSave(User user) { - List roles = roleService.selectRoleAll(); - List posts = postService.selectPostAll(); - model.addAttribute("roles", roles); - model.addAttribute("posts", posts); - return prefix + "/add"; + if (StringUtils.isNotNull(user.getUserId()) && User.isAdmin(user.getUserId())) + { + return error("不允许修改超级管理员用户"); + } + return toAjax(userService.updateUser(user)); } @RequiresPermissions("system:user:resetPwd") @Log(title = "重置密码", action = BusinessType.UPDATE) @GetMapping("/resetPwd/{userId}") - public String resetPwd(@PathVariable("userId") Long userId, Model model) + public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap) { - User user = userService.selectUserById(userId); - model.addAttribute("user", user); + mmap.put("user", userService.selectUserById(userId)); return prefix + "/resetPwd"; } @RequiresPermissions("system:user:resetPwd") - @Log(title = "重置密码", action = BusinessType.SAVE) + @Log(title = "重置密码", action = BusinessType.UPDATE) @PostMapping("/resetPwd") @ResponseBody public AjaxResult resetPwd(User user) { - int rows = userService.resetUserPwd(user); - if (rows > 0) - { - return success(); - } - return error(); + return toAjax(userService.resetUserPwd(user)); } @RequiresPermissions("system:user:remove") @@ -139,8 +160,7 @@ public class UserController extends BaseController { try { - userService.deleteUserByIds(ids); - return success(); + return toAjax(userService.deleteUserByIds(ids)); } catch (Exception e) { @@ -148,23 +168,6 @@ public class UserController extends BaseController } } - /** - * 保存用户 - */ - @RequiresPermissions("system:user:save") - @Log(title = "用户管理", action = BusinessType.SAVE) - @PostMapping("/save") - @Transactional(rollbackFor = Exception.class) - @ResponseBody - public AjaxResult save(User user) - { - if (StringUtils.isNotNull(user.getUserId()) && User.isAdmin(user.getUserId())) - { - return error("不允许修改超级管理员用户"); - } - return userService.saveUser(user) > 0 ? success() : error(); - } - /** * 校验用户名 */ diff --git a/src/main/java/com/ruoyi/project/system/user/service/IUserService.java b/src/main/java/com/ruoyi/project/system/user/service/IUserService.java index b59d7e306..d602a1b6f 100644 --- a/src/main/java/com/ruoyi/project/system/user/service/IUserService.java +++ b/src/main/java/com/ruoyi/project/system/user/service/IUserService.java @@ -64,7 +64,7 @@ public interface IUserService * * @param ids 需要删除的数据ID */ - public void deleteUserByIds(String ids) throws Exception; + public int deleteUserByIds(String ids) throws Exception; /** * 保存用户信息 @@ -72,16 +72,24 @@ public interface IUserService * @param user 用户信息 * @return 结果 */ - public int saveUser(User user); + public int insertUser(User user); /** - * 修改用户信息 + * 保存用户信息 * * @param user 用户信息 * @return 结果 */ public int updateUser(User user); + /** + * 修改用户详细信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUserInfo(User user); + /** * 修改用户密码信息 * diff --git a/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java b/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java index 3c51c58ac..ee11ccd0e 100644 --- a/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java @@ -25,7 +25,7 @@ import com.ruoyi.project.system.user.mapper.UserRoleMapper; * * @author ruoyi */ -@Service("userService") +@Service public class UserServiceImpl implements IUserService { @Autowired @@ -130,7 +130,7 @@ public class UserServiceImpl implements IUserService * @return 结果 */ @Override - public void deleteUserByIds(String ids) throws Exception + public int deleteUserByIds(String ids) throws Exception { Long[] userIds = Convert.toLongArray(ids); for (Long userId : userIds) @@ -140,58 +140,60 @@ public class UserServiceImpl implements IUserService throw new Exception("不允许删除超级管理员用户"); } } - userMapper.deleteUserByIds(userIds); + return userMapper.deleteUserByIds(userIds); } /** - * 保存用户信息 + * 新增保存用户信息 * * @param user 用户信息 * @return 结果 */ @Override - public int saveUser(User user) + public int insertUser(User user) { - int count = 0; - Long userId = user.getUserId(); - if (StringUtils.isNotNull(userId)) - { - user.setUpdateBy(ShiroUtils.getLoginName()); - // 修改用户信息 - count = updateUser(user); - // 删除用户与角色关联 - userRoleMapper.deleteUserRoleByUserId(userId); - // 新增用户与角色管理 - insertUserRole(user); - // 删除用户与岗位关联 - userPostMapper.deleteUserPostByUserId(userId); - // 新增用户与岗位管理 - insertUserPost(user); - - } - else - { - user.randomSalt(); - user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); - user.setCreateBy(ShiroUtils.getLoginName()); - // 新增用户信息 - count = userMapper.insertUser(user); - // 新增用户岗位关联 - insertUserPost(user); - // 新增用户与角色管理 - insertUserRole(user); - } - return count; + user.randomSalt(); + user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); + user.setCreateBy(ShiroUtils.getLoginName()); + // 新增用户信息 + int rows = userMapper.insertUser(user); + // 新增用户岗位关联 + insertUserPost(user); + // 新增用户与角色管理 + insertUserRole(user); + return rows; } /** - * 修改用户信息 + * 修改保存用户信息 * * @param user 用户信息 * @return 结果 */ @Override public int updateUser(User user) + { + Long userId = user.getUserId(); + user.setUpdateBy(ShiroUtils.getLoginName()); + // 删除用户与角色关联 + userRoleMapper.deleteUserRoleByUserId(userId); + // 新增用户与角色管理 + insertUserRole(user); + // 删除用户与岗位关联 + userPostMapper.deleteUserPostByUserId(userId); + // 新增用户与岗位管理 + insertUserPost(user); + return userMapper.updateUser(user); + } + + /** + * 修改用户个人详细信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public int updateUserInfo(User user) { return userMapper.updateUser(user); } @@ -280,14 +282,9 @@ public class UserServiceImpl implements IUserService @Override public String checkPhoneUnique(User user) { - if (user.getUserId() == null) - { - user.setUserId(-1L); - } - Long userId = user.getUserId(); + Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); User info = userMapper.checkPhoneUnique(user.getPhonenumber()); - if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getUserId()) - && info.getUserId().longValue() != userId.longValue()) + if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) { return UserConstants.USER_PHONE_NOT_UNIQUE; } @@ -303,14 +300,9 @@ public class UserServiceImpl implements IUserService @Override public String checkEmailUnique(User user) { - if (user.getUserId() == null) - { - user.setUserId(-1L); - } - Long userId = user.getUserId(); + Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); User info = userMapper.checkEmailUnique(user.getEmail()); - if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getUserId()) - && info.getUserId().longValue() != userId.longValue()) + if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) { return UserConstants.USER_EMAIL_NOT_UNIQUE; } diff --git a/src/main/java/com/ruoyi/project/tool/gen/service/GenServiceImpl.java b/src/main/java/com/ruoyi/project/tool/gen/service/GenServiceImpl.java index 749c09a7b..c4fb994a4 100644 --- a/src/main/java/com/ruoyi/project/tool/gen/service/GenServiceImpl.java +++ b/src/main/java/com/ruoyi/project/tool/gen/service/GenServiceImpl.java @@ -28,7 +28,7 @@ import com.ruoyi.project.tool.gen.util.VelocityInitializer; * * @author ruoyi */ -@Service("genService") +@Service public class GenServiceImpl implements IGenService { @Autowired diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index a6d369b4e..7789d4005 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,7 +1,7 @@ # 项目名称、版本、版权年份 ruoyi: name: RuoYi - version: 2.1.0 + version: 2.2.0 copyrightYear: 2018 profile: D:/profile/ diff --git a/src/main/resources/mybatis/system/ConfigMapper.xml b/src/main/resources/mybatis/system/ConfigMapper.xml index 43cdc3674..e042f8dfa 100644 --- a/src/main/resources/mybatis/system/ConfigMapper.xml +++ b/src/main/resources/mybatis/system/ConfigMapper.xml @@ -20,14 +20,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark from sys_config - + + + + + and config_id = #{configId} + + + and config_key = #{configKey} + + + - - where config_key = #{configKey} + + + insert into sys_config ( config_name, @@ -85,10 +97,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where config_id = #{configId} - - delete from sys_config where config_id = #{value} - - delete from sys_config where config_id in diff --git a/src/main/resources/mybatis/system/DictDataMapper.xml b/src/main/resources/mybatis/system/DictDataMapper.xml index 69699d919..d55e37958 100644 --- a/src/main/resources/mybatis/system/DictDataMapper.xml +++ b/src/main/resources/mybatis/system/DictDataMapper.xml @@ -11,7 +11,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + @@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, is_default, status, create_by, create_time, remark from sys_dict_data + select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark from sys_dict_data + + + diff --git a/src/main/resources/mybatis/system/PostMapper.xml b/src/main/resources/mybatis/system/PostMapper.xml index 1de280b65..49ada3110 100644 --- a/src/main/resources/mybatis/system/PostMapper.xml +++ b/src/main/resources/mybatis/system/PostMapper.xml @@ -53,10 +53,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where post_id = #{postId} - - delete from sys_post where post_id = #{postId} - - delete from sys_post where post_id in diff --git a/src/main/resources/static/ruoyi/index.js b/src/main/resources/static/ruoyi/index.js index 8390a6749..fb5501c4b 100644 --- a/src/main/resources/static/ruoyi/index.js +++ b/src/main/resources/static/ruoyi/index.js @@ -187,7 +187,6 @@ $(function() { }); function menuItem() { - $.modal.loading("数据加载中,请稍后..."); // 获取标识数据 var dataUrl = $(this).attr('href'), dataIndex = $(this).data('index'), @@ -221,12 +220,17 @@ $(function() { // 添加选项卡对应的iframe var str1 = ''; $('.mainContent').find('iframe.RuoYi_iframe').hide().parents('.mainContent').append(str1); - + + $.modal.loading("数据加载中,请稍后..."); + + $('.mainContent iframe:visible').load(function () { + $.modal.closeLoading(); + }); + // 添加选项卡 $('.menuTabs .page-tabs-content').append(str); scrollToTab($('.menuTab.active')); } - $.modal.closeLoading(); return false; } diff --git a/src/main/resources/static/ruoyi/js/ry-ui.js b/src/main/resources/static/ruoyi/js/ry-ui.js index be7a8f69f..ee09a59f7 100644 --- a/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/src/main/resources/static/ruoyi/js/ry-ui.js @@ -95,6 +95,17 @@ return $.map($('#bootstrap-table').bootstrapTable('getSelections'), function (row) { return row[$.table._option.columns[1].field]; }); + }, + // 回显数据字典 + selectDictLabel: function(_datas, _value) { + var actions = []; + $.each(_datas, function(index, dict) { + if (dict.dictValue == _value) { + actions.push("" + dict.dictLabel + ""); + return false; + } + }); + return actions.join(''); } }, // 表格树封装处理 diff --git a/src/main/resources/static/ruoyi/js/ry-ui.min.js b/src/main/resources/static/ruoyi/js/ry-ui.min.js index 3b56a0b5a..f15978b11 100644 --- a/src/main/resources/static/ruoyi/js/ry-ui.min.js +++ b/src/main/resources/static/ruoyi/js/ry-ui.min.js @@ -1,5 +1,460 @@ -/*! - * ruoyi.js - * Author: Ruoyi +/** + * 通用方法封装处理 + * Copyright (c) 2018 ruoyi */ -(function($){$.extend({table:{_option:{},_params:{},init:function(options){$.table._option=options;$.table._params=$.common.isEmpty(options.queryParams)?$.table.queryParams:options.queryParams;_sortOrder=$.common.isEmpty(options.sortOrder)?"asc":options.sortOrder;_sortName=$.common.isEmpty(options.sortName)?"":options.sortName;$("#bootstrap-table").bootstrapTable({url:options.url,contentType:"application/x-www-form-urlencoded",method:"post",cache:false,sortable:true,sortStable:true,sortName:_sortName,sortOrder:_sortOrder,pagination:true,pageNumber:1,pageSize:10,pageList:[10,25,50],iconSize:"outline",toolbar:"#toolbar",sidePagination:"server",search:$.common.visible(options.search),showRefresh:$.common.visible(options.showRefresh),showColumns:$.common.visible(options.showColumns),showToggle:$.common.visible(options.showToggle),showExport:$.common.visible(options.showExport),queryParams:$.table._params,columns:options.columns})},queryParams:function(params){return{pageSize:params.limit,pageNum:params.offset/params.limit+1,searchValue:params.search,orderByColumn:params.sort,isAsc:params.order}},search:function(form){var params=$("#bootstrap-table").bootstrapTable("getOptions");params.queryParams=function(params){var search={};$.each($("#"+form).serializeArray(),function(i,field){search[field.name]=field.value});search.pageSize=params.limit;search.pageNum=params.offset/params.limit+1;search.searchValue=params.search;search.orderByColumn=params.sort;search.isAsc=params.order;return search};$("#bootstrap-table").bootstrapTable("refresh",params)},exportExcel:function(form){$.post($.table._option.exportUrl,$("#"+form).serializeArray(),function(result){if(result.code==web_status.SUCCESS){window.location.href=ctx+"common/download?fileName="+result.msg+"&delete="+true}else{$.modal.alertError(result.msg)}})},refresh:function(){$("#bootstrap-table").bootstrapTable("refresh",{url:$.table._option.url,silent:true})},selectColumns:function(column){return $.map($("#bootstrap-table").bootstrapTable("getSelections"),function(row){return row[column]})},selectFirstColumns:function(){return $.map($("#bootstrap-table").bootstrapTable("getSelections"),function(row){return row[$.table._option.columns[1].field]})}},treeTable:{_option:{},_treeTable:{},init:function(options){$.table._option=options;var treeTable=$("#bootstrap-table").bootstrapTreeTable({code:options.id,parentCode:options.parentId,type:"get",url:options.url,ajaxParams:{},expandColumn:"0",striped:false,bordered:true,expandAll:$.common.visible(options.expandAll),columns:options.columns});$.treeTable._treeTable=treeTable},search:function(form){var params={};$.each($("#"+form).serializeArray(),function(i,field){params[field.name]=field.value});$.treeTable._treeTable.bootstrapTreeTable("refresh",params)},refresh:function(){$.treeTable._treeTable.bootstrapTreeTable("refresh")},},form:{selectCheckeds:function(name){var checkeds="";$('input:checkbox[name="'+name+'"]:checked').each(function(i){if(0==i){checkeds=$(this).val()}else{checkeds+=(","+$(this).val())}});return checkeds},selectSelects:function(name){var selects="";$("#"+name+" option:selected").each(function(i){if(0==i){selects=$(this).val()}else{selects+=(","+$(this).val())}});return selects}},modal:{icon:function(type){var icon="";if(type==modal_status.WARNING){icon=0}else{if(type==modal_status.SUCCESS){icon=1}else{if(type==modal_status.FAIL){icon=2}else{icon=3}}}return icon},msg:function(content,type){if(type!=undefined){layer.msg(content,{icon:$.modal.icon(type),time:1000,shift:5})}else{layer.msg(content)}},msgError:function(content){$.modal.msg(content,modal_status.FAIL)},msgSuccess:function(content){$.modal.msg(content,modal_status.SUCCESS)},msgWarning:function(content){$.modal.msg(content,modal_status.WARNING)},alert:function(content,type){layer.alert(content,{icon:$.modal.icon(type),title:"系统提示",btn:["确认"],btnclass:["btn btn-primary"],})},msgReload:function(msg,type){layer.msg(msg,{icon:$.modal.icon(type),time:500,shade:[0.1,"#8F8F8F"]},function(){$.modal.reload()})},alertError:function(content){$.modal.alert(content,modal_status.FAIL)},alertSuccess:function(content){$.modal.alert(content,modal_status.SUCCESS)},alertWarning:function(content){$.modal.alert(content,modal_status.WARNING)},close:function(){var index=parent.layer.getFrameIndex(window.name);parent.layer.close(index)},confirm:function(content,callBack){layer.confirm(content,{icon:3,title:"系统提示",btn:["确认","取消"],btnclass:["btn btn-primary","btn btn-danger"],},function(index){layer.close(index);callBack(true)})},open:function(title,url,width,height){if($.common.isEmpty(title)){title=false}if($.common.isEmpty(url)){url="404.html"}if($.common.isEmpty(width)){width=800}if($.common.isEmpty(height)){height=($(window).height()-50)}layer.open({type:2,area:[width+"px",height+"px"],fix:false,maxmin:true,shade:0.3,title:title,content:url})},openFull:function(title,url,width,height){if($.common.isEmpty(title)){title=false}if($.common.isEmpty(url)){url="404.html"}if($.common.isEmpty(width)){width=800}if($.common.isEmpty(height)){height=($(window).height()-50)}var index=layer.open({type:2,area:[width+"px",height+"px"],fix:false,maxmin:true,shade:0.3,title:title,content:url});layer.full(index)},loading:function(message){$.blockUI({message:'
'+message+"
"})},closeLoading:function(){setTimeout(function(){$.unblockUI()},50)},reload:function(){parent.location.reload()}},operate:{submit:function(url,type,dataType,data){$.modal.loading("正在处理中,请稍后...");var config={url:url,type:type,dataType:dataType,data:data,success:function(result){$.operate.ajaxSuccess(result)}};$.ajax(config)},post:function(url,data){$.operate.submit(url,"post","json",data)},remove:function(id){$.modal.confirm("确定删除该条"+$.table._option.modalName+"信息吗?",function(){var url=$.common.isEmpty(id)?$.table._option.removeUrl:$.table._option.removeUrl.replace("{id}",id);var data={"ids":id};$.operate.submit(url,"post","json",data)})},batRemove:function(){var rows=$.common.isEmpty($.table._option.id)?$.table.selectFirstColumns():$.table.selectColumns($.table._option.id);if(rows.length==0){$.modal.alertWarning("请至少选择一条记录");return}$.modal.confirm("确认要删除选中的"+rows.length+"条数据吗?",function(){var url=$.table._option.removeUrl;var data={"ids":rows.join()};$.operate.submit(url,"post","json",data)})},add:function(id){var url=$.common.isEmpty(id)?$.table._option.createUrl:$.table._option.createUrl.replace("{id}",id);$.modal.open("添加"+$.table._option.modalName,url)},edit:function(id){var url=$.table._option.updateUrl.replace("{id}",id);$.modal.open("修改"+$.table._option.modalName,url)},addFull:function(id){var url=$.common.isEmpty(id)?$.table._option.createUrl:$.table._option.createUrl.replace("{id}",id);$.modal.openFull("添加"+$.table._option.modalName,url)},editFull:function(id){var url=$.table._option.updateUrl.replace("{id}",id);$.modal.openFull("修改"+$.table._option.modalName,url)},save:function(url,data){$.modal.loading("正在处理中,请稍后...");var config={url:url,type:"post",dataType:"json",data:data,success:function(result){$.operate.saveSuccess(result)}};$.ajax(config)},ajaxSuccess:function(result){if(result.code==web_status.SUCCESS){$.modal.msgSuccess(result.msg);$.table.refresh()}else{$.modal.alertError(result.msg)}$.modal.closeLoading()},saveSuccess:function(result){if(result.code==web_status.SUCCESS){$.modal.msgReload("保存成功,正在刷新数据请稍后……",modal_status.SUCCESS)}else{$.modal.alertError(result.msg)}$.modal.closeLoading()}},common:{isEmpty:function(value){if(value==null||this.trim(value)==""){return true}return false},visible:function(value){if($.common.isEmpty(value)||value==true){return true}return false},trim:function(value){if(value==null){return""}return value.toString().replace(/(^\s*)|(\s*$)|\r|\n/g,"")},random:function(min,max){return Math.floor((Math.random()*max)+min)}}})})(jQuery);web_status={SUCCESS:0,FAIL:500};modal_status={SUCCESS:"success",FAIL:"error",WARNING:"warning"}; \ No newline at end of file +(function ($) { + $.extend({ + // 表格封装处理 + table: { + _option: {}, + _params: {}, + // 初始化表格 + init: function(options) { + $.table._option = options; + $.table._params = $.common.isEmpty(options.queryParams) ? $.table.queryParams : options.queryParams; + _sortOrder = $.common.isEmpty(options.sortOrder) ? "asc" : options.sortOrder; + _sortName = $.common.isEmpty(options.sortName) ? "" : options.sortName; + $('#bootstrap-table').bootstrapTable({ + url: options.url, // 请求后台的URL(*) + contentType: "application/x-www-form-urlencoded", // 编码类型 + method: 'post', // 请求方式(*) + cache: false, // 是否使用缓存 + sortable: true, // 是否启用排序 + sortStable: true, // 设置为 true 将获得稳定的排序 + sortName: _sortName, // 排序列名称 + sortOrder: _sortOrder, // 排序方式 asc 或者 desc + pagination: true, // 是否显示分页(*) + pageNumber: 1, // 初始化加载第一页,默认第一页 + pageSize: 10, // 每页的记录行数(*) + pageList: [10, 25, 50], // 可供选择的每页的行数(*) + iconSize: 'outline', // 图标大小:undefined默认的按钮尺寸 xs超小按钮sm小按钮lg大按钮 + toolbar: '#toolbar', // 指定工作栏 + sidePagination: "server", // 启用服务端分页 + search: $.common.visible(options.search), // 是否显示搜索框功能 + showRefresh: $.common.visible(options.showRefresh), // 是否显示刷新按钮 + showColumns: $.common.visible(options.showColumns), // 是否显示隐藏某列下拉框 + showToggle: $.common.visible(options.showToggle), // 是否显示详细视图和列表视图的切换按钮 + showExport: $.common.visible(options.showExport), // 是否支持导出文件 + queryParams: $.table._params, // 传递参数(*) + columns: options.columns // 显示列信息(*) + }); + }, + // 查询条件 + queryParams: function(params) { + return { + // 传递参数查询参数 + pageSize: params.limit, + pageNum: params.offset / params.limit + 1, + searchValue: params.search, + orderByColumn: params.sort, + isAsc: params.order + }; + }, + // 搜索 + search: function(form) { + var params = $("#bootstrap-table").bootstrapTable('getOptions'); + params.queryParams = function(params) { + var search = {}; + $.each($("#" + form).serializeArray(), function(i, field) { + search[field.name] = field.value; + }); + search.pageSize = params.limit; + search.pageNum = params.offset / params.limit + 1; + search.searchValue = params.search; + search.orderByColumn = params.sort; + search.isAsc = params.order; + return search; + } + $("#bootstrap-table").bootstrapTable('refresh', params); + }, + // 下载 + exportExcel: function(form) { + $.post($.table._option.exportUrl, $("#" + form).serializeArray(), function(result) { + if (result.code == web_status.SUCCESS) { + window.location.href = ctx + "common/download?fileName=" + result.msg + "&delete=" + true; + } else { + $.modal.alertError(result.msg); + } + }); + }, + // 刷新 + refresh: function() { + $("#bootstrap-table").bootstrapTable('refresh', { + url: $.table._option.url, + silent: true + }); + }, + // 查询选中列值 + selectColumns: function(column) { + return $.map($('#bootstrap-table').bootstrapTable('getSelections'), function (row) { + return row[column]; + }); + }, + // 查询选中首列值 + selectFirstColumns: function() { + return $.map($('#bootstrap-table').bootstrapTable('getSelections'), function (row) { + return row[$.table._option.columns[1].field]; + }); + }, + // 回显数据字典 + selectDictLabel: function(_dicts, _value) { + var actions = []; + $.each(_dicts, function(index, dict) { + if (dict.dictValue == _value) { + actions.push("" + dict.dictLabel + ""); + return false; + } + }); + return actions.join(''); + } + }, + // 表格树封装处理 + treeTable: { + _option: {}, + _treeTable: {}, + // 初始化表格 + init: function(options) { + $.table._option = options; + var treeTable = $('#bootstrap-table').bootstrapTreeTable({ + code : options.id, // 用于设置父子关系 + parentCode : options.parentId, // 用于设置父子关系 + type: 'get', // 请求方式(*) + url: options.url, // 请求后台的URL(*) + ajaxParams : {}, // 请求数据的ajax的data属性 + expandColumn : '0', // 在哪一列上面显示展开按钮 + striped : false, // 是否各行渐变色 + bordered : true, // 是否显示边框 + expandAll : $.common.visible(options.expandAll), // 是否全部展开 + columns: options.columns + }); + $.treeTable._treeTable = treeTable; + }, + // 条件查询 + search: function(form) { + var params = {}; + $.each($("#" + form).serializeArray(), function(i, field) { + params[field.name] = field.value; + }); + $.treeTable._treeTable.bootstrapTreeTable('refresh', params); + }, + // 刷新 + refresh: function() { + $.treeTable._treeTable.bootstrapTreeTable('refresh'); + }, + }, + // 表单封装处理 + form: { + // 获取选中复选框项 + selectCheckeds: function(name) { + var checkeds = ""; + $('input:checkbox[name="' + name + '"]:checked').each(function(i) { + if (0 == i) { + checkeds = $(this).val(); + } else { + checkeds += ("," + $(this).val()); + } + }); + return checkeds; + }, + // 获取选中下拉框项 + selectSelects: function(name) { + var selects = ""; + $('#' + name + ' option:selected').each(function (i) { + if (0 == i) { + selects = $(this).val(); + } else { + selects += ("," + $(this).val()); + } + }); + return selects; + } + }, + // 弹出层封装处理 + modal: { + // 显示图标 + icon: function(type) { + var icon = ""; + if (type == modal_status.WARNING) { + icon = 0; + } else if (type == modal_status.SUCCESS) { + icon = 1; + } else if (type == modal_status.FAIL) { + icon = 2; + } else { + icon = 3; + } + return icon; + }, + // 消息提示 + msg: function(content, type) { + if (type != undefined) { + layer.msg(content, { icon: $.modal.icon(type), time: 1000, shift: 5 }); + } else { + layer.msg(content); + } + }, + // 错误消息 + msgError: function(content) { + $.modal.msg(content, modal_status.FAIL); + }, + // 成功消息 + msgSuccess: function(content) { + $.modal.msg(content, modal_status.SUCCESS); + }, + // 警告消息 + msgWarning: function(content) { + $.modal.msg(content, modal_status.WARNING); + }, + // 弹出提示 + alert: function(content, type) { + layer.alert(content, { + icon: $.modal.icon(type), + title: "系统提示", + btn: ['确认'], + btnclass: ['btn btn-primary'], + }); + }, + // 消息提示并刷新父窗体 + msgReload: function(msg, type) { + layer.msg(msg, { + icon: $.modal.icon(type), + time: 500, + shade: [0.1, '#8F8F8F'] + }, + function() { + $.modal.reload(); + }); + }, + // 错误提示 + alertError: function(content) { + $.modal.alert(content, modal_status.FAIL); + }, + // 成功提示 + alertSuccess: function(content) { + $.modal.alert(content, modal_status.SUCCESS); + }, + // 警告提示 + alertWarning: function(content) { + $.modal.alert(content, modal_status.WARNING); + }, + // 关闭窗体 + close: function () { + var index = parent.layer.getFrameIndex(window.name); + parent.layer.close(index); + }, + // 确认窗体 + confirm: function (content, callBack) { + layer.confirm(content, { + icon: 3, + title: "系统提示", + btn: ['确认', '取消'], + btnclass: ['btn btn-primary', 'btn btn-danger'], + }, function (index) { + layer.close(index); + callBack(true); + }); + }, + // 弹出层指定宽度 + open: function (title, url, width, height) { + if ($.common.isEmpty(title)) { + title = false; + }; + if ($.common.isEmpty(url)) { + url = "404.html"; + }; + if ($.common.isEmpty(width)) { + width = 800; + }; + if ($.common.isEmpty(height)) { + height = ($(window).height() - 50); + }; + layer.open({ + type: 2, + area: [width + 'px', height + 'px'], + fix: false, + //不固定 + maxmin: true, + shade: 0.3, + title: title, + content: url + }); + }, + // 弹出层全屏 + openFull: function (title, url, width, height) { + if ($.common.isEmpty(title)) { + title = false; + }; + if ($.common.isEmpty(url)) { + url = "404.html"; + }; + if ($.common.isEmpty(width)) { + width = 800; + }; + if ($.common.isEmpty(height)) { + height = ($(window).height() - 50); + }; + var index = layer.open({ + type: 2, + area: [width + 'px', height + 'px'], + fix: false, + //不固定 + maxmin: true, + shade: 0.3, + title: title, + content: url + }); + layer.full(index); + }, + // 打开遮罩层 + loading: function (message) { + $.blockUI({ message: '
' + message + '
' }); + }, + // 关闭遮罩层 + closeLoading: function () { + setTimeout(function(){ + $.unblockUI(); + }, 50); + }, + // 重新加载 + reload: function () { + parent.location.reload(); + } + }, + // 操作封装处理 + operate: { + // 提交数据 + submit: function(url, type, dataType, data) { + $.modal.loading("正在处理中,请稍后..."); + var config = { + url: url, + type: type, + dataType: dataType, + data: data, + success: function(result) { + $.operate.ajaxSuccess(result); + } + }; + $.ajax(config) + }, + // post请求传输 + post: function(url, data) { + $.operate.submit(url, "post", "json", data); + }, + // 删除信息 + remove: function(id) { + $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() { + var url = $.common.isEmpty(id) ? $.table._option.removeUrl : $.table._option.removeUrl.replace("{id}", id); + var data = { "ids": id }; + $.operate.submit(url, "post", "json", data); + }); + }, + // 批量删除信息 + batRemove: function() { + var rows = $.common.isEmpty($.table._option.id) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.id); + if (rows.length == 0) { + $.modal.alertWarning("请至少选择一条记录"); + return; + } + $.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() { + var url = $.table._option.removeUrl; + var data = { "ids": rows.join() }; + $.operate.submit(url, "post", "json", data); + }); + }, + // 添加信息 + add: function(id) { + var url = $.common.isEmpty(id) ? $.table._option.createUrl : $.table._option.createUrl.replace("{id}", id); + $.modal.open("添加" + $.table._option.modalName, url); + }, + // 修改信息 + edit: function(id) { + var url = $.table._option.updateUrl.replace("{id}", id); + $.modal.open("修改" + $.table._option.modalName, url); + }, + // 添加信息 全屏 + addFull: function(id) { + var url = $.common.isEmpty(id) ? $.table._option.createUrl : $.table._option.createUrl.replace("{id}", id); + $.modal.openFull("添加" + $.table._option.modalName, url); + }, + // 修改信息 全屏 + editFull: function(id) { + var url = $.table._option.updateUrl.replace("{id}", id); + $.modal.openFull("修改" + $.table._option.modalName, url); + }, + // 保存信息 + save: function(url, data) { + $.modal.loading("正在处理中,请稍后..."); + var config = { + url: url, + type: "post", + dataType: "json", + data: data, + success: function(result) { + $.operate.saveSuccess(result); + } + }; + $.ajax(config) + }, + // 保存结果弹出msg刷新table表格 + ajaxSuccess: function (result) { + if (result.code == web_status.SUCCESS) { + $.modal.msgSuccess(result.msg); + $.table.refresh(); + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); + }, + // 保存结果提示msg + saveSuccess: function (result) { + if (result.code == web_status.SUCCESS) { + $.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS); + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); + } + }, + // 通用方法封装处理 + common: { + // 判断字符串是否为空 + isEmpty: function (value) { + if (value == null || this.trim(value) == "") { + return true; + } + return false; + }, + // 是否显示数据 为空默认为显示 + visible: function (value) { + if ($.common.isEmpty(value) || value == true) { + return true; + } + return false; + }, + // 空格截取 + trim: function (value) { + if (value == null) { + return ""; + } + return value.toString().replace(/(^\s*)|(\s*$)|\r|\n/g, ""); + }, + // 指定随机数返回 + random: function (min, max) { + return Math.floor((Math.random() * max) + min); + } + } + }); +})(jQuery); + +/** 消息状态码 */ +web_status = { + SUCCESS: 0, + FAIL: 500 +}; + +/** 弹窗状态码 */ +modal_status = { + SUCCESS: "success", + FAIL: "error", + WARNING: "warning" +}; \ No newline at end of file diff --git a/src/main/resources/templates/include.html b/src/main/resources/templates/include.html index 29560c90d..305a0f71d 100644 --- a/src/main/resources/templates/include.html +++ b/src/main/resources/templates/include.html @@ -40,8 +40,8 @@ - - + + diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 7cdb92889..6692923f5 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -15,12 +15,12 @@ - + - +
@@ -136,7 +136,7 @@ - + diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index d98ff5d0e..79ea17216 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -12,7 +12,7 @@ - + @@ -81,7 +81,7 @@ - + diff --git a/src/main/resources/templates/main.html b/src/main/resources/templates/main.html index 5ec51a4b6..6bcb0def1 100644 --- a/src/main/resources/templates/main.html +++ b/src/main/resources/templates/main.html @@ -97,10 +97,34 @@
- v2.1.02018.07.10 + v2.2.02018.07.23
-
+
+
+
    +
  1. 修复批量生成代码异常问题
  2. +
  3. 修复定时器保存失败问题
  4. +
  5. 修复热部署转换问题
  6. +
  7. 支持查询&统一样式(菜单管理,部门管理)
  8. +
  9. 大多数功能支持时间查询
  10. +
  11. 去掉自定义导出注解column列变更为自动匹配
  12. +
  13. 新增任务执行策略
  14. +
  15. 操作详细动态显示类型
  16. +
  17. 支持动态回显字典数据
  18. +
  19. 后台代码优化调整
  20. +
  21. 其他细节优化
  22. +
+
+
+
+
+
+
+ v2.1.02018.07.10 +
+
+
  1. 新增登陆超时提醒
  2. diff --git a/src/main/resources/templates/monitor/job/add.html b/src/main/resources/templates/monitor/job/add.html index 315be46b3..5c94cf65d 100644 --- a/src/main/resources/templates/monitor/job/add.html +++ b/src/main/resources/templates/monitor/job/add.html @@ -46,7 +46,7 @@
-
+
@@ -85,7 +85,7 @@ }, }, submitHandler:function(form){ - $.operate.save(prefix + "/save", $('#form-job-add').serialize()); + $.operate.save(prefix + "/add", $('#form-job-add').serialize()); } }); diff --git a/src/main/resources/templates/monitor/job/edit.html b/src/main/resources/templates/monitor/job/edit.html index abaaa1622..d0e41b489 100644 --- a/src/main/resources/templates/monitor/job/edit.html +++ b/src/main/resources/templates/monitor/job/edit.html @@ -47,7 +47,7 @@
-
+
@@ -86,7 +86,7 @@ }, }, submitHandler:function(form){ - $.operate.save(prefix + "/save", $('#form-job-edit').serialize()); + $.operate.save(prefix + "/edit", $('#form-job-edit').serialize()); } }); diff --git a/src/main/resources/templates/monitor/job/job.html b/src/main/resources/templates/monitor/job/job.html index fc8118996..afd045ed1 100644 --- a/src/main/resources/templates/monitor/job/job.html +++ b/src/main/resources/templates/monitor/job/job.html @@ -18,7 +18,7 @@ 方法名称:
  • - 任务状态: @@ -51,9 +51,10 @@
  • diff --git a/src/main/resources/templates/system/config/config.html b/src/main/resources/templates/system/config/config.html index 9c43c7c3f..429a8dcbe 100644 --- a/src/main/resources/templates/system/config/config.html +++ b/src/main/resources/templates/system/config/config.html @@ -17,7 +17,7 @@ 参数键名:
  • - 系统内置: @@ -52,8 +52,9 @@
  • diff --git a/src/main/resources/templates/system/dept/add.html b/src/main/resources/templates/system/dept/add.html index 2820cae43..1b810ea38 100644 --- a/src/main/resources/templates/system/dept/add.html +++ b/src/main/resources/templates/system/dept/add.html @@ -44,7 +44,7 @@
    -
    +
    @@ -94,7 +94,7 @@ } }, submitHandler:function(form){ - $.operate.save(prefix + "/save", $('#form-dept-add').serialize()); + $.operate.save(prefix + "/add", $('#form-dept-add').serialize()); } }); diff --git a/src/main/resources/templates/system/dept/dept.html b/src/main/resources/templates/system/dept/dept.html index da451703a..772dbaf79 100644 --- a/src/main/resources/templates/system/dept/dept.html +++ b/src/main/resources/templates/system/dept/dept.html @@ -14,7 +14,7 @@ 部门名称:
  • - 部门状态: @@ -39,9 +39,10 @@
  • diff --git a/src/main/resources/templates/system/dict/data/data.html b/src/main/resources/templates/system/dict/data/data.html index c36c286a3..9ccbb12f1 100644 --- a/src/main/resources/templates/system/dict/data/data.html +++ b/src/main/resources/templates/system/dict/data/data.html @@ -20,7 +20,7 @@ 字典标签:
  • - 数据状态: @@ -51,8 +51,9 @@
    diff --git a/src/main/resources/templates/system/dict/type/add.html b/src/main/resources/templates/system/dict/type/add.html index c6e5ba041..cf03ff19f 100644 --- a/src/main/resources/templates/system/dict/type/add.html +++ b/src/main/resources/templates/system/dict/type/add.html @@ -19,7 +19,7 @@
  • -
    +
    @@ -75,7 +75,7 @@ } }, submitHandler:function(form){ - $.operate.save(prefix + "/save", $('#form-dict-add').serialize()); + $.operate.save(prefix + "/add", $('#form-dict-add').serialize()); } }); diff --git a/src/main/resources/templates/system/dict/type/edit.html b/src/main/resources/templates/system/dict/type/edit.html index 59796b591..b42c2fae4 100644 --- a/src/main/resources/templates/system/dict/type/edit.html +++ b/src/main/resources/templates/system/dict/type/edit.html @@ -20,7 +20,7 @@
    -
    +
    @@ -79,7 +79,7 @@ } }, submitHandler:function(form){ - $.operate.save(prefix + "/save", $('#form-dict-edit').serialize()); + $.operate.save(prefix + "/edit", $('#form-dict-edit').serialize()); } }); diff --git a/src/main/resources/templates/system/dict/type/type.html b/src/main/resources/templates/system/dict/type/type.html index 467fa7451..bbc02068c 100644 --- a/src/main/resources/templates/system/dict/type/type.html +++ b/src/main/resources/templates/system/dict/type/type.html @@ -18,7 +18,7 @@ 字典类型:
  • - 字典状态: @@ -54,9 +54,10 @@
  • diff --git a/src/main/resources/templates/system/notice/edit.html b/src/main/resources/templates/system/notice/edit.html index e297282c6..8bc96d2bc 100644 --- a/src/main/resources/templates/system/notice/edit.html +++ b/src/main/resources/templates/system/notice/edit.html @@ -17,7 +17,7 @@
    -
    @@ -31,7 +31,7 @@
    -
    +
    @@ -69,7 +69,7 @@ submitHandler: function(form) { var sHTML = $('.summernote').code(); $("#noticeContent").val(sHTML); - $.operate.save(prefix + "/save", $('#form-notice-edit').serialize()); + $.operate.save(prefix + "/edit", $('#form-notice-edit').serialize()); } }); diff --git a/src/main/resources/templates/system/notice/notice.html b/src/main/resources/templates/system/notice/notice.html index bf3d1b894..6de26901d 100644 --- a/src/main/resources/templates/system/notice/notice.html +++ b/src/main/resources/templates/system/notice/notice.html @@ -17,7 +17,7 @@ 操作人员:
  • - 公告类型: @@ -46,8 +46,10 @@
  • diff --git a/src/main/resources/templates/system/post/edit.html b/src/main/resources/templates/system/post/edit.html index a905a51a0..6e2cf5b55 100644 --- a/src/main/resources/templates/system/post/edit.html +++ b/src/main/resources/templates/system/post/edit.html @@ -26,7 +26,7 @@
    -
    +
    @@ -65,7 +65,7 @@ }, }, submitHandler:function(form){ - $.operate.save(prefix + "/save", $('#form-post-edit').serialize()); + $.operate.save(prefix + "/edit", $('#form-post-edit').serialize()); } }); diff --git a/src/main/resources/templates/system/post/post.html b/src/main/resources/templates/system/post/post.html index 4d5f9f460..afaa6dc8e 100644 --- a/src/main/resources/templates/system/post/post.html +++ b/src/main/resources/templates/system/post/post.html @@ -18,7 +18,7 @@ 岗位名称:
  • - 岗位状态: @@ -48,8 +48,9 @@
  • diff --git a/src/main/resources/templates/vm/html/edit.html.vm b/src/main/resources/templates/vm/html/edit.html.vm index 0b220385c..34dd8e39f 100644 --- a/src/main/resources/templates/vm/html/edit.html.vm +++ b/src/main/resources/templates/vm/html/edit.html.vm @@ -34,7 +34,7 @@ }, }, submitHandler: function(form) { - $.operate.save(prefix + "/save", $('#form-${classname}-edit').serialize()); + $.operate.save(prefix + "/edit", $('#form-${classname}-edit').serialize()); } }); diff --git a/src/main/resources/templates/vm/java/Controller.java.vm b/src/main/resources/templates/vm/java/Controller.java.vm index 65164f3c4..5d37a9485 100644 --- a/src/main/resources/templates/vm/java/Controller.java.vm +++ b/src/main/resources/templates/vm/java/Controller.java.vm @@ -4,7 +4,7 @@ import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -56,41 +56,45 @@ public class ${className}Controller extends BaseController /** * 新增${tableComment} */ - @RequiresPermissions("${moduleName}:${classname}:add") - @Log(title = "${tableComment}", action = BusinessType.INSERT) @GetMapping("/add") public String add() { return prefix + "/add"; } + + /** + * 新增保存${tableComment} + */ + @RequiresPermissions("${moduleName}:${classname}:add") + @Log(title = "${tableComment}", action = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(${className} ${classname}) + { + return toAjax(${classname}Service.insert${className}(${classname})); + } /** * 修改${tableComment} */ - @RequiresPermissions("${moduleName}:${classname}:edit") - @Log(title = "${tableComment}", action = BusinessType.UPDATE) @GetMapping("/edit/{${primaryKey.attrname}}") - public String edit(@PathVariable("${primaryKey.attrname}") ${primaryKey.attrType} ${primaryKey.attrname}, Model model) + public String edit(@PathVariable("${primaryKey.attrname}") ${primaryKey.attrType} ${primaryKey.attrname}, ModelMap mmap) { ${className} ${classname} = ${classname}Service.select${className}ById(${primaryKey.attrname}); - model.addAttribute("${classname}", ${classname}); + mmap.put("${classname}", ${classname}); return prefix + "/edit"; } /** - * 保存${tableComment} + * 修改保存${tableComment} */ - @RequiresPermissions("${moduleName}:${classname}:save") - @Log(title = "${tableComment}", action = BusinessType.SAVE) - @PostMapping("/save") + @RequiresPermissions("${moduleName}:${classname}:edit") + @Log(title = "${tableComment}", action = BusinessType.UPDATE) + @PostMapping("/edit") @ResponseBody - public AjaxResult save(${className} ${classname}) - { - if (${classname}Service.save${className}(${classname}) > 0) - { - return success(); - } - return error(); + public AjaxResult editSave(${className} ${classname}) + { + return toAjax(${classname}Service.update${className}(${classname})); } /** @@ -101,13 +105,8 @@ public class ${className}Controller extends BaseController @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) - { - int rows = ${classname}Service.delete${className}ByIds(ids); - if (rows > 0) - { - return success(); - } - return error(); + { + return toAjax(${classname}Service.delete${className}ByIds(ids)); } } diff --git a/src/main/resources/templates/vm/java/Service.java.vm b/src/main/resources/templates/vm/java/Service.java.vm index 3907e27dd..7276e6b90 100644 --- a/src/main/resources/templates/vm/java/Service.java.vm +++ b/src/main/resources/templates/vm/java/Service.java.vm @@ -42,16 +42,7 @@ public interface I${className}Service * @return 结果 */ public int update${className}(${className} ${classname}); - - /** - * 保存${tableComment} - * - * @param ${classname} ${tableComment}信息 - * @return 结果 - */ - public int save${className}(${className} ${classname}); - - + /** * 删除${tableComment}信息 * diff --git a/src/main/resources/templates/vm/java/ServiceImpl.java.vm b/src/main/resources/templates/vm/java/ServiceImpl.java.vm index 4937e1a7d..b76f981dc 100644 --- a/src/main/resources/templates/vm/java/ServiceImpl.java.vm +++ b/src/main/resources/templates/vm/java/ServiceImpl.java.vm @@ -3,7 +3,6 @@ package ${package}.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.utils.StringUtils; import ${package}.mapper.${className}Mapper; import ${package}.domain.${className}; import ${package}.service.I${className}Service; @@ -68,29 +67,7 @@ public class ${className}ServiceImpl implements I${className}Service { return ${classname}Mapper.update${className}(${classname}); } - - /** - * 保存${tableComment} - * - * @param ${classname} ${tableComment}信息 - * @return 结果 - */ - @Override - public int save${className}(${className} ${classname}) - { - ${primaryKey.attrType} ${primaryKey.attrname} = ${classname}.get${primaryKey.attrName}(); - int rows = 0; - if (StringUtils.isNotNull(${primaryKey.attrname})) - { - rows = ${classname}Mapper.update${className}(${classname}); - } - else - { - rows = ${classname}Mapper.insert${className}(${classname}); - } - return rows; - } - + /** * 删除${tableComment}对象 * diff --git a/src/main/resources/templates/vm/sql/sql.vm b/src/main/resources/templates/vm/sql/sql.vm index b07cc3ec8..baf93dcbb 100644 --- a/src/main/resources/templates/vm/sql/sql.vm +++ b/src/main/resources/templates/vm/sql/sql.vm @@ -17,6 +17,3 @@ values('${tableComment}修改', @parentId, '3', '#', 'F', '0', '${moduleName}: insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) values('${tableComment}删除', @parentId, '4', '#', 'F', '0', '${moduleName}:${classname}:remove', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); - -insert into sys_menu (menu_name, parent_id, order_num, url,menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${tableComment}保存', @parentId, '5', '#', 'F', '0', '${moduleName}:${classname}:save', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', ''); diff --git a/src/test/java/com/ruoyi/common/utils/AddressUtilsTest.java b/src/test/java/com/ruoyi/common/utils/AddressUtilsTest.java index a778b4052..8d60587e9 100644 --- a/src/test/java/com/ruoyi/common/utils/AddressUtilsTest.java +++ b/src/test/java/com/ruoyi/common/utils/AddressUtilsTest.java @@ -12,14 +12,17 @@ import org.junit.Test; * @since 07/22/2018 */ -public class AddressUtilsTest { +public class AddressUtilsTest +{ @Before - public void before() throws Exception { + public void before() throws Exception + { } @After - public void after() throws Exception { + public void after() throws Exception + { } /** @@ -27,11 +30,11 @@ public class AddressUtilsTest { *

    */ @Test - public void testGetRealAddressByIP() throws Exception { - //TODO: Test goes here... + public void testGetRealAddressByIP() throws Exception + { + // TODO: Test goes here... String ipAddress = AddressUtils.getRealAddressByIP("121.8.250.1"); System.out.println(ipAddress); } - -} +} diff --git a/src/test/java/com/ruoyi/project/system/dept/service/DeptServiceImplTest.java b/src/test/java/com/ruoyi/project/system/dept/service/DeptServiceImplTest.java index 99af3eac2..9fbb283a2 100644 --- a/src/test/java/com/ruoyi/project/system/dept/service/DeptServiceImplTest.java +++ b/src/test/java/com/ruoyi/project/system/dept/service/DeptServiceImplTest.java @@ -6,10 +6,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - import java.util.List; import java.util.Map; @@ -22,32 +20,37 @@ import java.util.Map; */ @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest -public class DeptServiceImplTest { +public class DeptServiceImplTest +{ @Autowired private IDeptService deptService; @Before - public void before() throws Exception { + public void before() throws Exception + { } @After - public void after() throws Exception { + public void after() throws Exception + { } /** * Method: selectDeptList(Dept dept) */ @Test - public void testSelectDeptList() throws Exception { - //TODO: Test goes here... + public void testSelectDeptList() throws Exception + { + // TODO: Test goes here... } /** * Method: selectDeptAll() */ @Test - public void testSelectDeptAll() throws Exception { - //TODO: Test goes here... + public void testSelectDeptAll() throws Exception + { + // TODO: Test goes here... Assert.assertEquals(deptService.selectDeptAll().size(), 10); } @@ -55,19 +58,20 @@ public class DeptServiceImplTest { * Method: selectDeptTree() */ @Test - public void testSelectDeptTree() throws Exception { - //TODO: Test goes here... + public void testSelectDeptTree() throws Exception + { + // TODO: Test goes here... List> trees = deptService.selectDeptTree(); - trees.stream() - .forEach(tree -> System.out.println(tree)); + trees.stream().forEach(tree -> System.out.println(tree)); } /** * Method: selectDeptCount(Long parentId) */ @Test - public void testSelectDeptCount() throws Exception { - //TODO: Test goes here... + public void testSelectDeptCount() throws Exception + { + // TODO: Test goes here... Assert.assertEquals(10, deptService.selectDeptCount(0L)); } @@ -75,32 +79,36 @@ public class DeptServiceImplTest { * Method: checkDeptExistUser(Long deptId) */ @Test - public void testCheckDeptExistUser() throws Exception { - //TODO: Test goes here... + public void testCheckDeptExistUser() throws Exception + { + // TODO: Test goes here... } /** * Method: deleteDeptById(Long deptId) */ @Test - public void testDeleteDeptById() throws Exception { - //TODO: Test goes here... + public void testDeleteDeptById() throws Exception + { + // TODO: Test goes here... } /** * Method: saveDept(Dept dept) */ @Test - public void testSaveDept() throws Exception { - //TODO: Test goes here... + public void testSaveDept() throws Exception + { + // TODO: Test goes here... } /** * Method: selectDeptById(Long deptId) */ @Test - public void testSelectDeptById() throws Exception { - //TODO: Test goes here... + public void testSelectDeptById() throws Exception + { + // TODO: Test goes here... Assert.assertNotNull("若依集团不存在", deptService.selectDeptById(100L)); } @@ -108,9 +116,9 @@ public class DeptServiceImplTest { * Method: checkDeptNameUnique(Dept dept) */ @Test - public void testCheckDeptNameUnique() throws Exception { - //TODO: Test goes here... + public void testCheckDeptNameUnique() throws Exception + { + // TODO: Test goes here... } - -} +}