更改user为sysUser
parent
dcb06ca323
commit
717d01b066
|
@ -137,13 +137,6 @@
|
|||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -127,21 +127,21 @@ public class SysUserController extends BaseController
|
|||
public Result<LoginUser> emailInfo(@PathVariable("email") String email){
|
||||
System.out.println("收到请求邮箱是:"+email);
|
||||
//先根据邮箱查询有无此人user
|
||||
User user=userService.selectByEmail(email);
|
||||
if (StringUtils.isNull(user)){
|
||||
SysUser sysUser = userService.selectByEmail(email);
|
||||
if (StringUtils.isNull(sysUser)){
|
||||
return Result.error("邮箱不存在");
|
||||
}
|
||||
//查询该用户下的所有角色
|
||||
Set<String> roles=permissionService.getEmailRolePermission(user);
|
||||
Set<String> roles=permissionService.getEmailRolePermission(sysUser);
|
||||
LoginUser loginUserVo = new LoginUser();
|
||||
loginUserVo.setUser(user);
|
||||
loginUserVo.setSysUser(sysUser);
|
||||
loginUserVo.setRoles(roles);
|
||||
if (roles.contains("患者")){
|
||||
Patient patient=userService.selectPatient(user.getUserId());
|
||||
Patient patient=userService.selectPatient(sysUser.getUserId());
|
||||
System.out.println(patient);
|
||||
loginUserVo.setPatient(patient);
|
||||
}else{
|
||||
Doctor doctor=userService.selectDoctor(user.getUserId());
|
||||
Doctor doctor=userService.selectDoctor(sysUser.getUserId());
|
||||
System.out.println(doctor);
|
||||
loginUserVo.setDoctor(doctor);
|
||||
}
|
||||
|
@ -220,27 +220,26 @@ public class SysUserController extends BaseController
|
|||
System.out.println("当前登录人是:"+SecurityUtils.getLoginUser());
|
||||
System.out.println("userId是"+SecurityUtils.getUserId());
|
||||
//---------------------------------------------------------------
|
||||
User user=userService.selectUserByUserId(SecurityUtils.getUserId());
|
||||
Doctor doctor = userService.selectDoctor(SecurityUtils.getUserId().intValue());
|
||||
Patient patient = userService.selectPatient(SecurityUtils.getUserId().intValue());
|
||||
SysUser sysUser= userService.selectUserByUserId(SecurityUtils.getUserId());
|
||||
Doctor doctor = userService.selectDoctor(SecurityUtils.getUserId());
|
||||
Patient patient = userService.selectPatient(SecurityUtils.getUserId());
|
||||
//-------------------------------------------------------------------------
|
||||
// SysUser user = userService.selectUserById(SecurityUtils.getUserId());
|
||||
System.out.println();
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getEmailRolePermission(user);
|
||||
Set<String> roles = permissionService.getEmailRolePermission(sysUser);
|
||||
// 权限集合
|
||||
// Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
Result result = Result.success();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
//user
|
||||
map.put("user", user);
|
||||
//sysUser
|
||||
map.put("susUser", sysUser);
|
||||
//roles
|
||||
map.put("roles", roles);
|
||||
//doctor
|
||||
map.put("doctor",doctor);
|
||||
//patient
|
||||
map.put("patient",patient);
|
||||
// map.put("permissions", permissions);
|
||||
result.setData(map);
|
||||
return result;
|
||||
}
|
||||
|
@ -361,10 +360,13 @@ public class SysUserController extends BaseController
|
|||
* @author 冯凯
|
||||
* @date: 2023/10/27 14:02
|
||||
*/
|
||||
// public Result resentPwd(@RequestBody User user){
|
||||
// userService.checkUserIfAllowed(user);
|
||||
// user.setPwd1();
|
||||
// }
|
||||
@PostMapping("/resentPwd")
|
||||
public Result resentPwd(@RequestBody SysUser user){
|
||||
userService.checkUserAllowed(user);
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.resetPwd(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
|
|
|
@ -109,5 +109,5 @@ public interface SysRoleMapper {
|
|||
public int deleteRoleByIds(Long[] roleIds);
|
||||
|
||||
//0---------------------------------------------------------------
|
||||
List<String> selectEmailRoleByUserId(@Param("userId") Integer userId);
|
||||
List<String> selectEmailRoleByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,14 @@ public interface SysUserMapper {
|
|||
public SysUser selectUserByUserName(String userName);
|
||||
|
||||
//-----------------------------------------------------------
|
||||
User selectUserByUserEmail(@Param("email") String email);
|
||||
/**
|
||||
* @description: 根据邮箱获取sysUser对象
|
||||
* @param: * @param email
|
||||
* @return: SysUser
|
||||
* @author 冯凯
|
||||
* @date: 2023/10/28 10:47
|
||||
*/
|
||||
SysUser selectUserByUserEmail(@Param("email") String email);
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
|
@ -150,7 +157,14 @@ public interface SysUserMapper {
|
|||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
User selectUserByUserId(@Param("userId1") int userId1);
|
||||
/**
|
||||
* @description: 根据当前登录userId来获取当前登录人信息
|
||||
* @param: * @param userId1
|
||||
* @return: SysUser
|
||||
* @author 冯凯
|
||||
* @date: 2023/10/28 10:56
|
||||
*/
|
||||
SysUser selectUserByUserId(@Param("userId1") Long userId1);
|
||||
|
||||
|
||||
int updPasswordByEmail(User user);
|
||||
|
@ -168,9 +182,9 @@ public interface SysUserMapper {
|
|||
|
||||
void insertPatient(Patient patient1);
|
||||
|
||||
Patient selectPatient(@Param("userId") Integer userId);
|
||||
Patient selectPatient(@Param("userId") Long userId);
|
||||
|
||||
Doctor selectDoctor(@Param("userId") Integer userId);
|
||||
Doctor selectDoctor(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* @description: 核对邮箱是否已经注册过
|
||||
|
|
|
@ -29,5 +29,5 @@ public interface ISysPermissionService {
|
|||
public Set<String> getMenuPermission(SysUser user);
|
||||
|
||||
//---------------------------------
|
||||
Set<String> getEmailRolePermission(User user);
|
||||
Set<String> getEmailRolePermission(SysUser sysUser);
|
||||
}
|
||||
|
|
|
@ -175,5 +175,5 @@ public interface ISysRoleService {
|
|||
public int insertAuthUsers(Long roleId, Long[] userIds);
|
||||
|
||||
//-----------------------------------------------------------
|
||||
Set<String> selectEmailRoleByUserId(Integer userId);
|
||||
Set<String> selectEmailRoleByUserId(Long userId);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public interface ISysUserService
|
|||
|
||||
|
||||
//-------------------------
|
||||
User selectByEmail(String email);
|
||||
SysUser selectByEmail(String email);
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
|
@ -215,7 +215,7 @@ public interface ISysUserService
|
|||
|
||||
|
||||
|
||||
User selectUserByUserId(Long userId);
|
||||
SysUser selectUserByUserId(Long userId);
|
||||
|
||||
int updPasswordByEmail(User user);
|
||||
|
||||
|
@ -226,9 +226,9 @@ public interface ISysUserService
|
|||
Boolean registerPatient(Patient patient);
|
||||
|
||||
//------------------查询患者信息
|
||||
Patient selectPatient(Integer userId);
|
||||
Patient selectPatient(Long userId);
|
||||
//------------------------------查询医生信息
|
||||
Doctor selectDoctor(Integer userId);
|
||||
Doctor selectDoctor(Long userId);
|
||||
|
||||
void checkEmail(String email);
|
||||
}
|
||||
|
|
|
@ -50,9 +50,9 @@ public class SysPermissionServiceImpl implements ISysPermissionService {
|
|||
//--------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Set<String> getEmailRolePermission(User user) {
|
||||
public Set<String> getEmailRolePermission(SysUser sysUser) {
|
||||
HashSet<String> roles = new HashSet<>();
|
||||
roles.addAll(roleService.selectEmailRoleByUserId(user.getUserId()));
|
||||
roles.addAll(roleService.selectEmailRoleByUserId(sysUser.getUserId()));
|
||||
return roles;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -90,7 +90,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
|||
|
||||
//-------------------------------------------------------
|
||||
@Override
|
||||
public Set<String> selectEmailRoleByUserId(Integer userId) {
|
||||
public Set<String> selectEmailRoleByUserId(Long userId) {
|
||||
List<String> roleList=roleMapper.selectEmailRoleByUserId(userId);
|
||||
System.out.println("用户角色集合是:"+roleList);
|
||||
HashSet<String> roleSet = new HashSet<>();
|
||||
|
|
|
@ -586,16 +586,22 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
//----------------------------------------------------
|
||||
@Override
|
||||
public User selectByEmail(String email) {
|
||||
User user= userMapper.selectUserByUserEmail(email);
|
||||
return user;
|
||||
public SysUser selectByEmail(String email) {
|
||||
SysUser sysUser = userMapper.selectUserByUserEmail(email);
|
||||
return sysUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 根据当前登录人userId来获取sysUser对象
|
||||
* @param: * @param userId
|
||||
* @return: SysUser
|
||||
* @author 冯凯
|
||||
* @date: 2023/10/28 10:54
|
||||
*/
|
||||
@Override
|
||||
public User selectUserByUserId(Long userId) {
|
||||
int userId1 = userId.intValue();
|
||||
User user= userMapper.selectUserByUserId(userId1);
|
||||
return user;
|
||||
public SysUser selectUserByUserId(Long userId) {
|
||||
SysUser sysUser= userMapper.selectUserByUserId(userId);
|
||||
return sysUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -669,15 +675,29 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
}
|
||||
|
||||
//-------------查询患者-------------------------
|
||||
/**
|
||||
* @description: 根据当前登录人userId来关联patient表来获取患者信息
|
||||
* @param: * @param userId
|
||||
* @return: Patient
|
||||
* @author 冯凯
|
||||
* @date: 2023/10/28 10:58
|
||||
*/
|
||||
@Override
|
||||
public Patient selectPatient(Integer userId) {
|
||||
public Patient selectPatient(Long userId) {
|
||||
|
||||
return userMapper.selectPatient(userId);
|
||||
}
|
||||
|
||||
//------------查询医生---------------------------
|
||||
/**
|
||||
* @description: 根据当前登录人userId来关联doctor表来获取医生信息
|
||||
* @param: * @param userId
|
||||
* @return: Patient
|
||||
* @author 冯凯
|
||||
* @date: 2023/10/28 10:58
|
||||
*/
|
||||
@Override
|
||||
public Doctor selectDoctor(Integer userId) {
|
||||
public Doctor selectDoctor(Long userId) {
|
||||
return userMapper.selectDoctor(userId);
|
||||
}
|
||||
|
||||
|
|
|
@ -145,11 +145,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
|
||||
<select id="selectUserByUserEmail" resultType="com.health.system.common.domain.User">
|
||||
select * from tb_user where email=#{email}
|
||||
</select>
|
||||
<select id="selectUserByUserId" resultType="com.health.system.common.domain.User">
|
||||
select * from tb_user where user_id=#{userId1}
|
||||
|
||||
<select id="selectUserByUserId" resultType="com.health.system.common.domain.SysUser">
|
||||
select * from sys_user where user_id=#{userId1}
|
||||
</select>
|
||||
<select id="selectPatient" resultType="com.health.system.common.domain.Patient">
|
||||
select * from tb_patient where patient_id=#{userId}
|
||||
|
@ -157,7 +155,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectDoctor" resultType="com.health.system.common.domain.Doctor">
|
||||
select * from tb_doctor where doctor_id=#{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectUserByUserEmail" resultType="com.health.system.common.domain.SysUser">
|
||||
select * from sys_user where email=#{email}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
|
|
Loading…
Reference in New Issue