springboot+mybetis实验报告
中北⼤学软件学院
实验报告
专 业:软件⼯程
⽅ 向:X⽅向
课程名称:JavaEE框架与应⽤开发
班 级:
学 号:
姓 名:
辅导教师:董晓丽
2021年9⽉制
成绩:
实验时间年 ⽉ ⽇ 时⾄ 时学时数4学时
1. 实验名称
Spring Boot2整合Mybatis框架
2.实验⽬的
1)掌握Spring Boot2集成Mybatis框架⽅法
2)掌握Spring Boot2简单实践应⽤
3.实验内容
图书信息管理⼦系统,功能包括:1)⽤户注册、登录功能;2)管理员⽤户:图书信息的增、删、改、查,⽂件上传;普通⽤户:图书信息查询(单条件查询、多条件查询)。要求:1)后台采⽤数据库存储技术;2)前台采⽤视图技术;3)所有类、变量命名遵循课上要求的命名规则;4)U+平台按时提交实验报告与软件作品源代码。
4.⽂件描述:
nuczmfspringboot.ller//控制层
nuczmfspringboot.ller.ControllerByM_zmf_1913040848//管理员管理控制类
nuczmfspringboot.ller.ControllerByMaide_zmf_1913040848// 管理员登录控制类
nuczmfspringboot.ller.ControllerByU_zmf_1913040848//⽤户管理控制类
nuczmfspringboot.ller.Controllerbyuser_zmf_1913040848//⽤户登录注册控制类
nuczmfspringboot.ller.ControllerByusers_zmf_1913040848//⽤户个⼈中⼼控制类
nuczmfspringboot.sb_book20211007.Dao//持久层
nuczmfspringboot.sb_book20211007.Dao.IMaideDao_zmf_1913040848//管理员模型持久类
nuczmfspringboot.sb_book20211007.Dao.IUBookDao_zmf_1913040848//⽤户购买图书持久类
nuczmfspringboot.sb_book20211007.Dao.IUserDao_zmf_1913040848//⽤户持久类
nuczmfspringboot.sb_book20211007.Dao.IZBookDao_zmf_1913040848//总图书持久类
nuczmfspringboot.ily//模型层
nuczmfspringboot.ily.Maide_zmf_1913040848//管理员模型类
nuczmfspringboot.ily.UBook_zmf_1913040848//⽤户购买图书模型类
nuczmfspringboot.ily.User_zmf_1913040848//⽤户模型类
nuczmfspringboot.ily.Zbook_zmf_1913040848//总图书模型类
nuczmfspringboot.sb_book20211007.Service//服务层
nuczmfspringboot.sb_book20211007.Service.IMaideService_zmf_1913040848//管理员服务层接⼝
nuczmfspringboot.sb_book20211007.Service.impl.MapperServiceZmf1913040848Impl//管理员实现类
nuczmfspringboot.sb_book20211007.Service.IUBookService_zmf_1913040848⽤户购买图书服务接⼝
nuczmfspringboot.sb_book20211007.Service.impl.UBookServiceZmf1913040848Impl⽤户购买图书实现类
nuczmfspringboot.sb_book20211007.Service.IUserService_zmf_1913040848⽤户服务接⼝
nuczmfspringboot.sb_book20211007.Service.impl.UserServiceZmf1913040848Impl⽤户实现类
nuczmfspringboot.sb_book20211007.Service.IZBookService_zmf_1913040848总图书服务接⼝
nuczmfspringboot.sb_book20211007.Service.impl.ZBookServiceZmf1913040848Impl总图书实现类
nuczmfspringboot.sb_book20211007.SbBook20211007Application//主函数类
mybatis⽂件夹
l//mybatis配置⽂件
mybatis/mapper/MaideMapper_l//管理员配置⽂件
mybatis/mapper/UBookMapper_l//⽤户购买图书配置⽂件
mybatis/mapper/UserMapper_l//⽤户配置⽂件中
mybatis/mapper/ZBookMappper_l//总图书配置⽂件
static.css//css
static.jpg//图⽚
static.jquery-easyui-1.8.6//easyui框架
webapp\WEB_INF\jsp\book//图书jsp页⾯
\webapp\WEB_INF\jsp\maide//管理员jsp页⾯
webapp\WEB_INF\jsp\user//⽤户jsp页⾯
5.实验源代码
l
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
<!DOCTYPE configuration
PUBLIC "-////DTD Config 3.0//EN"
"/dtd/mybatis-3-config.dtd">
<configuration>
<!-- 设置驼峰表⽰法-->
<!--
<settings>
<setting name="mapUnderscoreToCamelCase" value="true" />
</settings>
-
->
<typeAliases>
<!-- 批量导⼊基本类别名-->
<package name="nuczmfspringboot.ily"/>
</typeAliases>
</configuration>
application.properties
spring.datasource.sql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/sb_211007
spring.datasource.username=root
spring.datasource.password=123456
mybatis.mapper-locations=classpath:mybatis/mapper/*.xml
spring.jackson.serialization.indent-output=true
logging.level.nuc.edu.chapter05_mybatis1_20191125.dao=debug
spring.mvc.view.prefix=/WEB_INF/jsp/
spring.mvc.view.suffix=.jsp
server.port=8086
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="/POM/4.0.0" xmlns:xsi="/2001/XMLSchema-instance"
xsi:schemaLocation="/POM/4.0.0 /xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>nuc-zmf-springboot</groupId>
<artifactId>sb20210927</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sb20210927</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope>
</dependency>
<dependency>
<groupId>at.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId&batis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId> <version>2.1.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
nuczmfspringboot.ily.Maide_zmf_1913040848 package nuczmfspringboot.ily;/**
* ************************************************************************
* 项⽬名称: sb_book20211007 <br/>
* ⽂件名称: <br/>
* ⽂件描述: 这⾥添加您的类⽂件描述,说明当前⽂件要包含的功能。<br/>
* ⽂件创建:zmf <br/>
* 创建时间: 2021/10/31 <br/>
* 中北⼤学朱梦飞Copyright (c) All Rights Reserved. <br/>
*
* @version v1.0 <br/>
* @update [序号][⽇期YYYY-MM-DD][更改⼈姓名][变更描述]<br/>
* ************************************************************************
*/
/**
* @ProjectName : sb_book20211007
* @ClassName : Maide
* @Description : 请描述该类的功能
* @author : zmf
* @Date : 2021/10/31 16:37
* @version v1.0
* Copyright (c) All Rights Reserved,中北⼤学朱梦飞,.
*/
public class Maide_zmf_1913040848 {
private String mname_zmf_1913040848;
private String mpassword_zmf_1913040848;
public String getmname_zmf_1913040848() {
return mname_zmf_1913040848;
}
public void setmname_zmf_1913040848(String mname_zmf_1913040848) {
public void setmname_zmf_1913040848(String mname_zmf_1913040848) {
}
public String getmpassword_zmf_1913040848() {
return mpassword_zmf_1913040848;
}
public void setmpassword_zmf_1913040848(String mpassword_zmf_1913040848) {
this.mpassword_zmf_1913040848 = mpassword_zmf_1913040848;
}
public Maide_zmf_1913040848(String mname_zmf_1913040848, String mpassword_zmf_1913040848) { ame_zmf_1913040848 = mname_zmf_1913040848;
this.mpassword_zmf_1913040848 = mpassword_zmf_1913040848;
}
}
nuczmfspringboot.ily.UBook_zmf_1913040848
package nuczmfspringboot.ily;/**
* ************************************************************************
* 项⽬名称: sb_book20211007 <br/>
* ⽂件名称: <br/>
* ⽂件描述: 这⾥添加您的类⽂件描述,说明当前⽂件要包含的功能。<br/>
* ⽂件创建:zmf <br/>
* 创建时间: 2021/11/4 <br/>
* 中北⼤学朱梦飞Copyright (c) All Rights Reserved. <br/>
*
* @version v1.0 <br/>
* @update [序号][⽇期YYYY-MM-DD][更改⼈姓名][变更描述]<br/>
* ************************************************************************
*/
/**
* @ProjectName : sb_book20211007
* @ClassName : UBook
* @Description : 请描述该类的功能
* @author : zmf
springboot框架的作用* @Date : 2021/11/4 17:01
* @version v1.0
* Copyright (c) All Rights Reserved,中北⼤学朱梦飞,.
*/
public class UBook_zmf_1913040848 {
private int bid_zmf_1913040848;
private String bname_zmf_1913040848;
private String blei_zmf_1913040848;
private double bpice_zmf_1913040848;
private int bshu_zmf_1913040848;
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论