diff --git a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java index 4303d84..5a4587b 100644 --- a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java +++ b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java @@ -521,21 +521,24 @@ public class UserInfoController { * 更新登录次数和时间 */ @PostMapping("/updateLogInNumber") - Response updateLogInNumber(@RequestBody UserM user) { + Response updateLogInNumber(@RequestBody UserInfo user) { Response resp = new Response(); Integer userId = user.getUserId(); - String phone = user.getPhone(); - Integer accountRole = user.getAccountRole(); +// String phone = user.getPhone(); +// String roleId = user.getRoleId(); if (userId==null) { resp.setStatus(300); resp.setErrmessage("用户id不能为空!"); - }else if(phone==null||phone==""){ - resp.setStatus(300); - resp.setErrmessage("用户电话不能为空!"); - } else if(accountRole==null){ - resp.setStatus(300); - resp.setErrmessage("用户角色不能为空!"); - } else { + }else +// if(phone==null||phone==""){ +// resp.setStatus(300); +// resp.setErrmessage("用户电话不能为空!"); +// } else +// if(roleId==null){ +// resp.setStatus(300); +// resp.setErrmessage("用户角色不能为空!"); +// } else + { HashMap ret = userInfoService.updateLogInNumber(user); int status = (int) ret.get("retcode"); if (200 == status) { diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java index 13b0987..397525f 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java @@ -262,16 +262,16 @@ public interface UserInfoMapper { void updateUserAvatars(@Param("userAvatars") String userAvatars, @Param("userId") Integer userId); //更新用户登录次数和最后一次登录时间 - @Update({"UPDATE user SET logInNumber=logInNumber+1, lastTimeOfLanding=now() WHERE userId=#{userId}"}) - void updateLogInNumber(UserM user); + @Update({"UPDATE hr_user_info SET logInNumber=logInNumber+1, lastLoginTime=now() WHERE userId=#{userId}"}) + void updateLogInNumber(UserInfo user); //更新学生登录次数和最后一次登录时间 - @Update({"UPDATE student SET logInNumber=logInNumber+1, lastLoginTime=now() WHERE phone=#{phone}"}) - void updateStudentLogInNumber(UserM user); + @Update({"UPDATE student SET logInNumber=logInNumber+1, lastLoginTime=now() WHERE userId=#{userId}"}) + void updateStudentLogInNumber(UserInfo user); //更新员工登录次数和最后一次登录时间 - @Update({"UPDATE staff SET logNumber=logNumber+1, lastTimeOfLanding=now() WHERE phone=#{phone}"}) - void updateStaffLogInNumber(UserM user); + @Update({"UPDATE staff SET loginNumber=loginNumber+1, lastLoginTime=now() WHERE userId=#{userId}"}) + void updateStaffLogInNumber(UserInfo user); //查询账号是否存在 @Select("SELECT account,email,userName,userId,uniqueIdentificationAccount,phone from hr_user_info where isdel = 0 and account = #{account}") @@ -340,4 +340,7 @@ public interface UserInfoMapper { @Select("SELECT disableAccount FROM hr_user_info WHERE schoolId = #{schoolId} AND account = #{account} and isdel = 0") Integer queryDisableAccount(UserInfo userInfo); + + @Select("select roleId from hr_user_info where userId = #{userId}") + UserInfo queryUser(UserInfo user); } \ No newline at end of file diff --git a/src/main/java/com/yipin/liuwanr/service/UserInfoService.java b/src/main/java/com/yipin/liuwanr/service/UserInfoService.java index da13266..42c54d6 100644 --- a/src/main/java/com/yipin/liuwanr/service/UserInfoService.java +++ b/src/main/java/com/yipin/liuwanr/service/UserInfoService.java @@ -611,16 +611,18 @@ public class UserInfoService { } //更新登录次数和时间 - public HashMap updateLogInNumber(UserM user){ + public HashMap updateLogInNumber(UserInfo user){ HashMap resp = new HashMap(); try { - Integer accountRole = user.getAccountRole(); +// String roleId = user.getRoleId(); userInfoMapper.updateLogInNumber(user); - if (accountRole==3){ + UserInfo userInfo = userInfoMapper.queryUser(user); + String roleId = userInfo.getRoleId(); + if (roleId.contains("3")|roleId.contains("2")){ //更新员工登录次数和时间 userInfoMapper.updateStaffLogInNumber(user); } - if (accountRole==4){ + if (roleId.contains("4")){ //更新学生登录次数和时间 userInfoMapper.updateStudentLogInNumber(user); }