SSM 电影后台管理项目

SSM 电影后台管理项目 概述

通过对数据库中一张表的CRUD,将相应的操作结果渲染到页面上。
笔者通过这篇博客还原了项目(当然有一些隐藏的坑),然后将该项目上传到了GithubGitee,在末尾会附上有源码地址,读者可参考。

该项目使用的是Spring+SpringMVC+Mybaits(SSM)后端架构,POJO---Dao---Service---Controller的结构,简单易懂。

POJO:实体类层,封装的是数据中的设计的表对应的元素。

Dao:Mapper的接口以及Mapper.xml文件,实现sql操作。

Service:服务实现层,调用Dao层方法进行实现。

Controller:控制层,调用一个个Service层的实现方法完成一个个具体功能。

项目使用了前端JS检错后端JSR303参数校验,能把绝大部分的问题都包括其中。类似于输入信息错误以及输入信息不合法违规跳转等,也加入了过滤器,使用户可以有更好的体验。

电影后台管理系统的管理员在工作中需要查阅和管理如下信息:后台管理的管理员、电影信息、新闻信息以及类型信息。如下图:

1

准备

环境:

IDEA

MySQL 5.1.47

Tomcat 9

Maven 3.6

要求:

掌握MySQL数据库

掌握Spring

掌握MyBatis

掌握SpringMVC

掌握简单的前端知识

实现 1.前置准备 1.1 创建数据库film CREATE DATABASE `film`; USE `film`; -- ---------------------------- -- Table structure for film -- ---------------------------- DROP TABLE IF EXISTS `film`; CREATE TABLE `film` ( `ISDN` int(20) NOT NULL, `name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `director` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `actor` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `country` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `language` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `score` double(10, 0) NULL DEFAULT NULL, `photo` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `href` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `description` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`ISDN`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- Records of film -- ---------------------------- INSERT INTO `film` VALUES (1, '神奇女侠', '派蒂·杰金斯', '盖尔·加朵', '科幻', '美国', '英语', 7, 'http://localhost:8080/video/\\sq.png', 'http://localhost:8080/video/\\导入视频.mp4', '故事背景设定在五光十色...'); INSERT INTO `film` VALUES (2, '紧急救援', '林超贤', '彭于晏', '动作', '中国大陆', '汉语普通话', 6, 'http://localhost:8080/video/\\jj.png', 'http://localhost:8080/video/\\导入视频.mp4', '倾覆沉没的钻井平台...'); INSERT INTO `film` VALUES (3, '333333333', '3', '3', '科幻', '3', '4', 3, 'http://localhost:8080/video/\\Snipaste_2020-10-11_00-02-07.png', 'http://localhost:8080/video/\\导入视频.mp4', '111'); -- ---------------------------- -- Table structure for news -- ---------------------------- DROP TABLE IF EXISTS `news`; CREATE TABLE `news` ( `ISDN` int(11) NOT NULL, `title` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `author` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `date` date NULL DEFAULT NULL, `description` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`ISDN`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- Records of news -- ---------------------------- INSERT INTO `news` VALUES (1, 'test1', 'zczc', '2009-01-13', '这是一个测试'); INSERT INTO `news` VALUES (2, 'test2', 'zctoo', '2001-02-15', '这也是一个测试'); -- ---------------------------- -- Table structure for types -- ---------------------------- DROP TABLE IF EXISTS `types`; CREATE TABLE `types` ( `id` int(11) NOT NULL, `type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- Records of types -- ---------------------------- INSERT INTO `types` VALUES (1, '科幻'); INSERT INTO `types` VALUES (2, '战争'); INSERT INTO `types` VALUES (3, '历史'); INSERT INTO `types` VALUES (4, '动作'); INSERT INTO `types` VALUES (5, '爱情'); INSERT INTO `types` VALUES (6, '喜剧'); INSERT INTO `types` VALUES (7, '冒险'); INSERT INTO `types` VALUES (8, '恐怖'); -- ---------------------------- -- Table structure for user -- ---------------------------- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `id` int(100) NOT NULL AUTO_INCREMENT, `username` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `paw` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `tele` int(20) NULL DEFAULT NULL, `email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- Records of user -- ---------------------------- INSERT INTO `user` VALUES (1, '111111', '123456', 111, 'moyu_zc@13.com'); INSERT INTO `user` VALUES (2, '111zc', 'zc123', 1111111111, '1437101473@qq.com'); SET FOREIGN_KEY_CHECKS = 1; 1.2 导入需要的依赖 <dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.47</version> </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>3.4.6</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>5.2.8.RELEASE</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <version>5.2.8.RELEASE</version> </dependency> <dependency> <groupId>com.jhlabs</groupId> <artifactId>filters</artifactId> <version>2.0.235</version> </dependency> <dependency> <groupId>com.github.penggle</groupId> <artifactId>kaptcha</artifactId> <version>2.3.2</version> </dependency> <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> <version>0.9.5.2</version> </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>2.0.4</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>5.1.9.RELEASE</version> </dependency> <dependency> <groupId>javax.servlet.jsp.jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>taglibs</groupId> <artifactId>standard</artifactId> <version>1.1.2</version> </dependency> <dependency> <groupId>org.apache.taglibs</groupId> <artifactId>taglibs-standard-spec</artifactId> <version>1.2.5</version> </dependency> <dependency> <groupId>org.apache.taglibs</groupId> <artifactId>taglibs-standard-impl</artifactId> <version>1.2.5</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2.1-b03</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>5.2.2.Final</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.1</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>1.4</version> </dependency> </dependencies> 1.3 Maven资源过滤以及JDK设置 <build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> </resources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> 1.4 创建好项目架构

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wspxxj.html