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);
}
![](/i/l/?n=23&i=blog/3073776/202302/3073776-20230225130138713-160551677.gif)
![点击并拖拽以移动](/i/l/?n=23&i=blog/3073776/202302/3073776-20230225130138713-160551677.gif)
1.使用注解没有实现Java代码和SQL语句的解耦
2.无法实现SQL语句的动态拼接
3.进行多表的查询时定制ResultMap比较麻烦
注解和XML的优缺点
标签:loc,Dept,int,dept,开发,MyBatis,注解,deptno From: https://www.cnblogs.com/2324hh/p/17154189.html