public interface CustomerMapper {
List selectAll();
int insert(Customer customer);
Customer selectById(int id);
int updateRelNameById(Customer customer);
int deleteById(int id);
List selectByCondition(Customer condition);
}
5.创建mybatis映射文件
6. 加入log4J日志功能
1)加入依赖
log4j
log4j
1.2.17
2) 加入 log4j 的配置文件
2.Mybatis的增删查改
1.添加数据
insert into db_quote.tb_customer( name, tel, address, rel_name, other)
VALUES(#{name},#{tel},#{address},#{relName},#{other})
2.删除数据
delete from db_quote.tb_customer where id = #{id}
3.查询数据
select id, name, tel, address, rel_name, other
from db_quote.tb_customer
select id, name, tel, address, rel_name , other
from db_quote.tb_customer
where id = #{id}
4.修改数据
update db_quote.tb_customer
set rel_name= #{relName}
where id= #{id}