修改登录

master
mzh820631607 4 years ago
parent 2ab06db4f8
commit ee48315916
  1. 23
      src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
  2. 15
      src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
  3. 10
      src/main/java/com/yipin/liuwanr/service/UserInfoService.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<String, Object> ret = userInfoService.updateLogInNumber(user);
int status = (int) ret.get("retcode");
if (200 == status) {

@ -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);
}

@ -611,16 +611,18 @@ public class UserInfoService {
}
//更新登录次数和时间
public HashMap<String, Object> updateLogInNumber(UserM user){
public HashMap<String, Object> updateLogInNumber(UserInfo user){
HashMap<String, Object> resp = new HashMap<String, Object>();
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);
}

Loading…
Cancel
Save