寫了一個工具類,根據Entity自動生成Mapper文件、Dao文件和Impl文件
現在只支持Maven_Web項目格式
LazyUtils utils = new LazyUtils (Entity.clas)
Entity Class需要4層目錄結構 例如
com.cunchen.base.entity
對應 com.cunchen.子項目名.實體包
生成生成Dao及DaoImpl如下
/src/main/java
com.cunchen.base.dao
-BaseDao
-EntityDao
com.cunchen.base.dao.Impl
-BaseDaoImpl
-EntityDaoImpl
/src/main/resources
com.cunchen.base.mapper
-EntityMapper.xml
對應sqlSession注入名 sqlSessionForBase
之後會增加可配置擴展以及自動生成建表語句。
JAR包:鏈接:http://pan.baidu.com/s/1c2zABzM 密碼:0mah
源碼:鏈接:http://pan.baidu.com/s/1jHL2Nrw 密碼:txbq