0 文件路径图
image1 sql(src\main\mysql\c_customer.sql)
首先找到 sql 文件
image得到结果
image2 编写 sqlMapConfig.xml(src\main\resources\sqlMapConfig.xml)
这是一个 mybatis 的配置文件,他的作用是连接数据库以及找到相应的 xml 文件
image3 编写实体类(src\main\java\com\buer\domain\Customer.java)
实体类与数据库字段对应
image4 编写 CustomerMapper (src\main\java\com\buer\dao\CustomerMapper.java)
image5 编写 CustomerMapper.xml (src\main\resources\CustomerMapper.xml)
image6 测试 (src\test\java\com\com.buer\Test.java)
image7 结果
执行 src\test\java\com\com.buer\Test.java 的测试方法,得到结果
image
网友评论