package com.test.mapper;

import com.test.bean.Admin;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;

@Mapper
public interface AdminMapper {

    @Insert("insert into admin_info(username, password, name, phone, department, email, create_time, update_time) VALUE (#{username}, #{password}, #{name}, #{phone}, #{department}, #{email}, #{createTime}, #{updateTime})")
    public boolean addAdmin(Admin admin);

    @Select("select * from admin_info where admin_id=#{id}")
    public Admin getAdminById(int id);


    @Select("select * from admin_info")
    public ArrayList<Admin> getAllAdmin();

    @Select("select admin_id,username,name,gender,phone,department,email from admin_info where username=#{username} and password=#{password}")
    public Admin doLogin(String username, String password);
}
