作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
党员管理系统,分为管理员、干部、党员三种角色;
管理员主要功能包括:
党员信息管理:新增党员、批量新增党员、党员信息查询;
干部信息管理:新增干部、批量新增干部、干部信息查询;
部门信息管理:新增部门、部门信息查询;
课程信息管理:新增课程、课程信息查询;
课件信息管理:文档管理、视频管理;
党务工作管理:党务工作讨论;
党费工作管理:党费查询、党费缴纳;
公告信息管理:新增公告、公告信息查询;
干部主要功能包括:
课程文件管理:上传课程视频、查询上传的视频、上传课程文档、查询上传的文档;
党务工作管理:新增党务工作、党务工作信息查询;
党费工作管理:党费查询、党费缴纳;
个人信息管理:
党员主要功能包括:
课程查询:查看课程信息;
文件查询:在线课程视频、在线课程文件;
党务工作:回复党务工作信息;
党费缴纳:党费查询、党费缴纳;
公告查询:查看公告;
个人信息:修改个人信息;
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7版本或者Mysql 8.0;
技术栈
1. 后端:Spring SpringMVC MyBatis
2. 前端:JSP+Vue+Bootstrap+jQuery
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2.使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,
3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置,然后运行;
4. 访问地址:http://localhost:8080/xxx
运行截图
相关代码
公告管理控制器
@Controller
public class NoticeController {
@Autowired
private NoticeService noticeService;
@RequestMapping("/createNotice")
public ModelAndView createNotice() {
ModelAndView mav = new ModelAndView();
mav.setViewName("createNotice");
return mav;
}
@RequestMapping("/saveNotice")
public ModelAndView saveNotice(Notice notice) {
notice.setRecordTime(new Date());
noticeService.saveNotice(notice);
return new ModelAndView("redirect:/searchNotice.html");
}
@RequestMapping("/searchNotice")
public ModelAndView searchNotice() {
ModelAndView mav = new ModelAndView();
mav.addObject("notices", noticeService.searchNotice());
mav.setViewName("searchNotice");
return mav;
}
@RequestMapping("/searchNoticeInfo")
public ModelAndView searchNoticeInfo() {
ModelAndView mav = new ModelAndView();
mav.addObject("notices", noticeService.searchNotice());
mav.setViewName("searchNoticeInfo");
return mav;
}
@RequestMapping("/deleteNotice/{id}")
public ModelAndView deleteNotice(@PathVariable("id") Integer id) {
noticeService.deleteNotice(id);
return new ModelAndView("redirect:/searchNotice.html");
}
@RequestMapping("/updateNotice/{id}")
public ModelAndView updateNotice(@PathVariable("id") Integer id) {
ModelAndView mav = new ModelAndView();
mav.addObject("notice", noticeService.getNoticeById(id));
mav.setViewName("updateNotice");
return mav;
}
@RequestMapping("/editNotice/{id}")
public ModelAndView editNotice(@PathVariable("id") Integer id, Notice notice) {
notice.setId(id);
notice.setRecordTime(new Date());
noticeService.updateNotice(notice);
return new ModelAndView("redirect:/searchNotice.html");
}
@RequestMapping("/noticeListByPage")
@ResponseBody()
public PageInfo<Notice> courseListByPage(int page, int pageSize) {
return noticeService.searchNoticeByPage(page,pageSize);
}
}
学生管理控制器
@Controller
public class StudentController {
@Autowired
private StudentService studentService;
@Autowired
private TeacherService teacherService;
@Autowired
private CollegeService collegeService;
@RequestMapping("/toRegister")
public ModelAndView toRegister() {
ModelAndView mav = new ModelAndView();
mav.setViewName("register");
return mav;
}
@RequestMapping("/register")
public ModelAndView register(String account, String password, String role) {
if(StringUtils.equals("2", role)) {
Student student = new Student();
student.setAccount(account);
student.setPassword(password);
studentService.addStudent(student);
return new ModelAndView("redirect:/preLogin.html");
} else {
Teacher teacher = new Teacher();
teacher.setAccount(account);
teacher.setPassword(password);
teacherService.saveTeacher(teacher);
return new ModelAndView("redirect:/preLogin.html");
}
}
@RequestMapping("/studentIndex")
public ModelAndView studentIndex() {
ModelAndView mav = new ModelAndView();
mav.setViewName("studentIndex");
return mav;
}
// 准备添加学生页面
@RequestMapping("/createStudent")
public ModelAndView createStudent() {
ModelAndView mav = new ModelAndView();
// 预加载 学生属于那个学院的
mav.addObject("colleges", collegeService.searchCollege());
mav.setViewName("createStudent");
return mav;
}
// 添加学生
@RequestMapping("/addStudent")
public ModelAndView addStudent(Student student) {
studentService.addStudent(student);
return new ModelAndView("redirect:/searchStudent.html");
}
// 查询学生信息
@RequestMapping("/searchStudent")
public ModelAndView searchStudent() {
ModelAndView mav = new ModelAndView();
mav.addObject("students", studentService.searchStudent());
mav.setViewName("searchStudent");
return mav;
}
@RequestMapping("/deleteStudent/{id}")
public ModelAndView deleteStudent(@PathVariable("id") Integer id) {
studentService.deleteStudent(id);
return new ModelAndView("redirect:/searchStudent.html");
}
// 加载需要修改的学生信息
@RequestMapping("/updateStudent/{id}")
public ModelAndView updateStudent(@PathVariable("id") Integer id) {
ModelAndView mav = new ModelAndView();
mav.addObject("colleges", collegeService.searchCollege());
mav.addObject("student", studentService.getStudentById(id));
mav.setViewName("updateStudent");
return mav;
}
// 更新学生信息
@RequestMapping("/editStudent/{id}")
public ModelAndView editStudent(@PathVariable("id") Integer id, Student student) {
student.setId(id);
studentService.updateStudent(student);
return new ModelAndView("redirect:/searchStudent.html");
}
@RequestMapping("/updateStudentInfo")
public ModelAndView updateStudentInfo(HttpSession session) {
Student student = (Student) session.getAttribute("user");
ModelAndView mav = new ModelAndView();
mav.addObject("colleges", collegeService.searchCollege());
mav.addObject("student", studentService.getStudentById(student.getId()));
mav.setViewName("updateStudentInfo");
return mav;
}
// 更新个人信息
@RequestMapping("/editStudentInfo/{id}")
public ModelAndView editStudentInfo(@PathVariable("id") Integer id, Student student) {
student.setId(id);
studentService.updateStudent(student);
return new ModelAndView("redirect:/searchNotice.html");
}
// 批量添加学生
@RequestMapping("/createManyStudent")
public ModelAndView createManyTeacher() {
ModelAndView mav = new ModelAndView();
mav.setViewName("createManyStudent");
return mav;
}
@SuppressWarnings("resource")
@RequestMapping("/studentDataImport")
public ModelAndView teacherDataImport(@RequestParam("file") MultipartFile file) {
Student student = new Student();
int totalRows;
int totalCells;
List<ArrayList<String>> list = new ArrayList<ArrayList<String>>();
// IO流读取文件
InputStream input = null;
HSSFWorkbook wb = null;
ArrayList<String> rowList = null;
try {
input = file.getInputStream();
wb = new HSSFWorkbook(input);// 创建文档
// 读取sheet(页)
for (int numSheet = 0; numSheet < wb.getNumberOfSheets(); numSheet++) {
HSSFSheet hssfSheet = wb.getSheetAt(numSheet);
if (hssfSheet == null) {
continue;
}
totalRows = hssfSheet.getLastRowNum();
// 读取Row,从第二行开始
for (int rowNum = 1; rowNum <= totalRows; rowNum++) {
HSSFRow hssfRow = hssfSheet.getRow(rowNum);
if (hssfRow != null) {
rowList = new ArrayList<String>();
totalCells = hssfRow.getLastCellNum();
// 读取列,从第一列开始
HSSFCell cell = hssfRow.getCell(0);// Name
student.setName(cell.getStringCellValue());
cell = hssfRow.getCell(1);// gender
student.setGender((int) cell.getNumericCellValue());
cell = hssfRow.getCell(2);// college_id
student.setCollegeId((int) cell.getNumericCellValue());
cell = hssfRow.getCell(3);// telphone
DecimalFormat format = new DecimalFormat("#");
Number value = cell.getNumericCellValue();
student.setTelphone(format.format(value));
cell = hssfRow.getCell(4);// idcard
student.setIdCardNo(cell.getStringCellValue());
cell = hssfRow.getCell(5);// account
if (cell != null) {
cell.setCellType(Cell.CELL_TYPE_STRING);
student.setAccount(cell.getStringCellValue());
}
cell = hssfRow.getCell(6);// password
if (cell != null) {
cell.setCellType(Cell.CELL_TYPE_STRING);
student.setPassword(cell.getStringCellValue());
}
cell = hssfRow.getCell(7);// num
if (cell != null) {
cell.setCellType(Cell.CELL_TYPE_STRING);
student.setNum(cell.getStringCellValue());
}
cell = hssfRow.getCell(8);// state
student.setState(cell.getStringCellValue());
cell = hssfRow.getCell(9);// isDel
student.setIsdel((int) cell.getNumericCellValue());
studentService.addStudent(student);
}
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return new ModelAndView("redirect:/searchStudent.html");
}
/**
*
* @Title: searchStudentData
* @Description: TODO(这里用一句话描述这个方法的作用)
* @return
*/
@RequestMapping("/studentList")
@ResponseBody
public List<Student> studentList() {
List<Student> list = studentService.searchStudent();
return list;
}
// 学生信息分页
@RequestMapping("/studentListByPage")
@ResponseBody()
public PageInfo<Student> studentListByPage(int page, int pageSize) {
return studentService.searchStudentByPage(page, pageSize);
}
// 有条件查询
@RequestMapping("/studentListByTerm")
@ResponseBody()
public PageInfo<Student> studentListByTerm(int page, int pageSize, String content) {
return studentService.searchStudentByTerm(page, pageSize, content, 0);
}
}
教师管理控制器
@Controller
public class TeacherController {
@Autowired
private TeacherService teacherService;
@Autowired
private CourseService courseService;
@Autowired
private CollegeService collegeService;
@RequestMapping("/teacherIndex")
public ModelAndView teacherindex() {
ModelAndView mav = new ModelAndView();
mav.setViewName("teacherIndex");
return mav;
}
// 准备添加教师页面
@RequestMapping("/createTeacher")
public ModelAndView createTeacher() {
ModelAndView mav = new ModelAndView();
// 教师属于那个学院的,教授那门课程
mav.addObject("colleges", collegeService.searchCollege());
mav.addObject("courses", courseService.searchCourse());
mav.setViewName("createTeacher");
return mav;
}
// 添加教师
@RequestMapping("/saveTeacher")
public ModelAndView saveStudent(Teacher teacher) {
teacherService.saveTeacher(teacher);
return new ModelAndView("redirect:/searchTeacher.html");
}
@RequestMapping("/searchTeacher")
public ModelAndView searchTeacher() {
ModelAndView mav = new ModelAndView();
mav.addObject("teachers", teacherService.searchTeacher());
mav.setViewName("searchTeacher");
return mav;
}
@RequestMapping("/deleteTeacher/{id}")
public ModelAndView deleteTeacher(@PathVariable("id") Integer id) {
teacherService.deleteTeacher(id);
return new ModelAndView("redirect:/searchTeacher.html");
}
@RequestMapping("/updateTeacher/{id}")
public ModelAndView updateTeacher(@PathVariable("id") Integer id) {
ModelAndView mav = new ModelAndView();
mav.addObject("colleges", collegeService.searchCollege());
mav.addObject("courses", courseService.searchCourse());
mav.addObject("teacher", teacherService.getTeacherById(id));
mav.setViewName("updateTeacher");
return mav;
}
@RequestMapping("/updateTeacherInfo")
public ModelAndView updateTeacherInfo(HttpSession session) {
Teacher teacher = (Teacher) session.getAttribute("user");
ModelAndView mav = new ModelAndView();
mav.addObject("teacher", teacherService.getTeacherById(teacher.getId()));
mav.addObject("courses", courseService.searchCourse());
mav.addObject("colleges", collegeService.searchCollege());
mav.setViewName("updateTeacherInfo");
return mav;
}
// 更新教师信息
@RequestMapping("/editTeacherInfo/{id}")
public ModelAndView editTeacherInfo(@PathVariable("id") Integer id,
Teacher teacher) {
ModelAndView mav = new ModelAndView();
teacher.setId(id);
teacherService.updateTeacher(teacher);
mav.setViewName("updateTeacherInfo");
return mav;
}
@RequestMapping("/editTeacher/{id}")
public ModelAndView editTeacher(@PathVariable("id") Integer id,
Teacher teacher) {
teacher.setId(id);
teacherService.updateTeacher(teacher);
return new ModelAndView("redirect:/searchTeacher.html");
}
@RequestMapping("/createManyTeacher")
public ModelAndView createManyTeacher() {
ModelAndView mav = new ModelAndView();
mav.setViewName("createManyTeacher");
return mav;
}
/**
*
* @Title: teacherDataImport
* @Description: 批量导入教师信息
* @param file
* @return
*/
@RequestMapping("/teacherDataImport")
public ModelAndView teacherDataImport(@RequestParam("file") MultipartFile file) {
Teacher teacher = new Teacher();
int totalRows;
int totalCells;
List<ArrayList<String>> list = new ArrayList<ArrayList<String>>();
// IO流读取文件
InputStream input = null;
HSSFWorkbook wb = null;
ArrayList<String> rowList = null;
try {
input = file.getInputStream();
// 创建文档
wb = new HSSFWorkbook(input);
// 读取sheet(页)
for (int numSheet = 0; numSheet < wb.getNumberOfSheets(); numSheet++) {
HSSFSheet hssfSheet = wb.getSheetAt(numSheet);
if (hssfSheet == null) {
continue;
}
totalRows = hssfSheet.getLastRowNum();
// 读取Row,从第二行开始
for (int rowNum = 1; rowNum <= totalRows; rowNum++) {
HSSFRow hssfRow = hssfSheet.getRow(rowNum);
if (hssfRow != null) {
rowList = new ArrayList<String>();
totalCells = hssfRow.getLastCellNum();
// 读取列,从第一列开始
HSSFCell cell = hssfRow.getCell(0);
teacher.setName(cell.getStringCellValue());
cell = hssfRow.getCell(1);
teacher.setGender((int) cell.getNumericCellValue());
cell = hssfRow.getCell(2);
teacher.setCollegeId((int) cell.getNumericCellValue());
cell = hssfRow.getCell(3);
DecimalFormat format = new DecimalFormat("#");
Number value = cell.getNumericCellValue();
teacher.setTelphone(format.format(value));
cell = hssfRow.getCell(4);
teacher.setIdCardNo(cell.getStringCellValue());
cell = hssfRow.getCell(5);
teacher.setAccount(cell.getStringCellValue());
cell = hssfRow.getCell(6);
if(cell!=null){
cell.setCellType(Cell.CELL_TYPE_STRING);
teacher.setPassword(cell.getStringCellValue());
}
cell = hssfRow.getCell(7);
if(cell!=null){
cell.setCellType(Cell.CELL_TYPE_STRING);
teacher.setNum(cell.getStringCellValue());
}
cell = hssfRow.getCell(8);
teacher.setCourseId(Integer.parseInt(cell.getStringCellValue()));
teacherService.saveTeacher(teacher);
}
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return new ModelAndView("redirect:/searchTeacher.html");
}
/**
*
* @Title: studentListByPage
* @Description:分页查询
* @param page
* @param pageSize
* @return
*/
@RequestMapping("/teacherListByPage")
@ResponseBody()
public PageInfo<Teacher> teacherListByPage(int page, int pageSize) {
return teacherService.searchTeacherByPage(page,pageSize);
}
@RequestMapping("/teacherListByTerm")
@ResponseBody()
public PageInfo<Teacher> teacherListByTerm(int page, int pageSize,String content) {
return teacherService.searchTeacherByTerm(page,pageSize,content,0);
}
}
如果也想学习本系统,下面领取。关注并回复:062ssm