更改user为sysUser

master
冯凯 2023-10-28 11:01:43 +08:00
parent dcb06ca323
commit 717d01b066
11 changed files with 82 additions and 53 deletions

View File

@ -137,13 +137,6 @@
<skip>true</skip> <skip>true</skip>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -127,21 +127,21 @@ public class SysUserController extends BaseController
public Result<LoginUser> emailInfo(@PathVariable("email") String email){ public Result<LoginUser> emailInfo(@PathVariable("email") String email){
System.out.println("收到请求邮箱是:"+email); System.out.println("收到请求邮箱是:"+email);
//先根据邮箱查询有无此人user //先根据邮箱查询有无此人user
User user=userService.selectByEmail(email); SysUser sysUser = userService.selectByEmail(email);
if (StringUtils.isNull(user)){ if (StringUtils.isNull(sysUser)){
return Result.error("邮箱不存在"); return Result.error("邮箱不存在");
} }
//查询该用户下的所有角色 //查询该用户下的所有角色
Set<String> roles=permissionService.getEmailRolePermission(user); Set<String> roles=permissionService.getEmailRolePermission(sysUser);
LoginUser loginUserVo = new LoginUser(); LoginUser loginUserVo = new LoginUser();
loginUserVo.setUser(user); loginUserVo.setSysUser(sysUser);
loginUserVo.setRoles(roles); loginUserVo.setRoles(roles);
if (roles.contains("患者")){ if (roles.contains("患者")){
Patient patient=userService.selectPatient(user.getUserId()); Patient patient=userService.selectPatient(sysUser.getUserId());
System.out.println(patient); System.out.println(patient);
loginUserVo.setPatient(patient); loginUserVo.setPatient(patient);
}else{ }else{
Doctor doctor=userService.selectDoctor(user.getUserId()); Doctor doctor=userService.selectDoctor(sysUser.getUserId());
System.out.println(doctor); System.out.println(doctor);
loginUserVo.setDoctor(doctor); loginUserVo.setDoctor(doctor);
} }
@ -220,27 +220,26 @@ public class SysUserController extends BaseController
System.out.println("当前登录人是:"+SecurityUtils.getLoginUser()); System.out.println("当前登录人是:"+SecurityUtils.getLoginUser());
System.out.println("userId是"+SecurityUtils.getUserId()); System.out.println("userId是"+SecurityUtils.getUserId());
//--------------------------------------------------------------- //---------------------------------------------------------------
User user=userService.selectUserByUserId(SecurityUtils.getUserId()); SysUser sysUser= userService.selectUserByUserId(SecurityUtils.getUserId());
Doctor doctor = userService.selectDoctor(SecurityUtils.getUserId().intValue()); Doctor doctor = userService.selectDoctor(SecurityUtils.getUserId());
Patient patient = userService.selectPatient(SecurityUtils.getUserId().intValue()); Patient patient = userService.selectPatient(SecurityUtils.getUserId());
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// SysUser user = userService.selectUserById(SecurityUtils.getUserId()); // SysUser user = userService.selectUserById(SecurityUtils.getUserId());
System.out.println(); System.out.println();
// 角色集合 // 角色集合
Set<String> roles = permissionService.getEmailRolePermission(user); Set<String> roles = permissionService.getEmailRolePermission(sysUser);
// 权限集合 // 权限集合
// Set<String> permissions = permissionService.getMenuPermission(user); // Set<String> permissions = permissionService.getMenuPermission(user);
Result result = Result.success(); Result result = Result.success();
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
//user //sysUser
map.put("user", user); map.put("susUser", sysUser);
//roles //roles
map.put("roles", roles); map.put("roles", roles);
//doctor //doctor
map.put("doctor",doctor); map.put("doctor",doctor);
//patient //patient
map.put("patient",patient); map.put("patient",patient);
// map.put("permissions", permissions);
result.setData(map); result.setData(map);
return result; return result;
} }
@ -361,10 +360,13 @@ public class SysUserController extends BaseController
* @author * @author
* @date: 2023/10/27 14:02 * @date: 2023/10/27 14:02
*/ */
// public Result resentPwd(@RequestBody User user){ @PostMapping("/resentPwd")
// userService.checkUserIfAllowed(user); public Result resentPwd(@RequestBody SysUser user){
// user.setPwd1(); userService.checkUserAllowed(user);
// } user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.resetPwd(user));
}
/** /**
* *

View File

@ -109,5 +109,5 @@ public interface SysRoleMapper {
public int deleteRoleByIds(Long[] roleIds); public int deleteRoleByIds(Long[] roleIds);
//0--------------------------------------------------------------- //0---------------------------------------------------------------
List<String> selectEmailRoleByUserId(@Param("userId") Integer userId); List<String> selectEmailRoleByUserId(@Param("userId") Long userId);
} }

View File

@ -47,7 +47,14 @@ public interface SysUserMapper {
public SysUser selectUserByUserName(String userName); 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 * 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); int updPasswordByEmail(User user);
@ -168,9 +182,9 @@ public interface SysUserMapper {
void insertPatient(Patient patient1); 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: * @description:

View File

@ -29,5 +29,5 @@ public interface ISysPermissionService {
public Set<String> getMenuPermission(SysUser user); public Set<String> getMenuPermission(SysUser user);
//--------------------------------- //---------------------------------
Set<String> getEmailRolePermission(User user); Set<String> getEmailRolePermission(SysUser sysUser);
} }

View File

@ -175,5 +175,5 @@ public interface ISysRoleService {
public int insertAuthUsers(Long roleId, Long[] userIds); public int insertAuthUsers(Long roleId, Long[] userIds);
//----------------------------------------------------------- //-----------------------------------------------------------
Set<String> selectEmailRoleByUserId(Integer userId); Set<String> selectEmailRoleByUserId(Long userId);
} }

View File

@ -47,7 +47,7 @@ public interface ISysUserService
//------------------------- //-------------------------
User selectByEmail(String email); SysUser selectByEmail(String email);
/** /**
* ID * ID
* *
@ -215,7 +215,7 @@ public interface ISysUserService
User selectUserByUserId(Long userId); SysUser selectUserByUserId(Long userId);
int updPasswordByEmail(User user); int updPasswordByEmail(User user);
@ -226,9 +226,9 @@ public interface ISysUserService
Boolean registerPatient(Patient patient); Boolean registerPatient(Patient patient);
//------------------查询患者信息 //------------------查询患者信息
Patient selectPatient(Integer userId); Patient selectPatient(Long userId);
//------------------------------查询医生信息 //------------------------------查询医生信息
Doctor selectDoctor(Integer userId); Doctor selectDoctor(Long userId);
void checkEmail(String email); void checkEmail(String email);
} }

View File

@ -50,9 +50,9 @@ public class SysPermissionServiceImpl implements ISysPermissionService {
//-------------------------------------------------- //--------------------------------------------------
@Override @Override
public Set<String> getEmailRolePermission(User user) { public Set<String> getEmailRolePermission(SysUser sysUser) {
HashSet<String> roles = new HashSet<>(); HashSet<String> roles = new HashSet<>();
roles.addAll(roleService.selectEmailRoleByUserId(user.getUserId())); roles.addAll(roleService.selectEmailRoleByUserId(sysUser.getUserId()));
return roles; return roles;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -90,7 +90,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
//------------------------------------------------------- //-------------------------------------------------------
@Override @Override
public Set<String> selectEmailRoleByUserId(Integer userId) { public Set<String> selectEmailRoleByUserId(Long userId) {
List<String> roleList=roleMapper.selectEmailRoleByUserId(userId); List<String> roleList=roleMapper.selectEmailRoleByUserId(userId);
System.out.println("用户角色集合是:"+roleList); System.out.println("用户角色集合是:"+roleList);
HashSet<String> roleSet = new HashSet<>(); HashSet<String> roleSet = new HashSet<>();

View File

@ -586,16 +586,22 @@ public class SysUserServiceImpl implements ISysUserService
//---------------------------------------------------- //----------------------------------------------------
@Override @Override
public User selectByEmail(String email) { public SysUser selectByEmail(String email) {
User user= userMapper.selectUserByUserEmail(email); SysUser sysUser = userMapper.selectUserByUserEmail(email);
return user; return sysUser;
} }
/**
* @description: userIdsysUser
* @param: * @param userId
* @return: SysUser
* @author
* @date: 2023/10/28 10:54
*/
@Override @Override
public User selectUserByUserId(Long userId) { public SysUser selectUserByUserId(Long userId) {
int userId1 = userId.intValue(); SysUser sysUser= userMapper.selectUserByUserId(userId);
User user= userMapper.selectUserByUserId(userId1); return sysUser;
return user;
} }
@Override @Override
@ -669,15 +675,29 @@ public class SysUserServiceImpl implements ISysUserService
} }
//-------------查询患者------------------------- //-------------查询患者-------------------------
/**
* @description: userIdpatient
* @param: * @param userId
* @return: Patient
* @author
* @date: 2023/10/28 10:58
*/
@Override @Override
public Patient selectPatient(Integer userId) { public Patient selectPatient(Long userId) {
return userMapper.selectPatient(userId); return userMapper.selectPatient(userId);
} }
//------------查询医生--------------------------- //------------查询医生---------------------------
/**
* @description: userIddoctor
* @param: * @param userId
* @return: Patient
* @author
* @date: 2023/10/28 10:58
*/
@Override @Override
public Doctor selectDoctor(Integer userId) { public Doctor selectDoctor(Long userId) {
return userMapper.selectDoctor(userId); return userMapper.selectDoctor(userId);
} }

View File

@ -145,11 +145,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectUserByUserEmail" resultType="com.health.system.common.domain.User">
select * from tb_user where email=#{email} <select id="selectUserByUserId" resultType="com.health.system.common.domain.SysUser">
</select> select * from sys_user where user_id=#{userId1}
<select id="selectUserByUserId" resultType="com.health.system.common.domain.User">
select * from tb_user where user_id=#{userId1}
</select> </select>
<select id="selectPatient" resultType="com.health.system.common.domain.Patient"> <select id="selectPatient" resultType="com.health.system.common.domain.Patient">
select * from tb_patient where patient_id=#{userId} 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 id="selectDoctor" resultType="com.health.system.common.domain.Doctor">
select * from tb_doctor where doctor_id=#{userId} select * from tb_doctor where doctor_id=#{userId}
</select> </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"> <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">