Mapped Statements collection already contains value for mybatis.MybatisUserDao.getUser
阿新 • • 發佈:2018-11-15
1.當使用
package mybatis; import java.util.List; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; public interface MybatisUserDao { @Results({ @Result(property = "id", column = "id"), @Result(property = "firstName", column = "first_name"), @Result(property = "lastName", column = "last_name") } ) @Select("select * from user where firt_name=#{firstName}") public User getUser(String firstName); @Results({ @Result(property = "id", column = "id"), @Result(property = "firstName", column = "first_name"), @Result(property = "lastName", column = "last_name") } ) @Select("Select * from user") public List<User> getUser(); //函式名稱不能重複,此處的函式名更像是mapper中的id, //唯一,不可重複;不能把它看作是函式的“過載”; }