尚筹网:数据库逆向工程以及显示页面

创建模型

CREATE TABLE t_role (
	`id` INT (11) NOT NULL auto_increment,
	`name` VARCHAR (255),
	PRIMARY KEY (id)
);

逆向工程

1、修改/atcrowdfunding-reverse/src/main/resources/generatorConfig.xml

<table tableName="t_role" domainObjectName="Role" />

选择pom.xml----》 Run as —》 Maven build … —》将Goal的值设置为:mybatis-generator:generate----》Run

2、调整Role.java:生成无参构造器、有参构造器和toString方法

3、逆向工程生成的资源各归各位

  • 将atcrowdfunding-reverse/src/main/java目录下的com.atguigu.crowd.funding.entity包调整到atcrowdfunding-admin-4-entity模块的/src/main/java下

  • atcrowdfunding-reverse/src/main/java目录下的com.atguigu.crowd.funding.mapper包放到component模块的/src/main/java下

  • atcrowdfunding-admin-1-webui/src/main/resources/mybatis/mapper目录,然后将com.atguigu.crowd.funding.mapper包的AdminMapper.xml放在atcrowdfunding-admin-1-webui模块的/src/main/resources下

创建组件

在这里插入图片描述

前往角色维护页面

在这里插入图片描述
在/atcrowdfunding-admin-1-webui/src/main/webapp/WEB-INF/include-sidebar.jsp修改角色维护超链接

							<li style="height:30px;">
								<a href="role/to/page.html"><i class="glyphicon glyphicon-king"></i> 角色维护</a> 
							</li>

在spring-web-mvc.xml文件中配置view-controller

<mvc:view-controller path="/role/to/page.html" view-name="role-page"/>

创建/atcrowdfunding-admin-1-webui/src/main/webapp/WEB-INF/role-page.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="UTF-8">
<%@ include file="/WEB-INF/include-head.jsp"%>
<body>

	<%@ include file="/WEB-INF/include-nav.jsp"%>
	<div class="container-fluid">
		<div class="row">
			<%@ include file="/WEB-INF/include-sidebar.jsp"%>
			<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
				<div class="panel panel-default">
					<div class="panel-heading">
						<h3 class="panel-title">
							<i class="glyphicon glyphicon-th"></i> 数据列表
						</h3>
					</div>
					<div class="panel-body">
						<form class="form-inline" role="form" style="float: left;">
							<div class="form-group has-feedback">
								<div class="input-group">
									<div class="input-group-addon">查询条件</div>
									<input class="form-control has-success" type="text"
										placeholder="请输入查询条件">
								</div>
							</div>
							<button type="button" class="btn btn-warning">
								<i class="glyphicon glyphicon-search"></i> 查询
							</button>
						</form>
						<button type="button" class="btn btn-danger"
							style="float: right; margin-left: 10px;">
							<i class=" glyphicon glyphicon-remove"></i> 删除
						</button>
						<button type="button" class="btn btn-primary"
							style="float: right;" onclick="window.location.href='form.html'">
							<i class="glyphicon glyphicon-plus"></i> 新增
						</button>
						<br>
						<hr style="clear: both;">
						<div class="table-responsive">
							<table class="table  table-bordered">
								<thead>
									<tr>
										<th width="30">#</th>
										<th width="30"><input type="checkbox"></th>
										<th>名称</th>
										<th width="100">操作</th>
									</tr>
								</thead>
								<tbody>
									<tr>
										<td>1</td>
										<td><input type="checkbox"></td>
										<td>PM - 项目经理</td>
										<td>
											<button type="button" class="btn btn-success btn-xs">
												<i class=" glyphicon glyphicon-check"></i>
											</button>
											<button type="button" class="btn btn-primary btn-xs">
												<i class=" glyphicon glyphicon-pencil"></i>
											</button>
											<button type="button" class="btn btn-danger btn-xs">
												<i class=" glyphicon glyphicon-remove"></i>
											</button>
										</td>
									</tr>
								</tbody>
								<tfoot>
									<tr>
										<td colspan="6" align="center">
											<ul class="pagination">
												<li class="disabled"><a href="#">上一页</a></li>
												<li class="active"><a href="#">1 <span
														class="sr-only">(current)</span></a></li>
												<li><a href="#">2</a></li>
												<li><a href="#">3</a></li>
												<li><a href="#">4</a></li>
												<li><a href="#">5</a></li>
												<li><a href="#">下一页</a></li>
											</ul>
										</td>
									</tr>

								</tfoot>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值