package com.frankioxo.dormitory.service.impl;
import com.frankioxo.dormitory.entity.Moveout;
import com.frankioxo.dormitory.entity.Student;
import com.frankioxo.dormitory.mapper.DormitoryMapper;
import com.frankioxo.dormitory.mapper.StudentMapper;
import com.frankioxo.dormitory.service.StudentServie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Service
public class StudentServiceImpl implements StudentServie {
@Autowired
private StudentMapper studentMapper;
@Autowired
private DormitoryMapper dormitoryMapper;
@Override
public List<Student> list() {
return this.studentMapper.list();
}
@Override
public List<Student> search(String key, String value) {
if(value.equals("")) return this.studentMapper.list();
List<Student> list = null;
switch (key){
case "number":
list = this.studentMapper.searchByNumber(value);
break;
case "name":
list = this.studentMapper.searchByName(value);
break;
}
return list;
}
@Override
public void save(Student student) {
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
student.setCreateDate(format.format(date));
try {
this.studentMapper.save(student);
this.dormitoryMapper.subAvailable(student.getDormitoryId());
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void update(Student student) {
try {
this.studentMapper.update(student);
if(!student.getDormitoryId().equals(student.getOldDormitoryId())){
this.dormitoryMapper.subAvailable(student.getDormitoryId());
this.dormitoryMapper.addAvailable(student.getOldDormitoryId());
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void delete(Student student) {
try {
this.studentMapper.delete(student.getId());
this.dormitoryMapper.addAvailable(student.getDormitoryId());
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public List<Student> moveoutList() {
return this.studentMapper.moveoutList();
}
@Override
public List<Student> searchForMoveoutList(String key, String value) {
if(value.equals("")) return this.studentMapper.moveoutList();
List<Student> list = null;
switch (key){
case "number":
list = this.studentMapper.searchForMoveoutByNumber(value);
break;
case "name":
list = this.studentMapper.searchForMoveoutByName(value);
break;
}
return list;
}
@Override
public void moveout(Moveout moveout) {
try {
this.dormitoryMapper.addAvailable(moveout.getDormitoryId());
this.studentMapper.updateStateById(moveout.getStudentId());
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
moveout.setCreateDate(format.format(date));
this.studentMapper.moveout(moveout);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public List<Student> findByDormitoryId(Integer dormitoryId) {
return this.studentMapper.findByDormitoryId(dormitoryId);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于springboot的宿舍管理系统源码+数据库(毕业设计).zip

共76个文件
java:40个
html:12个
xml:8个

1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉

温馨提示
基于springboot的宿舍管理系统源码+数据库(毕业设计).zip。已获高分通过项目。 项目简介 本项目是一套基于springboot的宿舍管理系统,主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的Java学习者。也可作为课程设计、期末大作业。 包含:项目源码、数据库脚本、软件工具、项目说明等,该项目可以直接作为毕设使用。 项目都经过严格调试,确保可以运行! 技术实现 后台框架:SpringBoot 数据库:MySQL 开发环境:JDK、IDEA、Tomcat 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。
资源推荐
资源详情
资源评论













收起资源包目录











































































































共 76 条
- 1

张小妍的博客
- 粉丝: 1w+
- 资源: 1772
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


安全验证
文档复制为VIP权益,开通VIP直接复制

- 1
- 2
- 3
- 4
前往页