diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/WeChatLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/WeChatLoginController.java index 9040260..d6ca25d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/WeChatLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/WeChatLoginController.java @@ -11,6 +11,7 @@ import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.system.domain.vo.RegisterVo; import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysMenuService; +import com.ruoyi.system.service.ISysUserService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -33,6 +34,9 @@ public class WeChatLoginController { @Autowired private TokenService tokenService; + @Autowired + private ISysUserService sysUserService; + @Autowired private ISysDeptService iSysDeptService; @@ -61,6 +65,9 @@ public class WeChatLoginController { final SysDept sysDept = iSysDeptService.selectDeptById(user.getDeptId()); user.setDeptName(sysDept.getDeptName()); + final String userType = sysUserService.selectUserById(user.getUserId()).getUserType(); + user.setUserType(userType); + // 角色集合 Set roles = permissionService.getRolePermission(user); // 权限集合 diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index bcf3199..11558a8 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,9 +6,9 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://localhost:3306/hb_java?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://192.168.2.5:3306/hb_java?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: 123456 + password: jingke@123 # 从库数据源 slave: # 从数据源开关/默认关闭 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java index bd59319..1e1c807 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java @@ -31,6 +31,8 @@ public class SysUser extends BaseEntity @Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号") private Long userId; + private String userType; + /** 部门ID */ @Excel(name = "部门编号", type = Type.IMPORT) private Long deptId; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java index 670e6b3..f39149c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java @@ -2,6 +2,7 @@ package com.ruoyi.common.core.domain.model; import com.alibaba.fastjson2.annotation.JSONField; import com.ruoyi.common.core.domain.entity.SysUser; +import lombok.Data; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import java.util.Collection; @@ -9,9 +10,10 @@ import java.util.Set; /** * 登录用户身份权限 - * + * * @author ruoyi */ + public class LoginUser implements UserDetails { private static final long serialVersionUID = 1L; @@ -144,7 +146,7 @@ public class LoginUser implements UserDetails /** * 指定用户是否解锁,锁定的用户无法进行身份验证 - * + * * @return */ @JSONField(serialize = false) @@ -156,7 +158,7 @@ public class LoginUser implements UserDetails /** * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 - * + * * @return */ @JSONField(serialize = false) @@ -168,7 +170,7 @@ public class LoginUser implements UserDetails /** * 是否可用 ,禁用的用户不能身份验证 - * + * * @return */ @JSONField(serialize = false) diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index a4b3bd1..0a8fdd8 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -23,7 +24,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - @@ -36,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -48,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, + select u.user_id,u.user_type, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status from sys_user u @@ -153,6 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" user_name, nick_name, email, + user_type, avatar, wx_openid, phonenumber, @@ -168,6 +170,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{userName}, #{nickName}, #{email}, + #{userType}, #{avatar}, #{wxOpenid}, #{phonenumber}, @@ -187,6 +190,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" user_name = #{userName}, nick_name = #{nickName}, email = #{email}, + user_type = #{userType}, phonenumber = #{phonenumber}, sex = #{sex}, avatar = #{avatar},