第四天
数据层--通过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);
}
?