重构项目
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package cn.lailab.toolbox.service.impl;
|
||||
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.lailab.toolbox.beans.domain.Auth;
|
||||
import cn.lailab.toolbox.beans.domain.User;
|
||||
import cn.lailab.toolbox.mapper.AuthMapper;
|
||||
import cn.lailab.toolbox.service.AuthService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AuthServiceImpl implements AuthService {
|
||||
|
||||
// 自动注入AuthMapper
|
||||
@Autowired
|
||||
AuthMapper authMapper;
|
||||
|
||||
// 获取最新授权码
|
||||
@Override
|
||||
public String getAuthCode(User user) {
|
||||
String str_pwd = user.getPassword();
|
||||
String str_pwd_md5 = SecureUtil.md5(str_pwd).toUpperCase();
|
||||
user.setPassword(str_pwd_md5);
|
||||
return authMapper.getAuthCode(user);
|
||||
}
|
||||
|
||||
// 获取最新MD5授权码
|
||||
@Override
|
||||
public String getAuthMd5Code(User user) {
|
||||
String str_pwd = user.getPassword();
|
||||
String str_pwd_md5 = SecureUtil.md5(str_pwd).toUpperCase();
|
||||
user.setPassword(str_pwd_md5);
|
||||
return authMapper.getAuthMd5Code(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthMd5CodeInside() {
|
||||
return authMapper.getAuthMd5CodeInside();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addUseCount(String auth_code) {
|
||||
return authMapper.addUseCount(auth_code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addAuth(Auth auth) {
|
||||
return authMapper.addAuth(auth);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user