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

import com.cesgroup.homwork.mybatis.sample.entity.City;
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 CityMapper {

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

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

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