JAVA全栈第四天(Mybatis Mapper)

亦余心之所善兮,虽九死其犹未悔。这篇文章主要讲述JAVA全栈第四天:Mybatis Mapper相关的知识,希望能为你提供帮助。
第四天数据层--通过java代码来实现对数据库中数据的操作(增删改查)
JDBC
mybatis--mapper包名
接口:
静态常量 public static final
抽象方法 void f1();
Mybatis 的Mapper层(dao层)创建

  @Mapper
  public interface DepartmentMapper {
  //增
  @Insert("insert into department(code,name,tel)valus(#{code},#{name},#{tel})")
  int insert(DepartmentModel model);
  //删
  @Delete("delete from department where code=#{code}")
  int delete(DepartmentModel model);
  //改
  @Update("update department set name=#{name},tel=#{tel} where code=#{code}")
  int update(DepartmentModel model);
      //查询所有
      @Select("select name,code,tel from department")
  DepartmentModel selectModel(DepartmentModel model);
  //模糊查询
  @Select("select name,code,tel from department where name like #{name}")
  List< DepartmentModel> selectList(DepartmentModel model);
  }
  ?

【JAVA全栈第四天(Mybatis Mapper)】 

    推荐阅读