1.修改配置文件generatorConfig.xml,逆向工程生成dao
<table tableName="student" domainObjectName="Student"></table>
2.maven compile
3.注释掉generatorConfig.xml中如下标签
<!-- <table tableName="student" domainObjectName="Student"></table> -->
<table tableName="aaa" domainObjectName="aaa"></table>
4.修改model 的Example,继承BaseModelExample,实现分页
public class StudentExample extends BaseModelExample
5.修改mapper.xml文件,增加limit
<select id="selectByExample" parameterType="wang.doug.frame.model.StudentExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from student
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="rowIndex != null and pageSize != null and pageSize > 0">
limit #{rowIndex},#{pageSize}
</if>
</select>
6.写service
CTRL+R
使用模板复制一份,查找替换。将School替换为Student,school替换为student
数据库中tinyint改int再重新启用逆向工程,name改RealName,int改String,删WithBLOBs,把错误的地方
注释。。。等等,注意实现类的错误改了,相对应的,接口的错误也要改了。
7.写Controller
使用模板复制一份,查找替换。将School替换为Student,school替换为student
8.resources/templates 页面需要修改四个文件
修改js/index_js.html中的bootstrapTable的列
修改new.html中表单项,页面中表单元素可以到angle等bootstrap模版中查找
注意:表单元素必须要有结束标签,否则会报错!
9.resources/common/left.html 增加菜单链接
<li>
<a href="/student/index.html">
<span>学生</span>
</a>
</li>
总结:
写好一个模块的功能,其他模块可以套用该模块,以实现代码的复用,减轻了工作量,在实际工作中具有非常重要的现实意义。