package com.cesgroup.homwork.mybatis.sample.mapper;

import com.cesgroup.homwork.mybatis.sample.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {

  @Insert("INSERT INTO user (id, name, context) VALUES(#{id}, #{name}, #{context})")
  void insert(User user);

  @Select("SELECT id, name, context FROM user WHERE id = #{id}")
  User findById(String id);

  @Select("SELECT id, name, context FROM user ")
  List<User> findAll();
}