public interface DeptMapper {
    Dept findDeptByDeptno(int deptno);
    @Select("select * from dept where deptno =#{deptno}")
    Dept findByDeptno(int deptno);
    @Update("update dept set dname =#{dname}, loc =#{loc} where deptno =#{deptno}")
    int updateDept(Dept dept);
    @Insert("insert into dept values(DEFAULT,#{dname},#{loc})")
    int addDept(Dept dept);
    @Delete("delete from dept where deptno =#{deptno}")
    int removeDept(int deptno);
}
1.使用注解没有实现Java代码和SQL语句的解耦
2.无法实现SQL语句的动态拼接
3.进行多表的查询时定制ResultMap比较麻烦
注解和XML的优缺点










