170
社区成员




https://github.com/Noimp137/front
https://github.com/Noimp137/back
Modules | Task Description | Estimated Time | Actual Time |
Demand Analysis | Determine the requirements of the web page and the functions that can be achieved | 3 hour | 3 hour |
Database Design | Design database schema, including contact information | 25 hours | 25 hours |
Backend Development | Create a Spring Boot application and write an interface | 20 hours | 30 hours |
Front-end Development | Page design, front-end development using Vue | 20 hours | 30 hours |
Test | Test whether the web page meets expectations | 10 hours | 10 hours |
Deploy | Deploy the application to the server | 10 hours | 15 hours |
Total | 88 hours | 113 hours |
This system uses MYSQL open source database, the main reason for using it is because MYSQL data is small, fast, easy to connect, and will not contain high cost, but also open source, in the general small and medium-sized enterprises, they will choose MYSQL database as the website database MySQL. Will optimize the SQL query algorithm, effectively improve the query speed, and add, delete, modify and check. It can also provide support for multiple languages.
The core of J2EE is reflected in the standardization of technology and architecture, which includes various components, service architectures and technical levels, because they all have the same standards and specifications, and all programs that comply with the J2EE architecture have good compatibility between different platforms.
(1) Generate components that can be reused multiple times
Most JSP pages rely on reusable cross-platform components, such as JavaBeans components, to implement the more complex processing required by the application.
(2) Adopt identification to simplify development
You can build specific features, such as recognition. This will greatly improve the efficiency of development, but also can quickly build the dynamic web page developers need.
(3) Adaptation platform
Because JSP technology can adapt to a variety of development environments, but also written in JAVA language, it will have all the advantages of JAVA technology.
(4) The data link is JDBC technology
Because almost all developers now use ODBC to connect to the database, and in this way to connect to the database is simple and not locked, while connecting with other frameworks is not difficult
3.1 Overall Functional modules
The textbook management system developed can run normally on the specified software platform. The current textbook management system can run on a normal laptop computer, the operating system is Windows 10. There are no restrictions on the database, but based on the size of the database, processing speed and security, it is recommended to use a relational database.
The teaching material management system is mainly divided into two user roles: system administrator and teacher. As shown in Figure 3.1
Figure 3.1 Functional requirement analysis
(9) Textbook storage: the amount of textbook information that has been stored.
(10) Textbook inventory management: check the number of textbooks that have been stored.
(12) Collection record: record whether the textbook has been collected. As shown in Figure 3.2
Figure 3.2 System Administrator functions
.3 Teacher function module
The functions of the teacher are shown in Figure 3.3
Figure 3.3 Teacher function diagram
Configuring database connections
<beanid="dataSource"class="org.apache.commons.dbcp.BasicDataSource"destroy-method="close">
<property name="driverClassName"value="#{jdbc.driver}"/>
<property name= "url" value="#{jdbc.url}"/>
<property name="username"value="#{jdbc.user}"/>
<property name="password"value="#{jdbc.password}"/>
<property name="maxActive"value="#{jdbc.maxActive}"></property></bean>
Configure the information for a data source, that is, the connection information for the database, then configure the information for the sessionFactory, and finally pass
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.dao"/>
</bean>This configuration statement scans all configured mybatis configuration file information
Scan configuration components
<context:component-scan base-package="com.controller"/>
<! -- Configuring MVC Annotation Scanning -->
<mvc:annotation-driven />
<beanid="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="10000000"/>
<property name="defaultEncoding"value="UTF-8"/></bean>
This is the configuration file of Spring MVC. The main function of this file is to scan all the resource information of all the com.controller layer.
This chapter details the main features of the system and describes the functionality of each feature in code. And in each function module, how to complete this module
The main code of this page is: // login
@RequestMapping("/login.do")
public void login(HttpServletRequest request,HttpServletResponse response,String username,String password,String role){
PrintWriter writer = this.getPrintWriter(response);
User user = userService.userlogin(username, password,role);
if(user==null){
writer.print("<script language=javascript>alert('The user name or password is incorrect');window.location.href='login.jsp';</script>");
}else{HttpSession session = request.getSession();
session.setAttribute("manage", user);
writer.print("<script language=javascript>alert('Login successful');window.location.href='index.jsp';</script>");}}
This code is the teacher User login code, will be through the user user=userService.userlogin(username, password,role); To call the value of the database to determine whether the user exists, if the verification is successful, the login is successful, and jump to the index.jsp page.
Figure 6.2 Class information management
Figure 6.3 Course information management
Figure 6.4 Teacher information management
主要代码://教师信息列表
@RequestMapping("/teacherlist.do")
public String teacherlist(HttpServletRequest request,String pagenum,String classname,String jobno,String cname){
…….
if (pagenum != null) {
currentpage = Integer.parseInt(pagenum);}//组装查询的sql语句
StringBuffer sb = new StringBuffer();
sb.append(" select * from t_teacher where ");//查询条件返回页面
if (jobno != null && !"".equals(jobno)) {
sb.append(" jobno like '%"+jobno+"%' ");
sb.append(" and ");
request.setAttribute("jobno", jobno);}
if (cname != null && !"".equals(cname)) {
sb.append(" cname like '%"+cname+"%' ");
sb.append(" and ");
request.setAttribute("cname", cname);}
sb.append(" 1=1 order by id desc ");
String sql = sb.toString();//查询列表
Map<String,List<Teacher>> map = teacherService.selectBeanMap(currentpage,pageSize,url,sql);
String pagerinfo = map.keySet().iterator().next();";}
4.6 Textbook information management
Textbook information management page, increase, reduce, modify, search required textbooks, query required textbooks. When adding textbooks, you should fill in the textbook name, textbook compilation, textbook category, textbook name, author, publisher and unit price. At the same time, you can click the View button to view the textbook information. Every time the super administrator adds a text message, the same record will appear on the teacher user side. The teacher user will select the new teaching material information displayed, select the required teaching material and feedback it to the Academic Affairs Office for review, and the super user can also veto the teacher's review and let the teacher choose the teaching material again.
And through code teacherService. SelectBeanList method to invoke the database query method to check the qualified record, through the request. The setAttribute method to query to record to display the page. Also return "teacherlist.jsp"; Specify which JSP page is returned to a specific designation, as shown in Figure 6.5 Textbook Information Management.
此页面主要代码://教材信息列表
@RequestMapping("/booklist.do")
public String booklist(HttpServletRequest request,String pagenum,String bnumber,String bname,String cname){
String url = "book/booklist.do";
……
sb.append(" bnumber like '%"+bnumber+"%' ");
sb.append(" and ");
request.setAttribute("bnumber", bnumber);}
if (bname != null && !"".equals(bname)) {
sb.append(" bname like '%"+bname+"%' ");
sb.append(" and ");
request.setAttribute("bname", bname);}
if (cname != null && !"".equals(cname)) {
sb.append(" cname like '%"+cname+"%' ");
sb.append(" and ");
request.setAttribute("cname", cname);}
sb.append(" 1=1 order by id desc ");
String sql = sb.toString();//查询列表
Map<String,List<Book>> map = bookService.selectBeanMap(currentpage,pageSize,url,sql);
String pagerinfo = map.keySet().iterator().next();
List<Book> list = map.get(pagerinfo);//列表返回页面
……..
return "booklist.jsp";}
首先获得bnumber、bname 、cname 的值,然后通过if(bnumber!=null&&!"".equals(bnumber)){if(bname !=null&&!"".equals(bname )){if(cname !=null&&!"".equals(cname )){通过这句条件语句分别判断下这个值是否为空,根据命令代码bookService.selectBeanList方法调用数据库中的查询方法来查到符合条件的信息记录,在根据request.setAttribute方法把查询到的记录传到显示的页面。同时通过return "booklist.jsp";指定传回到具体指定的是哪个JSP页面。
Figure 6.7 Query for selected textbooks
Figure 6.8 Ordering teaching materials
Figure 6.9 Textbook ordering management
Figure 6.2 Storage management of teaching materials
Figure 6.3 Textbook inventory management
Table 7.1 User Information test Table
测试功能 |
业主信息 |
模块功能 |
用户信息的查询和编辑 |
测试目的 |
是否正常删除一条信息 |
输入数据 |
按照姓名查询一条用户信息,比如查询1001,显示教师信息后点击删除 |
预期结果 |
显示删除成功 |
输出结果 |
删除成功别切删除的业主信息无法找到 |
Login: Input such as account number, account password, and then click login for operation, there will be two cases: one case is successful login, enter the user's corresponding functional interface to make the next arrangement, data screening; The other case indicates that the login is unsuccessful, and the system will pop up a dialog box asking for re-login operation and clear the input information in the login bar.
Test Case 2 and test process:
Administrator login: Enter the account, password, and permission, and then click login to perform operations, there will be two cases: successful login to the administrator has permission to enter the function interface and prompt login failure or teacher login information page. In one case, the login succeeds and the administrator page is displayed for the next step. In the other case, a message indicating a login failure is displayed, and a dialog box is displayed asking you to log in again.
Detailed operations will be carried out according to the main contents of Test 1 and Test 2, and whether user information can be logged in, as shown in Table 7.2.
Table 7.2 User Login test table
功能特性 |
用户登录验证 | ||||
测试目的 |
验证是否输入合法的信息 | ||||
测试数据 |
用户名称:1111 密码:1111 | ||||
测试内容 |
操作描述 |
数据 |
期望结果 |
实际结果 |
测试状态 |
1 |
输入用户姓名,按“登陆”按钮。 |
用户姓名:1111, 密码为空 |
显示警告信息“用户名或密码误!” |
显示警告信息“用户名或密码误!” |
与期望结果相同 |
2 |
输入密码,按“登陆”按钮。 |
用户姓名为空,密码:1111 |
显示警告信息“用户名或密码误!” |
显示警告信息“用户名或密码误!” |
与期望结果相同 |
3 |
输入用户姓名和密码,按“登陆”按钮。 |
用户姓名:1, 密 码:1 |
显示警告信息“用户名或密码误!” |
显示警告信息“用户名或密码误” |
与期望结果相同 |
4 |
输入用户姓名和密码,按“登陆”按钮。 |
用户名:1111,密 码:1111 |
正确登入到会员操作界面 |
正确登入到会员操作界面 |
与期望结果相同 |