高软第四次作业
这次作业主要就是从需求分析到软件设计完成一个系统的设计,因为老师给的需求是设计一个图书馆系统,但是我想以之前的一个小项目进行复盘,这样的也能更加深入理解到整个系统的设计过程。本系统也是一个典型的管理系统,业务需求是学生信息管理平台。
1 需求分类
1.1 功能需求(Functional Requirement)
(1)管理员具有最高权限,可以对自身的信息进行修改;
(2)管理员可以对专业、班级、学生的信息进行增删查改以及选择性展示
(3)学生的权限只能查看专业、班级信息
(4)学生可以修改自己的信息
1.2 质量需求(Quality Requirement)
安全、可靠、易用、高性能、可维护、可移植、可测试、可扩展。
2 概念原型设计
2.1 用例图
2.2 功能实现时序图
登陆功能时序图:
管理员获取数据的操作时序图
管理员增加学生信息时序图:
管理员删除学生时序图:
学生操作自己数据的时序图
3、系统实现
UML类图:使用的IDEA的插件画的类图,很迷,生成有点乱,看来画类图这种东西还是应该在专业的软件进行。
@startuml +class SystemController { -UserService userService; -StudentServiceImpl studentService; +Map<String, String> login(HttpServletRequest request)//登录 +void getVerificationCode(HttpServletRequest request, HttpServletResponse response)//验证 + String loginOut(HttpServletRequest request)//退出 } +class StudentController { -ClazzService clazzService; -StudentService studentService; +ModelAndView list(ModelAndView model) //跳转到学生列表 +Map<String, Object> getList(HttpServletRequest request,Page page)//获取学生列表 +Map<String, String> add(Student student)//增加学生信息 +Map<String, String> edit(Student student)//修改学生信息 +Map<String, String> delete(Long[] ids)//批量删除学生信息 +Map<String, String> uploadPhoto(MultipartFile photo,HttpServletRequest request)//上传头像 } +class UserController { -UserServiceImpl userService; +ModelAndView list(ModelAndView model) //跳转到管理员列表 +Map<String, Object> getList(HttpServletRequest request,Page page)//获取学生列表 +Map<String, String> add(User user)//增加管理员信息 +Map<String, String> edit(User user)//修改管理员信息 +Map<String, String> delete(Long[] ids)//批量删除管理员信息 } +class MajorController { - MajorServiceImpl majorService; +ModelAndView list(ModelAndView model) //跳转到专业列表 +Map<String, Object> getList(HttpServletRequest request,Page page)//模糊查找获取专业列表 +Map<String, String> add(Major major)//增加专业信息 +Map<String, String> edit(Major major)//修改专业信息 +Map<String, String> delete(Long[] ids)//批量删除专业信息 } +class ClazzController { - MajorServiceImpl majorService; - ClazzService clazzService; +ModelAndView list(ModelAndView model) //跳转到班级列表 +Map<String, Object> getList(HttpServletRequest request,Page page)//模糊查找获取班级列表 +Map<String, String> add(Clazz clazz)//增加班级信息 +Map<String, String> edit(Clazz clazz)//修改班级信息 +Map<String, String> delete(Long[] ids)//批量删除专业信息 } ClazzController o--MajorService ClazzController o--ClazzService ClazzController-->Major ClazzController-->Clazz MajorController o--MajorServiceImpl MajorController-->Major StudentController o--ClazzService StudentController o--StudentService StudentController-->Clazz StudentController-->Student SystemController o--UserService SystemController o--SystemController SystemController-->Student SystemController-->User UserController o--UserService UserController-->User UserController -->Page SystemController -->Page StudentController -->Page MajorController -->Page ClazzController -->Page +interface IUserDao { User findByUserName(String username); int addUser(User user); List<User> findUserList(Map<String,Object> queryMap); int getUserTotal(Map<String, Object> queryMap); int edit(User user); int delete(String toString); } +interface IMajorDao { List<Major> findList(Map<String,Object> queryMap); int findTotal(Map<String, Object> queryMap); int add(Major major); int edit(Major major); int delete(String toString); } +interface IStudentDao { Student findByUserName(String username); int add(Student student); List<Student> findUserList(Map<String,Object> queryMap); int getUserTotal(Map<String, Object> queryMap); int edit(Student student); int delete(String toString); } +interface IClazzDao { int add(Clazz clazz); List<Clazz> findList(Map<String, Object> queryMap); int findTotal(Map<String, Object> queryMap); int delete(String idString); List<Clazz> findAll(); int edit(Clazz clazz); } +class Clazz{ - Long id; - Long majorId; - String name; - String remark; + Long getId() + void setId(Long id) + Long getMajorId() + void setMajorId(Long majorId) + String getName() + void setName(String name) + String getRemark() + void setRemark(String remark) } +class Major{ - Integer id; - String name; - String remark; + Integer getId() + void setId(Integer id) + String getName() + void setName(String name) + String getRemark() + void setRemark(String remark) } +class Page{ - int page; - int rows; - int offset; + int getPage() + int getOffset() + void setOffset(int offset) + void setPage(int page) + int getRows() + void setRows(int rows) } +class Student{ - Long id; - String sex; - String sn; - String password; - String username; - String photo; - Long clazzId; - String remark; + Long getId() + void setId(Long id) + String getSex() + String getSn() + void setSn(String sn) + String getPassword() + void setPassword(String password) + String getUsername() + void setUsername(String username) + String getPhoto() + void setPhoto(String photo) + Long getClazzId() + void setClazzId(Long clazzId) + String getRemark() + void setRemark(String remark) } +class User{ - Long id; - String username; - String password; + String toString() + Long getId() + void setId(Long id) + String getUsername() + void setUsername(String username) + String getPassword() + void setPassword(String password) } +interface ClazzService{ int add(Clazz clazz); List<Clazz> findList(Map<String, Object> queryMap); int findTotal(Map<String, Object> queryMap); int delete(String idToString); int edit(Clazz clazz); List<Clazz> findAll(); } +interface MajorService { + List<Major> findList(Map<String,Object>map); int findTotal(Map<String, Object> queryMap); int add(Major major); int edit(Major major); int delete(String ids); List<Major> findAll(); } +interface StudentService { int add(Student student); List<Clazz> findList(Map<String, Object> queryMap); int findTotal(Map<String, Object> queryMap); int delete(String idToString); int edit(Student student); Student findByStudentname(String username); Student findBySn(String sn); } +interface UserService { + User findUserByUsername(String username); + int addUser(User user); + List<User>findUserList(Map<String,Object>queryMap); int getUserTotal(Map<String, Object> queryMap); int edit(User user); int delete(String toString); } +class ClazzServiceImpl{ - IClazzDao clazzDao; + int add(Clazz clazz) + List<Clazz> findList(Map<String, Object> queryMap) + int findTotal(Map<String, Object> queryMap) + int delete(String idToString) + int edit(Clazz clazz) + List<Clazz> findAll() } +class MajorServiceImpl{ - IMajorDao majorDao; + List<Major> findList(Map<String, Object> map) + int findTotal(Map<String, Object> queryMap) + int add(Major major) + int edit(Major major) + int delete(String ids) + List<Major> findAll() } +class StudentServiceImpl{ - IStudentDao studentDao; + int add(Student student) + List<Clazz> findList(Map<String, Object> queryMap) + int findTotal(Map<String, Object> queryMap) + int delete(String idToString) + int edit(Student student) + Student findByStudentname(String s) + Student findBySn(String sn) } +class UserServiceImpl{ - IUserDao userDao; + User findUserByUsername(String username) + int addUser(User user) + List<User> findUserList(Map<String, Object> queryMap) + int getUserTotal(Map<String, Object> queryMap) + int edit(User user) + int delete(String toString) } ClazzService-->Clazz UserService-->User StudentService-->Student MajorService-->Major ClazzService<|..ClazzServiceImpl UserService<|.. UserServiceImpl StudentService<|..StudentServiceImpl MajorService<|..MajorServiceImpl ClazzServiceImpl o--IClazzDao MajorServiceImpl o--IMajorDao StudentServiceImpl o--IStudentDao UserServiceImpl o--IUserDao @enduml