package cn.star.dao; import cn.star.domian.Users; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import java.util.List; @Repository//注入dao数据 //这里是创建一个数据访问层UserDao接口 public interface UsersDao { //查询所有用户 @Select("select * from users") public List findUsers(); //用户注册 @Insert("INSERT INTO USERS (username,password) VALUES(#{username},#{password})") public void insertUsers(Users users); //用户登录 @Select("select * from users where username=#{username} and password=#{password}") public Users login(Users users); }