package com.test.service.impl;

import com.test.bean.Admin;
import com.test.mapper.AdminMapper;
import com.test.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    AdminMapper adminMapper;

    @Override
    public Admin getAdminById(int id) {
        return adminMapper.getAdminById(id);
    }

    @Override
    public boolean addAdmin(Admin admin) {
        admin.setCreateTime(LocalDateTime.now());
        admin.setUpdateTime(LocalDateTime.now());
        return adminMapper.addAdmin(admin);
    }

    @Override
    public Admin doLogin(String username, String password) {
        return adminMapper.doLogin(username, password);
    }
}
