员工状态枚举

This commit is contained in:
attiya 2025-09-09 09:21:53 +08:00
parent eb6be970fe
commit f66fe430f6
2 changed files with 15 additions and 2 deletions

View File

@ -0,0 +1,12 @@
package com.cdzy.staff.enums;
/**
* @author attiya
* @since 2025-09-09
*/
public interface StaffStatus {
int ENABLE = 1;
int DISABLE = 2;
}

View File

@ -3,6 +3,7 @@ package com.cdzy.staff.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import com.cdzy.common.ex.EbikeException;
import com.cdzy.common.utils.SHA256WithSaltUtil;
import com.cdzy.staff.enums.StaffStatus;
import com.cdzy.staff.mapper.EbikeStaffRoleMapper;
import com.cdzy.staff.model.dto.StaffInfo;
import com.cdzy.staff.model.entity.EbikeOperatorStaff;
@ -51,7 +52,7 @@ public class EbikeOperatorStaffServiceImpl extends ServiceImpl<EbikeOperatorStaf
EbikeOperatorStaff ebikeOperatorStaff = staffMapper.selectOneByQuery(queryWrapper);
if (ebikeOperatorStaff == null) {
throw new EbikeException("用户名错误");
} else if (ebikeOperatorStaff.getStatus() == 2) {
} else if (ebikeOperatorStaff.getStatus() == StaffStatus.DISABLE) {
throw new EbikeException("该账户已被禁用");
} else {
String salt = ebikeOperatorStaff.getSalt();
@ -147,7 +148,7 @@ public class EbikeOperatorStaffServiceImpl extends ServiceImpl<EbikeOperatorStaf
ebikeOperatorStaff.setUpdateBy(StpUtil.getLoginIdAsLong());
ebikeOperatorStaff.setContactPhone(staffVo.getContactPhone());
//禁用后踢下线
if (staffVo.getStatus() == 2){
if (staffVo.getStatus() == StaffStatus.DISABLE){
StpUtil.logout(staffVo.getStaffId());
}
staffMapper.update(ebikeOperatorStaff);