《Java SSH框架及应用开发》
课程设计
题目: 参观广软
班级: BKD
学号: 1840706272
姓名: 周佳宜
分数:
完成时间: 2021 年 5 月 22 日
本项目是一个有关校园参观预约的系统,每年冬季,广软的丝木棉一直是广东高校一道亮丽的风景线,很多非校内人员都很想前来参观校园,一睹粉色丝木棉风采。该系统应用行业属于校园类,我认为这对宣传校园文化大有帮助,同时也提高了校园来往人流的安全保障,广软丝木棉风采也更能吸引更多高考学子报考广软。本项目目标旨在宣传校园风采,提升高校入学率,同时让该项目可以投入到其他高校中使用。
该项目基于微信小程序+Vue+elementUI+SSM,运用微信开发者工具构建前端用户页面,同时运用了VantWeapp组件框架,腾讯地图接口,音乐播放器等,后台实现前后端分离,前端用VsCode开发,运用了Vue和elementUI框架,对数据进行Axios异步请求,后端使用IDEA开发,运用SSM,MySQL存储数据,后台服务器使用Tomcat9.0。
运行环境:tomcat9.0,mysql5.7.14,java jdk1.8,node环境
Pom.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"\>
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>huaruanview</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>huaruanview Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com\</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<!-- spring-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.3.4</version>
</dependency>
<!-- springmvc-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.3.4</version>
</dependency>
<!--JDBC依赖-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.3.5</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
</dependency>
<!-- Druid数据源:https://mvnrepository.com/artifact/com.alibaba/druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.5</version>
</dependency>
<!-- mybatis依赖-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.6</version>
</dependency>
<!-- spring整合依赖-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.6</version>
</dependency>
<!--测试依赖-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- 日志依赖-->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!--文件上传依赖 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.3</version>
</dependency>
<!-- json三个-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.3</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<build>
<finalName>huaruanview</finalName>
<pluginManagement><!-- lock down plugins versions to avoid using Maven
defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- see
http://maven.apache.org/ref/current/maven-core/default-bindings.html\#Plugin\_bindings\_for\_war\_packaging
-->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
<!-- 用来告诉服务器,不要拦截mapper.xml,要mapper.xml正常编译读取-->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
</project>
项目目录结构截图:
功能流程图如四-1、四-2、四-3
图 四‑1
图 四‑2
图 四‑3
给出概念模型及关系模型
概念模型如图五-1和图五-2
图 五‑1
图 五‑2
关系模型如下:
管理员(id,账号,密码,邮箱,联系电话,角色,注册时间,信息修改时间,头像)
广软动态(id,标题,作者,内容,头像,发布时间,修改时间,发布状态,管理员id)
其中外键:管理员id
预约记录(id,openid,预约日期,预约时间段,姓名,联系电话,token)
游客意见(id,内容,图片,提交时间,处理状态,处理时间)
超级管理员:系统只有一个超级管理员,主要对广软新闻动态进行增加、删除/批量删除、修改、多条件模糊查询、发布;对游客预约记录进行删除/批量删除、修改、多条件查询;对游客意见进行处理(未读到已读)、还原(已读到未读)和删除;对普通管理员进行增加、删除、修改以及对自己信息的修改。
普通管理员:系统有多个普通管理员,主要对自己所管理的广软新闻动态进行删除/批量删除、修改、多条件查询以及增加新闻动态;对游客预约记录进行删除/批量删除、修改、多条件查询;对游客意见进行处理(未读到已读)、还原(已读到未读)和删除以及对自己信息的修改。
用户:用户可以进行预约参观,添加预约、取消预约、修改预约、查看自己的预约记录信息;可以查看华软信息,包括广软简介和广软动态,除此之外还可以提交自己的意见。
模块功能简介
配置文件代码
applicationContext.xml代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
https://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd"\>
<!-- 1、加载db.properties-->
<context:property-placeholder location="classpath:db.properties"/>
<!-- 数据源配置 -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
<!-- 数据源驱动类可不写,Druid默认会自动根据URL识别DriverClass -->
<property name="driverClassName" value="${driverClassName}"/>
<!-- 基本属性 url、user、password -->
<property name="url" value="${url}"/>
<property name="username" value="${name}"/>
<property name="password" value="${password}"/>
<!-- 初始化连接大小 -->
<property name="initialSize" value="1"/>
<!-- 连接池最大使用连接数量 -->
<property name="maxActive" value="10"/>
<!-- 连接池最小空闲 -->
<property name="minIdle" value="1"/>
<!-- 获取连接最大等待时间 -->
<property name="maxWait" value="10000"/>
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="60000"/>
</bean>
<!-- 2、事务管理器,依赖于数据源 -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- 开启Server层事务注解 -->
<tx:annotation-driven transaction-manager="transactionManager"/>
<!--3、mybatis sqlsession工厂-->
<bean class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!-- 引入Mybatis核心配置文件-->
<property name="configLocation" value="classpath:mybatis-config.xml"/>
</bean>
<!--4、 mapper文件扫描器-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="cn.com.sise.dao"/>
</bean>
<!--service层文件扫描-->
<context:component-scan base-package="cn.com.sise.service"/>
<!--dao层文件扫描-->
<context:component-scan base-package="cn.com.sise.dao"/>
</beans>
db.properties代码如下:
driverClassName=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/mysise?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true
name=root
password=root
mybatis-config.xml代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<!-- 引入约束 -->
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd"\>
<configuration>
<!-- 设置mybatis 运行参-->
<settings>
<!-- 开启二级缓存 -->
<setting name="cacheEnabled" value="true"/>
<!-- 控制懒加载的 -->
<setting name="lazyLoadingEnabled" value="true"/>
<!-- 开启驼峰命名-->
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
<!-- 配置别名 -->
<typeAliases>
<package name="cn.com.sise.pojo"/>
</typeAliases>
</configuration>
springmvc-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
https://www.springframework.org/schema/mvc/spring-mvc.xsd"\>
<!--1、包扫描-->
<context:component-scan base-package="cn.com.sise.controller"/>
<!--2.视图解析器 -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/"/>
<property name="suffix" value=".jsp"/>
</bean>
<!-- 3、配置拦截器 -->
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<bean class="cn.com.sise.interceptors.CrossInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
<!-- 加载注解驱动 -->
<mvc:annotation-driven/>
<!-- 开放静态资源-->
<mvc:default-servlet-handler/>
<!-- 配置文件上传解析器-->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="defaultEncoding" value="UTF-8"/>
</bean>
</beans>
AdminService:
package cn.com.sise.service;
import cn.com.sise.pojo.Admin;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
public interface AdminService {
//添加新的管理员
public int addAdmin(Admin admin);
public List<Admin> selectPhone(String phone);
//查询全部的普通管理员
public List<Admin> findAllAdmin0();
//删除一个普通管理员
public int deleteOneAdmin(Integer id);
//删除多个普通管理员
public int delManyAdmin(int[] arr);
//通过普通管理员的账号进行模糊查询
public List<Admin> searchAadminByUsername(String username);
//修改普通管理员信息
public int updateAdmin0(Admin admin);
//修改超级管理员信息
public int updateInfo(Admin admin);
//超级管理员进行登录
public Admin loginAdmin1(Admin admin);
//超级管理员忘记密码
public int forgetAdmin(Admin admin);
//获取预约量
public int selectVisit();
//获取管理员数量
public int selectAdmin();
//获取文章数量
public int selectArticle();
//首页获取文章发布/未发布(扇形图)
public List<Integer> selectarticle();
//首页获取游客情况(曲线图)
public List<Map<String ,Object>> selectarticle2();
}
ArticleService:
package cn.com.sise.service;
import cn.com.sise.pojo.Article;
import java.util.List;
public interface ArticleService {
//超级管理员查询全部的华软新闻
public List<Article> selectAllArticle();
//小程序端查询已经发布的动态
public List<Article> selectAllArticle2();
////更新status(发布/未发布)
public int updateStatus(Integer status,Integer id);
//普通管理员查询自己发过的全部的华软新闻
public List<Article> selectAllArticleAdmin0(Integer adminid);
//删除一条华软新闻
public int deleteOneArticle(Integer id);
//删除多条华软新闻
public int delManyArticle(int[] arr);
//超级管理员添加一条华软新闻
public int addArticle(Article article);
//普通管理员添加一条华软新闻
public int addArticleAdmin0(Article article);
//超级管理员根据文章标题和作者对华软新闻进行模糊查询
public List<Article> searchArticle(Article article);
//普通管理员根据文章标题和作者对华软新闻进行模糊查询
public List<Article> searchArticleAdmin0(Article article);
//修改华软新闻
public int updateArticle(Article article);
////小程序端根据id获取新闻
public Article SelectArticleById(Integer id);
}
OpinionService:
package cn.com.sise.service;
import cn.com.sise.pojo.Opinion;
import java.util.List;
public interface OpinionService {
// 查询全部的未读信息
public List<Opinion> selectAllOpinion0();
// 查询全部的已读信息
public List<Opinion> selectAllOpinion1();
//将单个未读消息设置为已读消息
public int UpdateOpinion0(Opinion opinion);
//将已读消息设置为未读消息
public int UpdateOpinion1(Integer id);
//删除单个已读消息
public int deleteOneOpinion(Integer id);
//删除多个已读信息
public int delManyOpinion(int[] arr);
//将多个未读设置为已读
public int updateManyOpinion();
//拿到header的message
public int messageNumber();
}
VisitService:
package cn.com.sise.service;
import cn.com.sise.pojo.Visit;
import java.util.List;
public interface VisitService {
//查询全部的游客预约信息
public List<Visit> selectAllTourist();
//删除一条游客信息
public int deleteOneTourist(Integer id);
//删除多条游客信息
public int delManyTourist(int[] arr);
//根据游客预约日期和姓名对预约信息进行查询
public List<Visit> searchTourist(Visit visit);
//删除游客预约信息
public int updateTourist(Visit visit);
}
AdminMapper:
package cn.com.sise.dao;
import cn.com.sise.pojo.Admin;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
import java.util.Map;
public interface AdminMapper {
//添加新的管理员
@Insert("insert into
admin(username,password,qemail,phone,role,registertime,modifytime,photo) " +
"values(#{username},#{password},#{qemail},#{phone},0,#{registertime},#{modifytime},#{photo})")
public int addAdmin(Admin admin);
@Select("select * from admin where phone=#{phone}")
public List<Admin> selectPhone(String phone);
//查询全部的普通管理员
@Select("select * from admin where role=0")
public List<Admin> findAllAdmin0();
//删除一个普通管理员
@Delete("delete from admin where id=#{id}")
public int deleteOneAdmin(Integer id);
//删除多个普通管理员
public int delManyAdmin(int[] arr);
//通过普通管理员的账号进行模糊查询
@Select("select * from admin where username like concat(\"%\",
#{username},\"%\")")
public List<Admin> searchAadminByUsername(String username);
//修改普通管理员信息
public int updateAdmin0(Admin admin);
//修改超级管理员信息
public int updateInfo(Admin admin);
//管理员进行登录
@Select("select * from admin where username=#{username} and
password=#{password}")
public Admin loginAdmin1(Admin admin);
//超级管理员忘记密码
@Update("update admin set password=#{password} where phone=#{phone}")
public int forgetAdmin(Admin admin);
//获取预约量
@Select("select count(id) from visit")
public int selectVisit();
//获取管理员数量
@Select("select count(id) from admin")
public int selectAdmin();
//获取文章数量
@Select("select count(id) from article")
public int selectArticle();
//首页获取文章发布/未发布(扇形图)
@Select("select count(*) from article GROUP BY `status`")
public List<Integer> selectarticle();
//首页获取游客情况(曲线图)
@Select("select concat(year(any_value(`date`)),'年') `year`,
concat(month(any_value(`date`)),'月') months ,count(*) count " +
"from visit GROUP BY year(`date`),month(`date`)")
public List<Map<String ,Object>> selectarticle2();
}
AdminMapper.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"\>
<mapper namespace="cn.com.sise.dao.AdminMapper">
<!-- 批量删除-->
<delete id="delManyAdmin" parameterType="java.util.List">
delete from admin where id in
<foreach collection="array" item="arr" open="(" separator="," close=")">
#{arr}
</foreach>
</delete>
<!-- 修改普通管理员信息-->
<update id="updateAdmin0" parameterType="Admin">
update admin
<trim prefix="set" suffixOverrides=",">
<if test="username!=null and username!=''">
username=#{username},
</if>
<if test="password!=null and password!=''">
password=#{password},
</if>
<if test="qemail!=null and qemail!=''">
qemail=#{qemail},
</if>
<if test="phone!=null and phone!=''">
phone=#{phone},
</if>
<if test="modifytime!=null and modifytime!=''">
modifytime=#{modifytime},
</if>
</trim>
where id=#{id}
</update>
<!-- 修改超级管理员信息-->
<update id="updateInfo" parameterType="Admin">
update admin
<trim prefix="set" suffixOverrides=",">
<if test="photo!=null and photo!=''">
photo=#{photo},
</if>
<if test="username!=null and username!=''">
username=#{username},
</if>
<if test="password!=null and password!=''">
password=#{password},
</if>
<if test="qemail!=null and qemail!=''">
qemail=#{qemail},
</if>
<if test="phone!=null and phone!=''">
phone=#{phone},
</if>
<if test="modifytime!=null and modifytime!=''">
modifytime=#{modifytime},
</if>
</trim>
where id=#{id}
</update>
</mapper>
ArticleMapper:
package cn.com.sise.dao;
import cn.com.sise.pojo.Article;
import org.apache.ibatis.annotations.*;
import java.util.List;
public interface ArticleMapper {
//超级管理员他查询全部的华软新闻
@Select("select * from article")
public List<Article> selectAllArticle();
//小程序端查询已经发布的动态
@Select("select * from article where status=1")
public List<Article> selectAllArticle2();
//更新status(发布/未发布)
@Update("update article set status=#{status} where id=#{id}")
public int updateStatus(@Param("status") Integer status, @Param("id") Integer
id);
//普通管理员查询自己发过的全部的华软新闻
@Select("select * from article where adminid=#{adminid}")
public List<Article> selectAllArticleAdmin0(Integer adminid);
//删除一条华软新闻
@Delete("delete from article where id=#{id}")
public int deleteOneArticle(Integer id);
//删除多条华软新闻
public int delManyArticle(int[] arr);
//超级管理员添加一条华软新闻
@Insert("INSERT INTO article (title, author, content, titleImage, publishtime,
modifytime, status,adminid)" +
" VALUES (#{title}, #{author}, #{content},
#{titleImage},#{publishtime},#{modifytime},#{status},1)")
public int addArticle(Article article);
//普通管理员添加一条华软新闻
@Insert("INSERT INTO article (title, author, content, titleImage, publishtime,
modifytime, status,adminid)" +
" VALUES (#{title}, #{author}, #{content},
#{titleImage},#{publishtime},#{modifytime},0,#{adminid})")
public int addArticleAdmin0(Article article);
//超级管理员根据文章标题和作者对华软新闻进行模糊查询
public List<Article> searchArticle(Article article);
//普通管理员根据文章标题和作者对华软新闻进行模糊查询
public List<Article> searchArticleAdmin0(Article article);
//修改华软新闻
public int updateArticle(Article article);
//小程序端根据id获取新闻
@Select("select * from article where id=#{id}")
public Article SelectArticleById(Integer id);
}
ArticleMapper.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"\>
<mapper namespace="cn.com.sise.dao.ArticleMapper">
<!-- 批量删除-->
<delete id="delManyArticle" parameterType="java.util.List">
delete from article where id in
<foreach collection="array" item="arr" open="(" separator="," close=")">
#{arr}
</foreach>
</delete>
<!-- 超级管理员根据文章标题和作者对华软新闻进行模糊查询-->
<select id="searchArticle" parameterType="Article" resultType="Article">
select * from article
<where>
<if test="title!=null and title!=''">
and title like concat('%',#{title},'%')
</if>
<if test="author!=null and author!=''">
and author like concat('%',#{author},'%')
</if>
</where>
</select>
<!-- 普通管理员根据文章标题和作者对华软新闻进行模糊查询-->
<select id="searchArticleAdmin0" parameterType="Article" resultType="Article">
select * from article
<where>
<if test="title!=null and title!=''">
and title like concat('%',#{title},'%')
</if>
<if test="author!=null and author!=''">
and author like concat('%',#{author},'%')
</if>
and adminid=#{adminid}
</where>
</select>
<!-- 修改华软新闻-->
<update id="updateArticle" parameterType="Article">
update article
<trim prefix="set" suffixOverrides=",">
<if test="title!=null and title!=''">
title=#{title},
</if>
<if test="author!=null and author!=''">
author=#{author},
</if>
<if test="content!=null and content!=''">
content=#{content},
</if>
<if test="titleImage!=null and titleImage!=''">
titleImage=#{titleImage},
</if>
<if test="modifytime!=null and modifytime!=''">
modifytime=#{modifytime},
</if>
</trim>
where id=#{id}
</update>
</mapper>
OpinionMapper:
package cn.com.sise.dao;
import cn.com.sise.pojo.Opinion;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
public interface OpinionMapper {
//查询全部的未读信息
@Select("select * from yijian where state=0")
public List<Opinion> selectAllOpinion0();
//查询全部的已读信息
@Select("select * from yijian where state=1")
public List<Opinion> selectAllOpinion1();
//将单个未读消息设置为已读消息
@Update("update yijian set state=1,handletime=#{handletime} where id=#{id}")
public int UpdateOpinion0(Opinion opinion);
//将已读消息设置为未读消息
@Update("update yijian set state=0 where id=#{id}")
public int UpdateOpinion1(Integer id);
//删除单个已读消息
@Delete("delete from yijian where id=#{id}")
public int deleteOneOpinion(Integer id);
//删除多个已读信息
public int delManyOpinion(int[] arr);
//将多个未读设置为已读
@Update("update yijian set state=1 where state=0")
public int updateManyOpinion();
//拿到header的message
@Select("select count(*) from yijian where state=0")
public int messageNumber();
}
OpinionMapper.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"\>
<mapper namespace="cn.com.sise.dao.OpinionMapper">
<!-- 删除多个已读消息-->
<delete id="delManyOpinion" parameterType="java.util.List">
delete from yijian where id in
<foreach collection="array" item="arr" open="(" separator="," close=")">
#{arr}
</foreach>
</delete>
</mapper>
VisitMapper:
package cn.com.sise.dao;
import cn.com.sise.pojo.Visit;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface VisitMapper {
//查询全部的游客预约信息
@Select("select * from visit")
public List<Visit> selectAllTourist();
//删除一条游客预约信息
@Delete("delete from visit where id=#{id}")
public int deleteOneTourist(Integer id);
//删除多条游客预约信息
public int delManyTourist(int[] arr);
//根据游客预约日期和姓名对预约信息进行模糊查询
public List<Visit> searchTourist(Visit visit);
//修改游客预约信息
public int updateTourist(Visit visit);
}
VisitMapper.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"\>
<mapper namespace="cn.com.sise.dao.VisitMapper">
<!-- 批量删除-->
<delete id="delManyTourist" parameterType="java.util.List">
delete from visit where id in
<foreach collection="array" item="arr" open="(" separator="," close=")">
#{arr}
</foreach>
</delete>
<!-- 根据游客预约日期和姓名对预约信息进行模糊查询-->
<select id="searchTourist" parameterType="Visit" resultType="Visit">
select * from visit
<where>
<if test="date!=null and date!=''">
and date like concat('%',#{date},'%')
</if>
<if test="name!=null and name!=''">
and name like concat('%',#{name},'%')
</if>
</where>
</select>
<!-- 修改游客预约信息-->
<update id="updateTourist" parameterType="Visit">
update visit
<trim prefix="set" suffixOverrides=",">
<if test="name!=null and name!=''">
name=#{name},
</if>
<if test="date!=null and date!=''">
date=#{date},
</if>
<if test="daytime!=null and daytime!=''">
daytime=#{daytime},
</if>
<if test="phone!=null and phone!=''">
phone=#{phone},
</if>
</trim>
where id=#{id}
</update>
</mapper>
超级管理员登录:
登录普通管理员的界面设计大致与超级管理员相似,但是普通管理员的权限比超级管理员少,比如“广软动态”这一部分普通管理员只能对自己所属范围进行管理;普通管理员只能修改自己的信息,不能修改其他管理员的信息。
小程序端:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。