package com.jiayue.insu.inclientqn.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiayue.insu.inclientqn.entity.User;
import com.jiayue.insu.inclientqn.mapper.UserMapper;
import com.jiayue.insu.inclientqn.service.UserService;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {



    @Override
    public User findByNameAndPwd(String name, String pwd) {
        LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(User::getUsername,name);
        lambdaQueryWrapper.eq(User::getPassword,pwd);
        User user = this.getOne(lambdaQueryWrapper);
        return user;
    }

    @Override
    public User findByName(String name) {
        LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(User::getUsername,name);
        User user = this.getOne(lambdaQueryWrapper);
        return user;
    }
}
