• Java项目:ssm党员管理系统


    作者主页:夜未央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

    运行截图

     

     

     

     

     

     

    相关代码 

    公告管理控制器

    1. @Controller
    2. public class NoticeController {
    3. @Autowired
    4. private NoticeService noticeService;
    5. @RequestMapping("/createNotice")
    6. public ModelAndView createNotice() {
    7. ModelAndView mav = new ModelAndView();
    8. mav.setViewName("createNotice");
    9. return mav;
    10. }
    11. @RequestMapping("/saveNotice")
    12. public ModelAndView saveNotice(Notice notice) {
    13. notice.setRecordTime(new Date());
    14. noticeService.saveNotice(notice);
    15. return new ModelAndView("redirect:/searchNotice.html");
    16. }
    17. @RequestMapping("/searchNotice")
    18. public ModelAndView searchNotice() {
    19. ModelAndView mav = new ModelAndView();
    20. mav.addObject("notices", noticeService.searchNotice());
    21. mav.setViewName("searchNotice");
    22. return mav;
    23. }
    24. @RequestMapping("/searchNoticeInfo")
    25. public ModelAndView searchNoticeInfo() {
    26. ModelAndView mav = new ModelAndView();
    27. mav.addObject("notices", noticeService.searchNotice());
    28. mav.setViewName("searchNoticeInfo");
    29. return mav;
    30. }
    31. @RequestMapping("/deleteNotice/{id}")
    32. public ModelAndView deleteNotice(@PathVariable("id") Integer id) {
    33. noticeService.deleteNotice(id);
    34. return new ModelAndView("redirect:/searchNotice.html");
    35. }
    36. @RequestMapping("/updateNotice/{id}")
    37. public ModelAndView updateNotice(@PathVariable("id") Integer id) {
    38. ModelAndView mav = new ModelAndView();
    39. mav.addObject("notice", noticeService.getNoticeById(id));
    40. mav.setViewName("updateNotice");
    41. return mav;
    42. }
    43. @RequestMapping("/editNotice/{id}")
    44. public ModelAndView editNotice(@PathVariable("id") Integer id, Notice notice) {
    45. notice.setId(id);
    46. notice.setRecordTime(new Date());
    47. noticeService.updateNotice(notice);
    48. return new ModelAndView("redirect:/searchNotice.html");
    49. }
    50. @RequestMapping("/noticeListByPage")
    51. @ResponseBody()
    52. public PageInfo courseListByPage(int page, int pageSize) {
    53. return noticeService.searchNoticeByPage(page,pageSize);
    54. }
    55. }

    学生管理控制器

    1. @Controller
    2. public class StudentController {
    3. @Autowired
    4. private StudentService studentService;
    5. @Autowired
    6. private TeacherService teacherService;
    7. @Autowired
    8. private CollegeService collegeService;
    9. @RequestMapping("/toRegister")
    10. public ModelAndView toRegister() {
    11. ModelAndView mav = new ModelAndView();
    12. mav.setViewName("register");
    13. return mav;
    14. }
    15. @RequestMapping("/register")
    16. public ModelAndView register(String account, String password, String role) {
    17. if(StringUtils.equals("2", role)) {
    18. Student student = new Student();
    19. student.setAccount(account);
    20. student.setPassword(password);
    21. studentService.addStudent(student);
    22. return new ModelAndView("redirect:/preLogin.html");
    23. } else {
    24. Teacher teacher = new Teacher();
    25. teacher.setAccount(account);
    26. teacher.setPassword(password);
    27. teacherService.saveTeacher(teacher);
    28. return new ModelAndView("redirect:/preLogin.html");
    29. }
    30. }
    31. @RequestMapping("/studentIndex")
    32. public ModelAndView studentIndex() {
    33. ModelAndView mav = new ModelAndView();
    34. mav.setViewName("studentIndex");
    35. return mav;
    36. }
    37. // 准备添加学生页面
    38. @RequestMapping("/createStudent")
    39. public ModelAndView createStudent() {
    40. ModelAndView mav = new ModelAndView();
    41. // 预加载 学生属于那个学院的
    42. mav.addObject("colleges", collegeService.searchCollege());
    43. mav.setViewName("createStudent");
    44. return mav;
    45. }
    46. // 添加学生
    47. @RequestMapping("/addStudent")
    48. public ModelAndView addStudent(Student student) {
    49. studentService.addStudent(student);
    50. return new ModelAndView("redirect:/searchStudent.html");
    51. }
    52. // 查询学生信息
    53. @RequestMapping("/searchStudent")
    54. public ModelAndView searchStudent() {
    55. ModelAndView mav = new ModelAndView();
    56. mav.addObject("students", studentService.searchStudent());
    57. mav.setViewName("searchStudent");
    58. return mav;
    59. }
    60. @RequestMapping("/deleteStudent/{id}")
    61. public ModelAndView deleteStudent(@PathVariable("id") Integer id) {
    62. studentService.deleteStudent(id);
    63. return new ModelAndView("redirect:/searchStudent.html");
    64. }
    65. // 加载需要修改的学生信息
    66. @RequestMapping("/updateStudent/{id}")
    67. public ModelAndView updateStudent(@PathVariable("id") Integer id) {
    68. ModelAndView mav = new ModelAndView();
    69. mav.addObject("colleges", collegeService.searchCollege());
    70. mav.addObject("student", studentService.getStudentById(id));
    71. mav.setViewName("updateStudent");
    72. return mav;
    73. }
    74. // 更新学生信息
    75. @RequestMapping("/editStudent/{id}")
    76. public ModelAndView editStudent(@PathVariable("id") Integer id, Student student) {
    77. student.setId(id);
    78. studentService.updateStudent(student);
    79. return new ModelAndView("redirect:/searchStudent.html");
    80. }
    81. @RequestMapping("/updateStudentInfo")
    82. public ModelAndView updateStudentInfo(HttpSession session) {
    83. Student student = (Student) session.getAttribute("user");
    84. ModelAndView mav = new ModelAndView();
    85. mav.addObject("colleges", collegeService.searchCollege());
    86. mav.addObject("student", studentService.getStudentById(student.getId()));
    87. mav.setViewName("updateStudentInfo");
    88. return mav;
    89. }
    90. // 更新个人信息
    91. @RequestMapping("/editStudentInfo/{id}")
    92. public ModelAndView editStudentInfo(@PathVariable("id") Integer id, Student student) {
    93. student.setId(id);
    94. studentService.updateStudent(student);
    95. return new ModelAndView("redirect:/searchNotice.html");
    96. }
    97. // 批量添加学生
    98. @RequestMapping("/createManyStudent")
    99. public ModelAndView createManyTeacher() {
    100. ModelAndView mav = new ModelAndView();
    101. mav.setViewName("createManyStudent");
    102. return mav;
    103. }
    104. @SuppressWarnings("resource")
    105. @RequestMapping("/studentDataImport")
    106. public ModelAndView teacherDataImport(@RequestParam("file") MultipartFile file) {
    107. Student student = new Student();
    108. int totalRows;
    109. int totalCells;
    110. List> list = new ArrayList>();
    111. // IO流读取文件
    112. InputStream input = null;
    113. HSSFWorkbook wb = null;
    114. ArrayList rowList = null;
    115. try {
    116. input = file.getInputStream();
    117. wb = new HSSFWorkbook(input);// 创建文档
    118. // 读取sheet(页)
    119. for (int numSheet = 0; numSheet < wb.getNumberOfSheets(); numSheet++) {
    120. HSSFSheet hssfSheet = wb.getSheetAt(numSheet);
    121. if (hssfSheet == null) {
    122. continue;
    123. }
    124. totalRows = hssfSheet.getLastRowNum();
    125. // 读取Row,从第二行开始
    126. for (int rowNum = 1; rowNum <= totalRows; rowNum++) {
    127. HSSFRow hssfRow = hssfSheet.getRow(rowNum);
    128. if (hssfRow != null) {
    129. rowList = new ArrayList();
    130. totalCells = hssfRow.getLastCellNum();
    131. // 读取列,从第一列开始
    132. HSSFCell cell = hssfRow.getCell(0);// Name
    133. student.setName(cell.getStringCellValue());
    134. cell = hssfRow.getCell(1);// gender
    135. student.setGender((int) cell.getNumericCellValue());
    136. cell = hssfRow.getCell(2);// college_id
    137. student.setCollegeId((int) cell.getNumericCellValue());
    138. cell = hssfRow.getCell(3);// telphone
    139. DecimalFormat format = new DecimalFormat("#");
    140. Number value = cell.getNumericCellValue();
    141. student.setTelphone(format.format(value));
    142. cell = hssfRow.getCell(4);// idcard
    143. student.setIdCardNo(cell.getStringCellValue());
    144. cell = hssfRow.getCell(5);// account
    145. if (cell != null) {
    146. cell.setCellType(Cell.CELL_TYPE_STRING);
    147. student.setAccount(cell.getStringCellValue());
    148. }
    149. cell = hssfRow.getCell(6);// password
    150. if (cell != null) {
    151. cell.setCellType(Cell.CELL_TYPE_STRING);
    152. student.setPassword(cell.getStringCellValue());
    153. }
    154. cell = hssfRow.getCell(7);// num
    155. if (cell != null) {
    156. cell.setCellType(Cell.CELL_TYPE_STRING);
    157. student.setNum(cell.getStringCellValue());
    158. }
    159. cell = hssfRow.getCell(8);// state
    160. student.setState(cell.getStringCellValue());
    161. cell = hssfRow.getCell(9);// isDel
    162. student.setIsdel((int) cell.getNumericCellValue());
    163. studentService.addStudent(student);
    164. }
    165. }
    166. }
    167. } catch (IOException e) {
    168. e.printStackTrace();
    169. } finally {
    170. try {
    171. input.close();
    172. } catch (IOException e) {
    173. e.printStackTrace();
    174. }
    175. }
    176. return new ModelAndView("redirect:/searchStudent.html");
    177. }
    178. /**
    179. *
    180. * @Title: searchStudentData
    181. * @Description: TODO(这里用一句话描述这个方法的作用)
    182. * @return
    183. */
    184. @RequestMapping("/studentList")
    185. @ResponseBody
    186. public List studentList() {
    187. List list = studentService.searchStudent();
    188. return list;
    189. }
    190. // 学生信息分页
    191. @RequestMapping("/studentListByPage")
    192. @ResponseBody()
    193. public PageInfo studentListByPage(int page, int pageSize) {
    194. return studentService.searchStudentByPage(page, pageSize);
    195. }
    196. // 有条件查询
    197. @RequestMapping("/studentListByTerm")
    198. @ResponseBody()
    199. public PageInfo studentListByTerm(int page, int pageSize, String content) {
    200. return studentService.searchStudentByTerm(page, pageSize, content, 0);
    201. }
    202. }

    教师管理控制器

    1. @Controller
    2. public class TeacherController {
    3. @Autowired
    4. private TeacherService teacherService;
    5. @Autowired
    6. private CourseService courseService;
    7. @Autowired
    8. private CollegeService collegeService;
    9. @RequestMapping("/teacherIndex")
    10. public ModelAndView teacherindex() {
    11. ModelAndView mav = new ModelAndView();
    12. mav.setViewName("teacherIndex");
    13. return mav;
    14. }
    15. // 准备添加教师页面
    16. @RequestMapping("/createTeacher")
    17. public ModelAndView createTeacher() {
    18. ModelAndView mav = new ModelAndView();
    19. // 教师属于那个学院的,教授那门课程
    20. mav.addObject("colleges", collegeService.searchCollege());
    21. mav.addObject("courses", courseService.searchCourse());
    22. mav.setViewName("createTeacher");
    23. return mav;
    24. }
    25. // 添加教师
    26. @RequestMapping("/saveTeacher")
    27. public ModelAndView saveStudent(Teacher teacher) {
    28. teacherService.saveTeacher(teacher);
    29. return new ModelAndView("redirect:/searchTeacher.html");
    30. }
    31. @RequestMapping("/searchTeacher")
    32. public ModelAndView searchTeacher() {
    33. ModelAndView mav = new ModelAndView();
    34. mav.addObject("teachers", teacherService.searchTeacher());
    35. mav.setViewName("searchTeacher");
    36. return mav;
    37. }
    38. @RequestMapping("/deleteTeacher/{id}")
    39. public ModelAndView deleteTeacher(@PathVariable("id") Integer id) {
    40. teacherService.deleteTeacher(id);
    41. return new ModelAndView("redirect:/searchTeacher.html");
    42. }
    43. @RequestMapping("/updateTeacher/{id}")
    44. public ModelAndView updateTeacher(@PathVariable("id") Integer id) {
    45. ModelAndView mav = new ModelAndView();
    46. mav.addObject("colleges", collegeService.searchCollege());
    47. mav.addObject("courses", courseService.searchCourse());
    48. mav.addObject("teacher", teacherService.getTeacherById(id));
    49. mav.setViewName("updateTeacher");
    50. return mav;
    51. }
    52. @RequestMapping("/updateTeacherInfo")
    53. public ModelAndView updateTeacherInfo(HttpSession session) {
    54. Teacher teacher = (Teacher) session.getAttribute("user");
    55. ModelAndView mav = new ModelAndView();
    56. mav.addObject("teacher", teacherService.getTeacherById(teacher.getId()));
    57. mav.addObject("courses", courseService.searchCourse());
    58. mav.addObject("colleges", collegeService.searchCollege());
    59. mav.setViewName("updateTeacherInfo");
    60. return mav;
    61. }
    62. // 更新教师信息
    63. @RequestMapping("/editTeacherInfo/{id}")
    64. public ModelAndView editTeacherInfo(@PathVariable("id") Integer id,
    65. Teacher teacher) {
    66. ModelAndView mav = new ModelAndView();
    67. teacher.setId(id);
    68. teacherService.updateTeacher(teacher);
    69. mav.setViewName("updateTeacherInfo");
    70. return mav;
    71. }
    72. @RequestMapping("/editTeacher/{id}")
    73. public ModelAndView editTeacher(@PathVariable("id") Integer id,
    74. Teacher teacher) {
    75. teacher.setId(id);
    76. teacherService.updateTeacher(teacher);
    77. return new ModelAndView("redirect:/searchTeacher.html");
    78. }
    79. @RequestMapping("/createManyTeacher")
    80. public ModelAndView createManyTeacher() {
    81. ModelAndView mav = new ModelAndView();
    82. mav.setViewName("createManyTeacher");
    83. return mav;
    84. }
    85. /**
    86. *
    87. * @Title: teacherDataImport
    88. * @Description: 批量导入教师信息
    89. * @param file
    90. * @return
    91. */
    92. @RequestMapping("/teacherDataImport")
    93. public ModelAndView teacherDataImport(@RequestParam("file") MultipartFile file) {
    94. Teacher teacher = new Teacher();
    95. int totalRows;
    96. int totalCells;
    97. List> list = new ArrayList>();
    98. // IO流读取文件
    99. InputStream input = null;
    100. HSSFWorkbook wb = null;
    101. ArrayList rowList = null;
    102. try {
    103. input = file.getInputStream();
    104. // 创建文档
    105. wb = new HSSFWorkbook(input);
    106. // 读取sheet(页)
    107. for (int numSheet = 0; numSheet < wb.getNumberOfSheets(); numSheet++) {
    108. HSSFSheet hssfSheet = wb.getSheetAt(numSheet);
    109. if (hssfSheet == null) {
    110. continue;
    111. }
    112. totalRows = hssfSheet.getLastRowNum();
    113. // 读取Row,从第二行开始
    114. for (int rowNum = 1; rowNum <= totalRows; rowNum++) {
    115. HSSFRow hssfRow = hssfSheet.getRow(rowNum);
    116. if (hssfRow != null) {
    117. rowList = new ArrayList();
    118. totalCells = hssfRow.getLastCellNum();
    119. // 读取列,从第一列开始
    120. HSSFCell cell = hssfRow.getCell(0);
    121. teacher.setName(cell.getStringCellValue());
    122. cell = hssfRow.getCell(1);
    123. teacher.setGender((int) cell.getNumericCellValue());
    124. cell = hssfRow.getCell(2);
    125. teacher.setCollegeId((int) cell.getNumericCellValue());
    126. cell = hssfRow.getCell(3);
    127. DecimalFormat format = new DecimalFormat("#");
    128. Number value = cell.getNumericCellValue();
    129. teacher.setTelphone(format.format(value));
    130. cell = hssfRow.getCell(4);
    131. teacher.setIdCardNo(cell.getStringCellValue());
    132. cell = hssfRow.getCell(5);
    133. teacher.setAccount(cell.getStringCellValue());
    134. cell = hssfRow.getCell(6);
    135. if(cell!=null){
    136. cell.setCellType(Cell.CELL_TYPE_STRING);
    137. teacher.setPassword(cell.getStringCellValue());
    138. }
    139. cell = hssfRow.getCell(7);
    140. if(cell!=null){
    141. cell.setCellType(Cell.CELL_TYPE_STRING);
    142. teacher.setNum(cell.getStringCellValue());
    143. }
    144. cell = hssfRow.getCell(8);
    145. teacher.setCourseId(Integer.parseInt(cell.getStringCellValue()));
    146. teacherService.saveTeacher(teacher);
    147. }
    148. }
    149. }
    150. } catch (IOException e) {
    151. e.printStackTrace();
    152. } finally {
    153. try {
    154. input.close();
    155. } catch (IOException e) {
    156. e.printStackTrace();
    157. }
    158. }
    159. return new ModelAndView("redirect:/searchTeacher.html");
    160. }
    161. /**
    162. *
    163. * @Title: studentListByPage
    164. * @Description:分页查询
    165. * @param page
    166. * @param pageSize
    167. * @return
    168. */
    169. @RequestMapping("/teacherListByPage")
    170. @ResponseBody()
    171. public PageInfo teacherListByPage(int page, int pageSize) {
    172. return teacherService.searchTeacherByPage(page,pageSize);
    173. }
    174. @RequestMapping("/teacherListByTerm")
    175. @ResponseBody()
    176. public PageInfo teacherListByTerm(int page, int pageSize,String content) {
    177. return teacherService.searchTeacherByTerm(page,pageSize,content,0);
    178. }
    179. }

    如果也想学习本系统,下面领取。关注并回复:062ssm 

  • 相关阅读:
    Netty源码剖析之内存池和对象池设计流程
    网络编程(三)UDP TFTP协议
    22-框架
    装饰器模式
    【云原生 | 43】快速搭建Docker Registry私有仓库
    第 K 大的数
    mac 安装部署mongoDB社区版
    【ACWing】1176. 消息的传递
    libevent学习——辅助类型和函数
    创建线程的三种方式:继承Thread、Runnable 接口、Callable 接口
  • 原文地址:https://blog.csdn.net/hanyunlong1989/article/details/126719132