springboot036海滨体育馆管理系统的设计与实现
管理员和学生在登录界面输入用户名、密码,选择类型进行登录操作,系统登录界面展示。
没有账号的学生用户可进行注册操作,学生注册界面。
管理员可添加、修改和删除学生信息,学生管理界面。
学生可进入系统前台查看系统信息,包括首页、器材以及体育论坛等,系统主界面。
管理员可以添加、修改和删除器材信息,学生可查看器材信息,器材管理界面展示。
学生可添加器材借出信息,管理员可查看管理所有器材借出信息,并可对其进行修改和删除操作,同时也可添加器材借出信息,器材借出管理界面,添加器材借出界面展示。
图5-6 器材借出管理界面
学生可添加活动预约信息,管理员可查看活动预约信息,并可对其进行审核、修改和删除操作,活动预约管理界面,添加活动预约界面展示。
图5-8 活动预约管理界面
DengguangbaoxiuServiceImpl.java
package com.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.List;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.utils.PageUtils;
import com.utils.Query;
import com.dao.DengguangbaoxiuDao;
import com.entity.DengguangbaoxiuEntity;
import com.service.DengguangbaoxiuService;
import com.entity.vo.DengguangbaoxiuVO;
import com.entity.view.DengguangbaoxiuView;
@Service("dengguangbaoxiuService")
public class DengguangbaoxiuServiceImpl extends ServiceImpl<DengguangbaoxiuDao, DengguangbaoxiuEntity> implements DengguangbaoxiuService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<DengguangbaoxiuEntity> page = this.selectPage(
new Query<DengguangbaoxiuEntity>(params).getPage(),
new EntityWrapper<DengguangbaoxiuEntity>()
);
return new PageUtils(page);
}
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<DengguangbaoxiuEntity> wrapper) {
Page<DengguangbaoxiuView> page =new Query<DengguangbaoxiuView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
public List<DengguangbaoxiuVO> selectListVO(Wrapper<DengguangbaoxiuEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
}
@Override
public DengguangbaoxiuVO selectVO(Wrapper<DengguangbaoxiuEntity> wrapper) {
return baseMapper.selectVO(wrapper);
}
@Override
public List<DengguangbaoxiuView> selectListView(Wrapper<DengguangbaoxiuEntity> wrapper) {
return baseMapper.selectListView(wrapper);
}
@Override
public DengguangbaoxiuView selectView(Wrapper<DengguangbaoxiuEntity> wrapper) {
return baseMapper.selectView(wrapper);
}
}
QicaiController.java
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.QicaiEntity;
import com.entity.view.QicaiView;
import com.service.QicaiService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 器材
* 后端接口
* @author
* @email
* @date 2021-04-06 00:13:18
*/
@RestController
@RequestMapping("/qicai")
public class QicaiController {
@Autowired
private QicaiService qicaiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,QicaiEntity qicai,
HttpServletRequest request){
EntityWrapper<QicaiEntity> ew = new EntityWrapper<QicaiEntity>();
PageUtils page = qicaiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, qicai), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,QicaiEntity qicai, HttpServletRequest request){
EntityWrapper<QicaiEntity> ew = new EntityWrapper<QicaiEntity>();
PageUtils page = qicaiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, qicai), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( QicaiEntity qicai){
EntityWrapper<QicaiEntity> ew = new EntityWrapper<QicaiEntity>();
ew.allEq(MPUtil.allEQMapPre( qicai, "qicai"));
return R.ok().put("data", qicaiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(QicaiEntity qicai){
EntityWrapper< QicaiEntity> ew = new EntityWrapper< QicaiEntity>();
ew.allEq(MPUtil.allEQMapPre( qicai, "qicai"));
QicaiView qicaiView = qicaiService.selectView(ew);
return R.ok("查询器材成功").put("data", qicaiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
QicaiEntity qicai = qicaiService.selectById(id);
return R.ok().put("data", qicai);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
QicaiEntity qicai = qicaiService.selectById(id);
return R.ok().put("data", qicai);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody QicaiEntity qicai, HttpServletRequest request){
qicai.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(qicai);
qicaiService.insert(qicai);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody QicaiEntity qicai, HttpServletRequest request){
qicai.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(qicai);
qicaiService.insert(qicai);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody QicaiEntity qicai, HttpServletRequest request){
//ValidatorUtils.validateEntity(qicai);
qicaiService.updateById(qicai);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
qicaiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<QicaiEntity> wrapper = new EntityWrapper<QicaiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = qicaiService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
HomeComment.vue
<template>
<div class="home-comment">
<div class="title">用户留言</div>
<div class="comment-list">
<div v-for="(item,index) in list" v-bind:key="index" class="comment-item">
<div class="user-content">
<el-image
class="avator"
:src="item.avator"
></el-image>
<span class="user">{{item.name}}</span>
</div>
<div class="comment">{{item.content}}</div>
<div class="create-time">{{item.createTime}}</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
list: [
{
name: "MaskLin",
avator:
"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
content:
"你以为只要长得漂亮就有男生喜欢?你以为只要有了钱漂亮妹子就自己贴上来了?你以为学霸就能找到好工作?我告诉你吧,这些都是真的!",
createTime: "5月02日 00:00"
},
{
name: "MaskLin",
avator:
"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
content: "作者太帅了",
createTime: "5月04日 00:00"
},
{
name: "MaskLin",
avator:
"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
content: "作者太帅了",
createTime: "5月04日 00:00"
},
{
name: "MaskLin",
avator: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
content: "作者太帅了",
createTime: "5月04日 00:00"
}
]
};
}
};
</script>
<style lang="scss" scoped>
.home-comment {
background: #ffffff;
.title {
font-size: 18px;
color: #666;
font-weight: bold;
padding: 10px;
border-bottom: 1px solid #eeeeee;
}
.comment-list {
padding: 10px;
.comment-item {
padding: 10px;
border-bottom: 1px solid #eeeeee;
.user-content {
display: flex;
align-items: center;
.user {
font-size: 18px;
color: #666;
font-weight: bold;
line-height: 50px;
margin-left: 10px;
}
.avator {
width: 50px;
height: 50px;
border-radius: 50%;
}
}
.comment {
margin-top: 10px;
font-size: 14px;
color: #888888;
}
.create-time {
margin-top: 15px;
font-size: 14px;
color: #888888;
}
}
}
}
</style>
application.yml
# Tomcat
server:
tomcat:
uri-encoding: UTF-8
port: 8080
servlet:
context-path: /springboot2yx3h
spring:
datasource:
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/springboot2yx3h?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8
username: root
password: 123456
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=springboot2yx3h
# username: sa
# password: 123456
servlet:
multipart:
max-file-size: 10MB
max-request-size: 10MB
resources:
static-locations: classpath:static/,file:static/
#mybatis
mybatis-plus:
mapper-locations: classpath*:mapper/*.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.entity
global-config:
#主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
id-type: 1
#字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
field-strategy: 2
#驼峰下划线转换
db-column-underline: true
#刷新mapper 调试神器
refresh-mapper: true
#逻辑删除配置
logic-delete-value: -1
logic-not-delete-value: 0
#自定义SQL注入器
sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
#springboot 项目mybatis plus 设置 jdbcTypeForNull (oracle数据库需配置JdbcType.NULL, 默认是Other)
jdbc-type-for-null: 'null'