diff --git a/pom.xml b/pom.xml index 550411028..aa15b270a 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,9 @@ UTF-8 1.8 1.3.2 - 1.2.1 + 3.0.2.RELEASE + 2.0.1 + 2.0.0 1.1.1 1.2.31 1.0.28 diff --git a/sql/ry_20180423.sql b/sql/ry_20180505.sql similarity index 98% rename from sql/ry_20180423.sql rename to sql/ry_20180505.sql index ee6c15c6d..fe0cc6f68 100644 --- a/sql/ry_20180423.sql +++ b/sql/ry_20180505.sql @@ -44,6 +44,8 @@ create table sys_user ( user_name varchar(30) default '' comment '用户昵称', email varchar(100) default '' comment '用户邮箱', phonenumber varchar(20) default '' comment '手机号码', + sex char(20) default '0' comment '用户性别:0男,1女', + avatar varchar(100) default '' comment '头像路径', password varchar(100) default '' comment '密码', salt varchar(100) default '' comment '盐加密', user_type char(1) default 'N' comment '类型:Y默认用户,N非默认用户', @@ -59,8 +61,8 @@ create table sys_user ( -- ---------------------------- -- 初始化-用户信息表数据 -- ---------------------------- -insert into sys_user values(1, 106, 'admin', '若依', 'yzz_ivy@163.com', '15088888888', '29c67a30398638269fe600f73a054934', '111111', 'Y', 0, '维护中', 'admin', '2018-03-01', 'ry', '2018-03-01'); -insert into sys_user values(2, 108, 'ry', '若依', 'ry@163.com', '15288888888', '8e6d98b90472783cc73c17047ddccf36', '222222', 'N', 1, '锁定中', 'admin', '2018-03-01', 'ry', '2018-03-01'); +insert into sys_user values(1, 106, 'admin', '若依', 'yzz_ivy@163.com', '15088888888', '0', 'img/a5.jpg', '29c67a30398638269fe600f73a054934', '111111', 'N', 1, '维护中', 'admin', '2018-03-01', 'ry', '2018-03-01'); +insert into sys_user values(2, 108, 'ry', '若依', 'ry@163.com', '15288888888', '1', 'img/a5.jpg', '8e6d98b90472783cc73c17047ddccf36', '222222', 'N', 1, '锁定中', 'admin', '2018-03-01', 'ry', '2018-03-01'); -- ---------------------------- diff --git a/src/main/java/com/ruoyi/project/system/post/dao/IPostDao.java b/src/main/java/com/ruoyi/project/system/post/dao/IPostDao.java index a48b3456f..39f26f3c9 100644 --- a/src/main/java/com/ruoyi/project/system/post/dao/IPostDao.java +++ b/src/main/java/com/ruoyi/project/system/post/dao/IPostDao.java @@ -12,10 +12,10 @@ public interface IPostDao { /** - * 查询系统操作日志集合 + * 查询岗位数据集合 * * @param post 岗位信息 - * @return 操作日志集合 + * @return 岗位数据集合 */ public List selectPostList(Post post); 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 f079bfc5e..458c9110d 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 @@ -47,11 +47,4 @@ public class IndexController extends BaseController return "main"; } - // 个人信息 - @GetMapping("/system/profile") - public String profile(Model model) - { - return "system/user/profile"; - } - } 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 7ba1968cc..920e49764 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 @@ -37,10 +37,10 @@ public class UserController extends BaseController @Autowired private IUserService userService; - + @Autowired private IRoleService roleService; - + @Autowired private IPostService postService; @@ -92,7 +92,7 @@ public class UserController extends BaseController model.addAttribute("posts", posts); return prefix + "/add"; } - + @RequiresPermissions("system:user:resetPwd") @Log(title = "系统管理", action = "用户管理-重置密码") @GetMapping("/resetPwd/{userId}") @@ -102,7 +102,7 @@ public class UserController extends BaseController model.addAttribute("user", user); return prefix + "/resetPwd"; } - + @RequiresPermissions("system:user:resetPwd") @Log(title = "系统管理", action = "用户管理-重置密码") @PostMapping("/resetPwd") @@ -120,7 +120,7 @@ public class UserController extends BaseController @RequiresPermissions("system:user:remove") @Log(title = "系统管理", action = "用户管理-删除用户") @RequestMapping("/remove/{userId}") - @Transactional(rollbackFor=Exception.class) + @Transactional(rollbackFor = Exception.class) @ResponseBody public Message remove(@PathVariable("userId") Long userId) { @@ -139,7 +139,7 @@ public class UserController extends BaseController @RequiresPermissions("system:user:batchRemove") @Log(title = "系统管理", action = "用户管理-批量删除") @PostMapping("/batchRemove") - @Transactional(rollbackFor=Exception.class) + @Transactional(rollbackFor = Exception.class) @ResponseBody public Message batchRemove(@RequestParam("ids[]") Long[] ids) { @@ -157,7 +157,7 @@ public class UserController extends BaseController @RequiresPermissions("system:user:save") @Log(title = "系统管理", action = "部门管理-保存部门") @PostMapping("/save") - @Transactional(rollbackFor=Exception.class) + @Transactional(rollbackFor = Exception.class) @ResponseBody public Message save(User user) { @@ -183,4 +183,28 @@ public class UserController extends BaseController return uniqueFlag; } + /** + * 个人信息 + */ + @GetMapping("/profile") + public String profile(Model model) + { + 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); + return prefix + "/profile"; + } + } \ No newline at end of file diff --git a/src/main/java/com/ruoyi/project/system/user/domain/User.java b/src/main/java/com/ruoyi/project/system/user/domain/User.java index 8b992c73f..4608aadee 100644 --- a/src/main/java/com/ruoyi/project/system/user/domain/User.java +++ b/src/main/java/com/ruoyi/project/system/user/domain/User.java @@ -28,6 +28,10 @@ public class User extends PageDomain private String email; /** 手机号码 */ private String phonenumber; + /** 用户性别 */ + private String sex; + /** 用户头像 */ + private String avatar; /** 密码 */ private String password; /** 盐加密 */ @@ -123,6 +127,26 @@ public class User extends PageDomain this.phonenumber = phonenumber; } + public String getSex() + { + return sex; + } + + public void setSex(String sex) + { + this.sex = sex; + } + + public String getAvatar() + { + return avatar; + } + + public void setAvatar(String avatar) + { + this.avatar = avatar; + } + public String getPassword() { return password; 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 f0aa3b9d8..d07fcf245 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 @@ -58,7 +58,7 @@ public interface IUserService * @return 结果 */ public int saveUser(User user); - + /** * 修改用户信息 * @@ -75,4 +75,20 @@ public interface IUserService */ public String checkUserNameUnique(String loginName); + /** + * 根据用户ID查询用户所属角色组 + * + * @param userId 用户ID + * @return 结果 + */ + public String selectUserRoleGroup(Long userId); + + /** + * 根据用户ID查询用户所属岗位组 + * + * @param userId 用户ID + * @return 结果 + */ + public String selectUserPostGroup(Long userId); + } 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 b02ccb2c1..b1edf2b88 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 @@ -10,6 +10,10 @@ import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.security.ShiroUtils; import com.ruoyi.framework.shiro.service.PasswordService; +import com.ruoyi.project.system.post.dao.IPostDao; +import com.ruoyi.project.system.post.domain.Post; +import com.ruoyi.project.system.role.dao.IRoleDao; +import com.ruoyi.project.system.role.domain.Role; import com.ruoyi.project.system.user.dao.IUserDao; import com.ruoyi.project.system.user.dao.IUserPostDao; import com.ruoyi.project.system.user.dao.IUserRoleDao; @@ -29,6 +33,12 @@ public class UserServiceImpl implements IUserService @Autowired private IUserDao userDao; + @Autowired + private IRoleDao roleDao; + + @Autowired + private IPostDao postDao; + @Autowired private IUserPostDao userPostDao; @@ -220,4 +230,48 @@ public class UserServiceImpl implements IUserService } return UserConstants.NAME_UNIQUE; } + + /** + * 查询用户所属角色组 + * + * @param userId 用户ID + * @return 结果 + */ + @Override + public String selectUserRoleGroup(Long userId) + { + List list = roleDao.selectRolesByUserId(userId); + StringBuffer idsStr = new StringBuffer(); + for (Role role : list) + { + idsStr.append(role.getRoleName()).append(","); + } + if (StringUtils.isNotEmpty(idsStr.toString())) + { + idsStr.substring(0, idsStr.length() - 1); + } + return idsStr.toString(); + } + + /** + * 查询用户所属岗位组 + * + * @param userId 用户ID + * @return 结果 + */ + @Override + public String selectUserPostGroup(Long userId) + { + List list = postDao.selectPostsByUserId(userId); + StringBuffer idsStr = new StringBuffer(); + for (Post post : list) + { + idsStr.append(post.getPostName()).append(","); + } + if (StringUtils.isNotEmpty(idsStr.toString())) + { + idsStr.substring(0, idsStr.length() - 1); + } + return idsStr.toString(); + } } diff --git a/src/main/resources/mybatis/system/RoleMapper.xml b/src/main/resources/mybatis/system/RoleMapper.xml index e2ec3f2ad..e03e4bdfd 100644 --- a/src/main/resources/mybatis/system/RoleMapper.xml +++ b/src/main/resources/mybatis/system/RoleMapper.xml @@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select role_id, role_name, role_key, role_sort, status, create_time from sys_role + select role_id, role_name, role_key, role_sort, status, create_time, remark from sys_role AND role_name = #{searchValue} OR role_key = #{searchValue} @@ -35,11 +35,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - SELECT role_id, role_name, role_key, role_sort, status, create_time FROM sys_role + SELECT role_id, role_name, role_key, role_sort, status, create_time, remark FROM sys_role - select role_id, role_name, role_key, role_sort, status, create_time + select role_id, role_name, role_key, role_sort, status, create_time, remark from sys_role u where u.role_id = #{roleId} diff --git a/src/main/resources/mybatis/system/UserMapper.xml b/src/main/resources/mybatis/system/UserMapper.xml index cb3c2772f..5bdef16bb 100644 --- a/src/main/resources/mybatis/system/UserMapper.xml +++ b/src/main/resources/mybatis/system/UserMapper.xml @@ -11,6 +11,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -32,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select user_id, dept_id, login_name, user_name, email, phonenumber, password, salt, user_type, status, refuse_des, create_by, create_time from sys_user + select user_id, dept_id, login_name, user_name, email, phonenumber, password, sex, avatar, salt, user_type, status, refuse_des, create_by, create_time from sys_user AND login_name = #{searchValue} @@ -44,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.phonenumber, u.password, u.salt, u.status, u.refuse_des, u.create_time, + select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.phonenumber, u.sex, u.avatar, u.password, u.salt, u.status, u.refuse_des, u.create_time, d.dept_id, d.parent_id, d.dept_name, d.order_num, d.status as dept_status from sys_user u left join sys_dept d on u.dept_id = d.dept_id @@ -57,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.phonenumber, u.password, u.salt, u.status, u.refuse_des, u.create_time, + select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.phonenumber, u.sex, u.avatar, u.password, u.salt, u.status, u.refuse_des, u.create_time, d.dept_id, d.parent_id, d.dept_name, d.order_num, d.status as dept_status from sys_user u left join sys_dept d on u.dept_id = d.dept_id @@ -84,6 +86,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" user_name = #{userName}, email = #{email}, phonenumber = #{phonenumber}, + sex = #{sex}, + avatar = #{avatar}, password = #{password}, salt = #{salt}, status = #{status}, @@ -103,6 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" user_name, email, phonenumber, + sex, password, salt, status, @@ -116,6 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{userName}, #{email}, #{phonenumber}, + #{sex}, #{password}, #{salt}, #{status}, diff --git a/src/main/resources/static/ruoyi/js/ry-ui.js b/src/main/resources/static/ruoyi/js/ry-ui.js index 25ecf5a28..e89c4a483 100644 --- a/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/src/main/resources/static/ruoyi/js/ry-ui.js @@ -138,15 +138,27 @@ $(function(){ } // 获取选中复选框项 $.getCheckeds = function (_name) { - var roleIds = ""; + var checkeds = ""; $('input:checkbox[name="' + _name + '"]:checked').each(function(i) { if (0 == i) { - roleIds = $(this).val(); + checkeds = $(this).val(); } else { - roleIds += ("," + $(this).val()); + checkeds += ("," + $(this).val()); } }); - return roleIds; + return checkeds; + } + // 获取选中复选框项 + $.getSelects = function (_name) { + var selects = ""; + $('#' + _name + ' option:selected').each(function (i) { + if (0 == i) { + selects = $(this).val(); + } else { + selects += ("," + $(this).val()); + } + }); + return selects; } // 复选框事件绑定 if ($.fn.select2 !== undefined) { diff --git a/src/main/resources/static/ruoyi/system/user/add.js b/src/main/resources/static/ruoyi/system/user/add.js index 23579f4c0..0720a56b0 100644 --- a/src/main/resources/static/ruoyi/system/user/add.js +++ b/src/main/resources/static/ruoyi/system/user/add.js @@ -51,9 +51,10 @@ function add() { var password = $("input[name='password']").val(); var email = $("input[name='email']").val(); var phonenumber = $("input[name='phonenumber']").val(); + var sex = $("input[name='sex']:checked").val(); var status = $("input[name='status']").is(':checked') == true ? 0 : 1; var roleIds = $.getCheckeds("role"); - var postIds = $("#post").val() + ""; + var postIds = $.getSelects("post"); $.ajax({ cache : true, type : "POST", @@ -66,6 +67,7 @@ function add() { "password": password, "email": email, "phonenumber": phonenumber, + "sex": sex, "status": status, "roleIds": roleIds, "postIds": postIds diff --git a/src/main/resources/static/ruoyi/system/user/edit.js b/src/main/resources/static/ruoyi/system/user/edit.js index 53b0c5760..7bee17707 100644 --- a/src/main/resources/static/ruoyi/system/user/edit.js +++ b/src/main/resources/static/ruoyi/system/user/edit.js @@ -27,9 +27,10 @@ function update() { var password = $("input[name='password']").val(); var email = $("input[name='email']").val(); var phonenumber = $("input[name='phonenumber']").val(); + var sex = $("input[name='sex']:checked").val(); var status = $("input[name='status']").is(':checked') == true ? 0 : 1; var roleIds = $.getCheckeds("role"); - var postIds = $("#post").val() + ""; + var postIds = $.getSelects("post"); $.ajax({ cache : true, type : "POST", @@ -41,6 +42,7 @@ function update() { "password": password, "email": email, "phonenumber": phonenumber, + "sex": sex, "status": status, "roleIds": roleIds, "postIds": postIds diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 540c376d3..edf3b6211 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -11,7 +11,7 @@ - + @@ -34,10 +34,10 @@ - RuoYi - 研发部 + [[${user.userName}]] + [[${user.dept.deptName}]] - 个人信息 + 个人信息 退出 @@ -86,7 +86,7 @@ 欢迎来到若依管理后台. - 退出 + 退出 @@ -118,7 +118,7 @@ th:src="@{/system/main}" frameborder="0" seamless> diff --git a/src/main/resources/templates/main.html b/src/main/resources/templates/main.html index 7348e9ea2..e31656638 100644 --- a/src/main/resources/templates/main.html +++ b/src/main/resources/templates/main.html @@ -35,7 +35,7 @@ 若依后台管理框架 一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了若依管理系统。,她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。 - 当前版本: + 当前版本:v[[${version}]] ¥免费开源 diff --git a/src/main/resources/templates/system/user/add.html b/src/main/resources/templates/system/user/add.html index f7daaa753..4dfe56291 100644 --- a/src/main/resources/templates/system/user/add.html +++ b/src/main/resources/templates/system/user/add.html @@ -36,7 +36,7 @@ 邮箱: - + @@ -45,6 +45,19 @@ + + 性别: + + + + 男 + + + + 女 + + + 状态: diff --git a/src/main/resources/templates/system/user/edit.html b/src/main/resources/templates/system/user/edit.html index 48eef5f53..436bb5f2b 100644 --- a/src/main/resources/templates/system/user/edit.html +++ b/src/main/resources/templates/system/user/edit.html @@ -31,7 +31,7 @@ 邮箱: - + @@ -40,6 +40,19 @@ + + 性别: + + + + 男 + + + + 女 + + + 状态: diff --git a/src/main/resources/templates/system/user/profile.html b/src/main/resources/templates/system/user/profile.html index 43295314e..e86f603f1 100644 --- a/src/main/resources/templates/system/user/profile.html +++ b/src/main/resources/templates/system/user/profile.html @@ -18,23 +18,35 @@ - 个人资料 + 个人信息 + + + + + + + 修改信息 + 修改头像 + 修改密码 + + + - + CEO - admin - 若依 / 管理员 - 15888888888 - 开发一部 / 初级开发 - 女 - ruoyi@163.com - 2018-05-20 13:14:00 + [[${user.loginName}]] + [[${user.userName}]] / [[${#strings.defaultString(roleGroup,'无角色')}]] + [[${user.phonenumber}]] + [[${user.dept.deptName}]] / [[${#strings.defaultString(postGroup,'无岗位')}]] + [[${user.sex}]] + [[${user.email}]] + [[${user.createTime}]] @@ -43,7 +55,23 @@ - - + + +
一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了若依管理系统。,她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。
- 当前版本: + 当前版本:v[[${version}]]
¥免费开源 diff --git a/src/main/resources/templates/system/user/add.html b/src/main/resources/templates/system/user/add.html index f7daaa753..4dfe56291 100644 --- a/src/main/resources/templates/system/user/add.html +++ b/src/main/resources/templates/system/user/add.html @@ -36,7 +36,7 @@
若依 / 管理员
15888888888
开发一部 / 初级开发
女
ruoyi@163.com
2018-05-20 13:14:00
[[${user.userName}]] / [[${#strings.defaultString(roleGroup,'无角色')}]] +
[[${user.phonenumber}]]
[[${user.dept.deptName}]] / [[${#strings.defaultString(postGroup,'无岗位')}]]
[[${user.sex}]]
[[${user.email}]]
[[${user.createTime}]]