40 lines
1.3 KiB
Java
40 lines
1.3 KiB
Java
|
|
package com.yupi.springbootinit.service.impl;
|
||
|
|
|
||
|
|
import cn.hutool.crypto.SecureUtil;
|
||
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||
|
|
import com.yupi.springbootinit.model.entity.SystemUsers;
|
||
|
|
import org.springframework.beans.factory.annotation.Value;
|
||
|
|
import org.springframework.stereotype.Service;
|
||
|
|
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
|
||
|
|
import com.yupi.springbootinit.mapper.SystemUsersMapper;
|
||
|
|
import com.yupi.springbootinit.service.SystemUsersService;
|
||
|
|
|
||
|
|
import javax.annotation.Resource;
|
||
|
|
/*
|
||
|
|
* @author: ziin
|
||
|
|
* @date: 2025/6/11 20:13
|
||
|
|
*/
|
||
|
|
|
||
|
|
@Service
|
||
|
|
public class SystemUsersServiceImpl extends ServiceImpl<SystemUsersMapper,SystemUsers> implements SystemUsersService{
|
||
|
|
|
||
|
|
@Value("${md5.salt}")
|
||
|
|
private String MD5_SALT;
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public SystemUsers getUserByUserName(String username) {
|
||
|
|
QueryWrapper <SystemUsers> queryWrapper = new QueryWrapper<>();
|
||
|
|
queryWrapper.eq("username",username);
|
||
|
|
return baseMapper.selectOne(queryWrapper);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public boolean isPasswordMatch(String rawPassword, String encodedPassword) {
|
||
|
|
String s = SecureUtil.md5(MD5_SALT + rawPassword);
|
||
|
|
return s.equals(encodedPassword);
|
||
|
|
}
|
||
|
|
}
|