1. 程式人生 > >eclipse中新增mybatis的xml模板

eclipse中新增mybatis的xml模板

在專案開發中,使用mybatis,需要新增 mapper.xml檔案(當然可以通過自動生成,這裡說的是不自動生成的情況下),沒有固定的模板,在工具中自己新增模板。
1:開啟 window–>Preferences–>xml–>xml files–>templates–>new
在這裡插入圖片描述
2:new
在這裡插入圖片描述

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
  PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="***Mapper" >
</mapper>

3:使用
在mapper.xml檔案中,alt+/提示,選擇mapper。
在這裡插入圖片描述
在這裡插入圖片描述