learn02
This commit is contained in:
parent
addf9b30f6
commit
7b582071cc
@ -25,5 +25,20 @@
|
|||||||
</jdbc-additional-properties>
|
</jdbc-additional-properties>
|
||||||
<working-dir>$ProjectFileDir$</working-dir>
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
</data-source>
|
</data-source>
|
||||||
|
<data-source source="LOCAL" name="db_student" uuid="e52053d6-7a76-429a-af2f-d7d197f5a15d">
|
||||||
|
<driver-ref>sqlite.xerial</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:sqlite:F:\Work_Area\desk\java\web实验\test05\src\main\resources\db\db_student.db</jdbc-url>
|
||||||
|
<jdbc-additional-properties>
|
||||||
|
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||||
|
</jdbc-additional-properties>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
<libraries>
|
||||||
|
<library>
|
||||||
|
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/xerial/sqlite-jdbc/3.45.1.0/sqlite-jdbc-3.47.0.0.jar</url>
|
||||||
|
</library>
|
||||||
|
</libraries>
|
||||||
|
</data-source>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@ -1,31 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="Encoding" native2AsciiForPropertiesFiles="true" defaultCharsetForPropertiesFiles="GBK">
|
<component name="Encoding" native2AsciiForPropertiesFiles="true" defaultCharsetForPropertiesFiles="GBK">
|
||||||
<file url="file://$PROJECT_DIR$/.gitignore" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn02/web/js/course-edit.js" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/learn02/web/js/course-edit.js" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/learn02/web/js/index.js" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/learn02/web/js/index.js" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/Learn03SpringbootApplication.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/ServletInitializer.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/common/DBTool.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/controller/CourseController.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/controller/HelloController.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/dao/CourseDB.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/dao/ScoreDB.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/dao/StudentDB.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/dao/TeacherDB.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/dao/UserDB.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/dao/impl/CourseDBImpl.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/dao/impl/TeacherDBImpl.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/dao/impl/UserDBImpl.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/pojo/Course.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/pojo/CourseInfo.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/pojo/Result.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/pojo/ScoreInfo.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/pojo/StudentInfo.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/pojo/TeacherInfo.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/main/java/top/awin_x/learn/pojo/UserInfo.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn03-springboot/src/test/java/top/awin_x/learn/Learn03SpringbootApplicationTests.java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/learn1/web/js/course-edit.js" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/learn1/web/js/course-edit.js" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/learn1/web/js/index.js" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/learn1/web/js/index.js" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/test05/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/test05/src/main/java" charset="UTF-8" />
|
||||||
|
|||||||
@ -4,6 +4,9 @@
|
|||||||
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,java.sql.Connection,prepareStatement,java.lang.ClassLoader,getResourceAsStream,org.apache.commons.dbcp2.BasicDataSourceFactory,createDataSource" />
|
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,java.sql.Connection,prepareStatement,java.lang.ClassLoader,getResourceAsStream,org.apache.commons.dbcp2.BasicDataSourceFactory,createDataSource" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
|
<inspection_tool class="CommentedOutCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||||
|
<option name="minLines" value="10" />
|
||||||
|
</inspection_tool>
|
||||||
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
|
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
<option name="myValues">
|
<option name="myValues">
|
||||||
<value>
|
<value>
|
||||||
|
|||||||
@ -5,15 +5,9 @@
|
|||||||
<option name="originalFiles">
|
<option name="originalFiles">
|
||||||
<list>
|
<list>
|
||||||
<option value="$PROJECT_DIR$/learn03/pom.xml" />
|
<option value="$PROJECT_DIR$/learn03/pom.xml" />
|
||||||
<option value="$PROJECT_DIR$/learn03-springboot/pom.xml" />
|
|
||||||
<option value="$PROJECT_DIR$/test05/pom.xml" />
|
<option value="$PROJECT_DIR$/test05/pom.xml" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
<option name="ignoredFiles">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$/learn03-springboot/pom.xml" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="temurin-21" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="temurin-21" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
|||||||
@ -7,7 +7,6 @@
|
|||||||
<module fileurl="file://$PROJECT_DIR$/learn1/learn1.iml" filepath="$PROJECT_DIR$/learn1/learn1.iml" />
|
<module fileurl="file://$PROJECT_DIR$/learn1/learn1.iml" filepath="$PROJECT_DIR$/learn1/learn1.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/test02/test02.iml" filepath="$PROJECT_DIR$/test02/test02.iml" />
|
<module fileurl="file://$PROJECT_DIR$/test02/test02.iml" filepath="$PROJECT_DIR$/test02/test02.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/test04/test04.iml" filepath="$PROJECT_DIR$/test04/test04.iml" />
|
<module fileurl="file://$PROJECT_DIR$/test04/test04.iml" filepath="$PROJECT_DIR$/test04/test04.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/web实验.iml" filepath="$PROJECT_DIR$/.idea/web实验.iml" />
|
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@ -12,7 +12,11 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<% UserDB dbBean = new UserDB();
|
<% UserDB dbBean = new UserDB();
|
||||||
|
try {
|
||||||
dbBean.ShowCommonUsers();
|
dbBean.ShowCommonUsers();
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import java.util.Properties;
|
|||||||
* @author Awin-x
|
* @author Awin-x
|
||||||
*/
|
*/
|
||||||
public class DBTool {
|
public class DBTool {
|
||||||
static DataSource ds;
|
static final DataSource ds;
|
||||||
static{
|
static{
|
||||||
Properties prop = new Properties();
|
Properties prop = new Properties();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -1,12 +1,6 @@
|
|||||||
package controller;
|
package controller;
|
||||||
|
|
||||||
import jakarta.servlet.ServletException;
|
|
||||||
import jakarta.servlet.annotation.WebServlet;
|
import jakarta.servlet.annotation.WebServlet;
|
||||||
import jakarta.servlet.http.HttpServlet;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@WebServlet("/scoreAction/*")
|
@WebServlet("/scoreAction/*")
|
||||||
public class ScoreController extends BaseController {
|
public class ScoreController extends BaseController {
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
package controller;
|
package controller;
|
||||||
|
|
||||||
import dao.TeacherDB;
|
|
||||||
import jakarta.servlet.annotation.WebServlet;
|
import jakarta.servlet.annotation.WebServlet;
|
||||||
import jakarta.servlet.http.HttpServlet;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import pojo.TeacherInfo;
|
import pojo.TeacherInfo;
|
||||||
|
|||||||
@ -1,11 +1,6 @@
|
|||||||
package controller;
|
package controller;
|
||||||
|
|
||||||
import jakarta.servlet.annotation.WebServlet;
|
import jakarta.servlet.annotation.WebServlet;
|
||||||
import jakarta.servlet.http.HttpServlet;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
|
|
||||||
@WebServlet("/teacherAction/*")
|
@WebServlet("/teacherAction/*")
|
||||||
public class TeacherController extends BaseController {
|
public class TeacherController extends BaseController {
|
||||||
|
|||||||
@ -2,13 +2,11 @@ package controller;
|
|||||||
|
|
||||||
import dao.impl.UserDBImpl;
|
import dao.impl.UserDBImpl;
|
||||||
import jakarta.servlet.annotation.WebServlet;
|
import jakarta.servlet.annotation.WebServlet;
|
||||||
import jakarta.servlet.http.HttpServlet;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import pojo.UserInfo;
|
import pojo.UserInfo;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
|
|
||||||
@WebServlet("/userAction/*")
|
@WebServlet("/userAction/*")
|
||||||
public class UserController extends BaseController {
|
public class UserController extends BaseController {
|
||||||
|
|||||||
@ -13,7 +13,7 @@ public class UserDBImpl implements UserDB {
|
|||||||
@Override
|
@Override
|
||||||
public UserInfo getUserByName(String username) {
|
public UserInfo getUserByName(String username) {
|
||||||
UserInfo u = new UserInfo();
|
UserInfo u = new UserInfo();
|
||||||
ResultSet rs = null;
|
ResultSet rs;
|
||||||
try{
|
try{
|
||||||
String sql = "select * from t_user where VC_LOGIN_NAME = ?";
|
String sql = "select * from t_user where VC_LOGIN_NAME = ?";
|
||||||
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
||||||
@ -36,7 +36,7 @@ public class UserDBImpl implements UserDB {
|
|||||||
@Override
|
@Override
|
||||||
public UserInfo getUserById(int id) {
|
public UserInfo getUserById(int id) {
|
||||||
UserInfo u = new UserInfo();
|
UserInfo u = new UserInfo();
|
||||||
ResultSet rs = null;
|
ResultSet rs;
|
||||||
try{
|
try{
|
||||||
String sql = "select * from t_user where N_USER_ID = ?";
|
String sql = "select * from t_user where N_USER_ID = ?";
|
||||||
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
||||||
@ -58,7 +58,7 @@ public class UserDBImpl implements UserDB {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int addUser(UserInfo user) {
|
public int addUser(UserInfo user) {
|
||||||
int lines = 0;
|
int lines;
|
||||||
String sql = "INSERT INTO t_user (VC_LOGIN_NAME, VC_PASSWORD) VALUES (?, ?)";
|
String sql = "INSERT INTO t_user (VC_LOGIN_NAME, VC_PASSWORD) VALUES (?, ?)";
|
||||||
try{
|
try{
|
||||||
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
||||||
@ -73,7 +73,7 @@ public class UserDBImpl implements UserDB {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateUser(UserInfo user) {
|
public int updateUser(UserInfo user) {
|
||||||
int lines = 0;
|
int lines;
|
||||||
String sql = "UPDATE t_user SET VC_PASSWORD = ?,VC_LOGIN_NAME = ? WHERE N_USER_ID = ?";
|
String sql = "UPDATE t_user SET VC_PASSWORD = ?,VC_LOGIN_NAME = ? WHERE N_USER_ID = ?";
|
||||||
try{
|
try{
|
||||||
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
||||||
@ -94,7 +94,7 @@ public class UserDBImpl implements UserDB {
|
|||||||
try{
|
try{
|
||||||
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
||||||
ps.setInt(1, id);
|
ps.setInt(1, id);
|
||||||
lines = ps.executeUpdate();
|
ps.executeUpdate();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
package filters;
|
package filters;
|
||||||
|
|
||||||
import jakarta.servlet.*;
|
import jakarta.servlet.*;
|
||||||
import jakarta.servlet.annotation.WebFilter;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
<%--suppress HtmlUnknownAttribute --%>
|
||||||
<%--
|
<%--
|
||||||
Created by IntelliJ IDEA.
|
Created by IntelliJ IDEA.
|
||||||
User: 25589
|
User: 25589
|
||||||
@ -31,6 +32,7 @@
|
|||||||
<td>开设年级</td>
|
<td>开设年级</td>
|
||||||
<td>开设专业</td>
|
<td>开设专业</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<%--suppress HtmlUnknownAttribute --%>
|
||||||
<tr v-for="course in courses">
|
<tr v-for="course in courses">
|
||||||
<td>{{course.name}}</td>
|
<td>{{course.name}}</td>
|
||||||
<td>{{types[course.type]}}</td>
|
<td>{{types[course.type]}}</td>
|
||||||
@ -38,7 +40,9 @@
|
|||||||
<td>{{course.grade}}</td>
|
<td>{{course.grade}}</td>
|
||||||
<td>{{majors[course.major]}}</td>
|
<td>{{majors[course.major]}}</td>
|
||||||
<td>
|
<td>
|
||||||
|
<%--suppress HtmlUnknownAttribute --%>
|
||||||
<a class="blue" @click="edit()">编辑</a>
|
<a class="blue" @click="edit()">编辑</a>
|
||||||
|
<%--suppress HtmlUnknownAttribute --%>
|
||||||
<a class="red" :href="path+'/courseAction/delete?id='+course.id">删除</a>
|
<a class="red" :href="path+'/courseAction/delete?id='+course.id">删除</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -54,9 +54,3 @@ button,.button{
|
|||||||
color: blue;
|
color: blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
.underline {
|
|
||||||
BORDER-BOTTOM: #c4c4c4 1pt solid;
|
|
||||||
BORDER-LEFT: #c4c4c4;
|
|
||||||
BORDER-RIGHT: #c4c4c4;
|
|
||||||
BORDER-TOP: #c4c4c4;
|
|
||||||
}
|
|
||||||
@ -27,7 +27,9 @@
|
|||||||
<input type="text" v-model="message">
|
<input type="text" v-model="message">
|
||||||
</label>
|
</label>
|
||||||
{{ message }}
|
{{ message }}
|
||||||
|
<%--suppress HtmlUnknownAttribute --%>
|
||||||
<h3 v-if="message === 'Hello vue'">这是Hello vue</h3>
|
<h3 v-if="message === 'Hello vue'">这是Hello vue</h3>
|
||||||
|
<%--suppress HtmlUnknownAttribute --%>
|
||||||
<h3 v-else>这不是Hello vue</h3>
|
<h3 v-else>这不是Hello vue</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import java.util.Properties;
|
|||||||
* @author Awin-x
|
* @author Awin-x
|
||||||
*/
|
*/
|
||||||
public class DBTool {
|
public class DBTool {
|
||||||
static DataSource ds;
|
static final DataSource ds;
|
||||||
static{
|
static{
|
||||||
Properties prop = new Properties();
|
Properties prop = new Properties();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import jakarta.servlet.annotation.WebServlet;
|
|||||||
import jakarta.servlet.http.HttpServlet;
|
import jakarta.servlet.http.HttpServlet;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import login.UserInfo;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
@WebServlet("/CourseDeleteAction")
|
@WebServlet("/CourseDeleteAction")
|
||||||
public class CourseDeleteAction extends HttpServlet {
|
public class CourseDeleteAction extends HttpServlet {
|
||||||
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||||
String path = req.getContextPath();
|
String path = req.getContextPath();
|
||||||
if (req.getSession().getAttribute("user") == null){
|
if (req.getSession().getAttribute("user") == null){
|
||||||
resp.sendRedirect(path+"/login/login.jsp");
|
resp.sendRedirect(path+"/login/login.jsp");
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
@WebServlet("/CourseEditAction")
|
@WebServlet("/CourseEditAction")
|
||||||
public class CourseEditAction extends HttpServlet {
|
public class CourseEditAction extends HttpServlet {
|
||||||
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||||
String path = req.getContextPath();
|
String path = req.getContextPath();
|
||||||
if (req.getSession().getAttribute("user") == null){
|
if (req.getSession().getAttribute("user") == null){
|
||||||
resp.setStatus(403);
|
resp.setStatus(403);
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
@WebServlet("/CourseListAction")
|
@WebServlet("/CourseListAction")
|
||||||
public class CourseListAction extends HttpServlet {
|
public class CourseListAction extends HttpServlet {
|
||||||
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||||
String path = req.getContextPath();
|
String path = req.getContextPath();
|
||||||
if (req.getSession().getAttribute("user") == null){
|
if (req.getSession().getAttribute("user") == null){
|
||||||
resp.setStatus(403);
|
resp.setStatus(403);
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import java.sql.SQLException;
|
|||||||
public class UserDB {
|
public class UserDB {
|
||||||
public static UserInfo GetUserInfo(int id) {
|
public static UserInfo GetUserInfo(int id) {
|
||||||
UserInfo u = new UserInfo();
|
UserInfo u = new UserInfo();
|
||||||
ResultSet rs = null;
|
ResultSet rs;
|
||||||
try{
|
try{
|
||||||
String sql = "select * from t_user where N_USER_ID = ?";
|
String sql = "select * from t_user where N_USER_ID = ?";
|
||||||
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
||||||
@ -30,7 +30,7 @@ public class UserDB {
|
|||||||
}
|
}
|
||||||
public static UserInfo GetUserInfoByName(String username) {
|
public static UserInfo GetUserInfoByName(String username) {
|
||||||
UserInfo u = new UserInfo();
|
UserInfo u = new UserInfo();
|
||||||
ResultSet rs = null;
|
ResultSet rs;
|
||||||
try{
|
try{
|
||||||
String sql = "select * from t_user where VC_LOGIN_NAME = ?";
|
String sql = "select * from t_user where VC_LOGIN_NAME = ?";
|
||||||
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
PreparedStatement ps = DBTool.getPreparedStatement(sql);
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
@WebServlet("/UserLogoutAction")
|
@WebServlet("/UserLogoutAction")
|
||||||
public class UserLogoutAction extends HttpServlet {
|
public class UserLogoutAction extends HttpServlet {
|
||||||
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
String username = request.getParameter("username");
|
String username = request.getParameter("username");
|
||||||
UserInfo user = (UserInfo)request.getSession().getAttribute("user");
|
UserInfo user = (UserInfo)request.getSession().getAttribute("user");
|
||||||
if(user != null) {
|
if(user != null) {
|
||||||
|
|||||||
@ -54,9 +54,3 @@ button,.button{
|
|||||||
color: blue;
|
color: blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
.underline {
|
|
||||||
BORDER-BOTTOM: #c4c4c4 1pt solid;
|
|
||||||
BORDER-LEFT: #c4c4c4;
|
|
||||||
BORDER-RIGHT: #c4c4c4;
|
|
||||||
BORDER-TOP: #c4c4c4;
|
|
||||||
}
|
|
||||||
@ -17,24 +17,10 @@ table{
|
|||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.td1 {
|
|
||||||
BACKGROUND-COLOR: #e6e6e6
|
|
||||||
}
|
|
||||||
.td_header {
|
.td_header {
|
||||||
BACKGROUND-COLOR: #e6e6e6; COLOR: #000000
|
BACKGROUND-COLOR: #e6e6e6; COLOR: #000000
|
||||||
}
|
}
|
||||||
.td_1 {
|
|
||||||
BACKGROUND-COLOR: #f8fbfb; COLOR: #000000
|
|
||||||
}
|
|
||||||
.td_2 {
|
|
||||||
BACKGROUND-COLOR: #deecec; COLOR: #000000
|
|
||||||
}
|
|
||||||
.td3 {
|
|
||||||
BACKGROUND-COLOR: #a3d1d2; COLOR: black
|
|
||||||
}
|
|
||||||
.underline {
|
|
||||||
BORDER-BOTTOM: #c4c4c4 1pt solid; BORDER-LEFT: #c4c4c4; BORDER-RIGHT: #c4c4c4; BORDER-TOP: #c4c4c4
|
|
||||||
}
|
|
||||||
.button {
|
.button {
|
||||||
border:1px solid black;
|
border:1px solid black;
|
||||||
background-color:white;
|
background-color:white;
|
||||||
@ -43,12 +29,7 @@ table{
|
|||||||
.star {
|
.star {
|
||||||
COLOR: red
|
COLOR: red
|
||||||
}
|
}
|
||||||
.tb_showall
|
|
||||||
{
|
|
||||||
background:#0078B7;
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.container{
|
.container{
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
<%--suppress HtmlUnknownTarget --%>
|
||||||
<%--
|
<%--
|
||||||
Created by IntelliJ IDEA.
|
Created by IntelliJ IDEA.
|
||||||
User: 25589
|
User: 25589
|
||||||
|
|||||||
@ -21,20 +21,11 @@ public class DBTool {
|
|||||||
conn = DriverManager.getConnection(url, username, password);
|
conn = DriverManager.getConnection(url, username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public ResultSet doQuery(String sql) throws SQLException {
|
|
||||||
// rs = stmt.executeQuery(sql);
|
|
||||||
// return rs;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public ResultSet runSQL(PreparedStatement ps) throws SQLException {
|
public ResultSet runSQL(PreparedStatement ps) throws SQLException {
|
||||||
rs = ps.executeQuery();
|
rs = ps.executeQuery();
|
||||||
return rs;
|
return rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public int doUpdate(String sql) throws SQLException {
|
|
||||||
// return stmt.executeUpdate(sql);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void close() throws SQLException {
|
public void close() throws SQLException {
|
||||||
if(rs!=null){
|
if(rs!=null){
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
@WebServlet("/courseAddAction")
|
@WebServlet("/courseAddAction")
|
||||||
public class courseAddAction extends HttpServlet {
|
public class courseAddAction extends HttpServlet {
|
||||||
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||||
courseDB coursedb = new courseDB();
|
courseDB coursedb = new courseDB();
|
||||||
int id = Integer.parseInt(req.getParameter("id"));
|
int id = Integer.parseInt(req.getParameter("id"));
|
||||||
courseInfo course = new courseInfo();
|
courseInfo course = new courseInfo();
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
@WebServlet("/courseDeleteAction")
|
@WebServlet("/courseDeleteAction")
|
||||||
public class courseDeleteAction extends HttpServlet {
|
public class courseDeleteAction extends HttpServlet {
|
||||||
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||||
int id = Integer.parseInt(req.getParameter("id"));
|
int id = Integer.parseInt(req.getParameter("id"));
|
||||||
courseDB coursedb = new courseDB();
|
courseDB coursedb = new courseDB();
|
||||||
coursedb.deleteCourse(id);
|
coursedb.deleteCourse(id);
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
@WebServlet("/courseEditAction")
|
@WebServlet("/courseEditAction")
|
||||||
public class courseEditAction extends HttpServlet {
|
public class courseEditAction extends HttpServlet {
|
||||||
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||||
courseDB coursedb = new courseDB();
|
courseDB coursedb = new courseDB();
|
||||||
int id = Integer.parseInt(req.getParameter("id"));
|
int id = Integer.parseInt(req.getParameter("id"));
|
||||||
courseInfo course = coursedb.getCourseInfo(id);
|
courseInfo course = coursedb.getCourseInfo(id);
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
@WebServlet("/courseListAction")
|
@WebServlet("/courseListAction")
|
||||||
public class courseListAction extends HttpServlet {
|
public class courseListAction extends HttpServlet {
|
||||||
protected void service(HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException {
|
protected void service(HttpServletRequest req, HttpServletResponse rsp) throws IOException {
|
||||||
courseDB coursedb = new courseDB();
|
courseDB coursedb = new courseDB();
|
||||||
ArrayList<courseInfo> course_list = coursedb.getAllCourses();
|
ArrayList<courseInfo> course_list = coursedb.getAllCourses();
|
||||||
StringBuilder json= new StringBuilder("[");
|
StringBuilder json= new StringBuilder("[");
|
||||||
|
|||||||
@ -13,24 +13,10 @@ table{
|
|||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.td1 {
|
|
||||||
BACKGROUND-COLOR: #e6e6e6
|
|
||||||
}
|
|
||||||
.td_header {
|
.td_header {
|
||||||
BACKGROUND-COLOR: #e6e6e6; COLOR: #000000
|
BACKGROUND-COLOR: #e6e6e6; COLOR: #000000
|
||||||
}
|
}
|
||||||
.td_1 {
|
|
||||||
BACKGROUND-COLOR: #f8fbfb; COLOR: #000000
|
|
||||||
}
|
|
||||||
.td_2 {
|
|
||||||
BACKGROUND-COLOR: #deecec; COLOR: #000000
|
|
||||||
}
|
|
||||||
.td3 {
|
|
||||||
BACKGROUND-COLOR: #a3d1d2; COLOR: black
|
|
||||||
}
|
|
||||||
.underline {
|
|
||||||
BORDER-BOTTOM: #c4c4c4 1pt solid; BORDER-LEFT: #c4c4c4; BORDER-RIGHT: #c4c4c4; BORDER-TOP: #c4c4c4
|
|
||||||
}
|
|
||||||
.button {
|
.button {
|
||||||
border:1px solid black;
|
border:1px solid black;
|
||||||
background-color:white;
|
background-color:white;
|
||||||
@ -39,12 +25,7 @@ table{
|
|||||||
.star {
|
.star {
|
||||||
COLOR: red
|
COLOR: red
|
||||||
}
|
}
|
||||||
.tb_showall
|
|
||||||
{
|
|
||||||
background:#0078B7;
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.container{
|
.container{
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
|||||||
@ -83,12 +83,6 @@
|
|||||||
<artifactId>jjwt</artifactId>
|
<artifactId>jjwt</artifactId>
|
||||||
<version>0.12.3</version>
|
<version>0.12.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>top.awin-x</groupId>
|
|
||||||
<artifactId>learn03-springboot</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.alibaba.fastjson2/fastjson2 -->
|
<!-- https://mvnrepository.com/artifact/com.alibaba.fastjson2/fastjson2 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.fastjson2</groupId>
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
@ -99,6 +93,13 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-aop</artifactId>
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.realityforge.org.jetbrains.annotations/org.jetbrains.annotations -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.realityforge.org.jetbrains.annotations</groupId>
|
||||||
|
<artifactId>org.jetbrains.annotations</artifactId>
|
||||||
|
<version>1.7.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package test05;
|
|||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class Test05Application {
|
public class Test05Application {
|
||||||
|
|||||||
@ -15,7 +15,7 @@ public class TimeAspect {
|
|||||||
long begin = System.currentTimeMillis();
|
long begin = System.currentTimeMillis();
|
||||||
Object result = joinPoint.proceed();
|
Object result = joinPoint.proceed();
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
log.info(joinPoint.getSignature()+"耗时:{}ms", end-begin);
|
log.info("{}耗时:{}ms", joinPoint.getSignature(), end - begin);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
69
test05/src/main/java/test05/config/DatabaseConfig.java
Normal file
69
test05/src/main/java/test05/config/DatabaseConfig.java
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
package test05.config;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import test05.Test05Application;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class DatabaseConfig {
|
||||||
|
|
||||||
|
// @Autowired 可以注入bean
|
||||||
|
// ISysUserService userService;
|
||||||
|
DruidDataSource ds;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DatabaseConfig(DruidDataSource ds) {
|
||||||
|
this.ds = ds;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() throws InterruptedException, IOException, SQLException {
|
||||||
|
//启动时输入数据库连接地址
|
||||||
|
// BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||||
|
// System.out.println("请输入数据库连接地址");
|
||||||
|
// String buf = br.readLine();
|
||||||
|
// System.out.println(buf);
|
||||||
|
// ds.setUrl(buf);
|
||||||
|
// buf = br.readLine();
|
||||||
|
// ds.setUsername(buf);
|
||||||
|
// buf = br.readLine();
|
||||||
|
// ds.setPassword(buf);
|
||||||
|
System.out.println(System.getProperty("user.dir"));
|
||||||
|
String workingDir = System.getProperty("user.dir");
|
||||||
|
if (new File(workingDir+"\\db_student.db").exists()) {
|
||||||
|
ds.restart();
|
||||||
|
ds.setDriverClassName("org.sqlite.JDBC");
|
||||||
|
ds.setUrl("jdbc:sqlite:"+workingDir+"\\db_student.db");
|
||||||
|
System.out.println("使用外部数据库文件!");
|
||||||
|
}else{
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||||
|
System.out.println("请选择数据库(1:mysql,2:sqlite)");
|
||||||
|
int type = Integer.parseInt(br.readLine());
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
ds.setDriverClassName("com.mysql.jdbc.Driver");
|
||||||
|
System.out.println("请输入数据库url(仅地址),留空使用localhost:3306");
|
||||||
|
String url= br.readLine();
|
||||||
|
ds.setUrl("jdbc:mysql:"+(url.isEmpty()?"localhost:3306":url)+(url.endsWith("/")?"":"/")+"db_student");
|
||||||
|
System.out.println("请输入用户名:");
|
||||||
|
String username=br.readLine();
|
||||||
|
ds.setUsername(username);
|
||||||
|
System.out.println("请输入密码:");
|
||||||
|
String password=br.readLine();
|
||||||
|
ds.setPassword(password);
|
||||||
|
case 2:
|
||||||
|
System.out.println("使用内嵌测试数据,修改将不会被保存!");
|
||||||
|
ds.setDriverClassName("org.sqlite.JDBC");
|
||||||
|
ds.setUrl("jdbc:sqlite::resource:db/db_student.db");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,7 +3,6 @@ package test05.config;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
import test05.interceptor.LoginCheckInterceptor;
|
import test05.interceptor.LoginCheckInterceptor;
|
||||||
|
|
||||||
@ -18,6 +17,6 @@ public class WebConfig implements WebMvcConfigurer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
registry.addInterceptor(loginCheckInterceptor).addPathPatterns("/**").excludePathPatterns("/userAction/login");
|
registry.addInterceptor(loginCheckInterceptor).addPathPatterns("/*Action/**").excludePathPatterns("/userAction/login");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import test05.service.CourseService;
|
|||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/courseAction")
|
@RequestMapping("/courseAction")
|
||||||
@CrossOrigin
|
|
||||||
public class CourseController {
|
public class CourseController {
|
||||||
private final CourseService courseService;
|
private final CourseService courseService;
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package test05.controller;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@SuppressWarnings("SameReturnValue")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/test")
|
@RequestMapping("/test")
|
||||||
public class Hello {
|
public class Hello {
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package test05.controller;
|
package test05.controller;
|
||||||
|
|
||||||
import io.jsonwebtoken.Jwt;
|
|
||||||
import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
@ -15,7 +14,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/userAction")
|
@RequestMapping("/userAction")
|
||||||
@CrossOrigin
|
|
||||||
public class LoginController {
|
public class LoginController {
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -23,11 +21,10 @@ public class LoginController {
|
|||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@CrossOrigin
|
|
||||||
@RequestMapping("/login")
|
@RequestMapping("/login")
|
||||||
public Result login(String username, String password, HttpSession session) {
|
public Result login(String username, String password, HttpSession session) {
|
||||||
if (session.getAttribute("user") != null) {
|
if (session.getAttribute("user") != null) {
|
||||||
String loginName = ((Map<String, String>)(JwtUtils.parseJwt((String)session.getAttribute("user")).get("data"))).get("name");
|
@SuppressWarnings("unchecked") String loginName = ((Map<String, String>)(JwtUtils.parseJwt((String)session.getAttribute("user")).get("data"))).get("name");
|
||||||
if (loginName.equals(username)) {
|
if (loginName.equals(username)) {
|
||||||
return Result.success(session.getAttribute("user"));
|
return Result.success(session.getAttribute("user"));
|
||||||
}
|
}
|
||||||
@ -42,7 +39,6 @@ public class LoginController {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@CrossOrigin
|
|
||||||
@RequestMapping("/logout")
|
@RequestMapping("/logout")
|
||||||
public Result logout(HttpSession session) {
|
public Result logout(HttpSession session) {
|
||||||
session.removeAttribute("user");
|
session.removeAttribute("user");
|
||||||
|
|||||||
34
test05/src/main/java/test05/controller/ScoreController.java
Normal file
34
test05/src/main/java/test05/controller/ScoreController.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package test05.controller;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import test05.pojo.Result;
|
||||||
|
import test05.pojo.Score;
|
||||||
|
import test05.service.ScoreService;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/scoreAction")
|
||||||
|
public class ScoreController {
|
||||||
|
ScoreService scoreService;
|
||||||
|
@Autowired
|
||||||
|
public ScoreController(ScoreService scoreService) {
|
||||||
|
this.scoreService = scoreService;
|
||||||
|
}
|
||||||
|
@RequestMapping("/get")
|
||||||
|
public Result getScore(Score score) {
|
||||||
|
return scoreService.getScore(score);
|
||||||
|
}
|
||||||
|
@RequestMapping("/update")
|
||||||
|
public Result updateScore(Score score) {
|
||||||
|
return scoreService.updateScore(score);
|
||||||
|
}
|
||||||
|
@RequestMapping("add")
|
||||||
|
public Result addScore(Score score) {
|
||||||
|
return scoreService.addScore(score);
|
||||||
|
}
|
||||||
|
@RequestMapping("delete")
|
||||||
|
public Result deleteScore(Score score) {
|
||||||
|
return scoreService.deleteScore(score);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,7 +8,6 @@ import test05.pojo.Result;
|
|||||||
import test05.pojo.Student;
|
import test05.pojo.Student;
|
||||||
import test05.service.StudentService;
|
import test05.service.StudentService;
|
||||||
|
|
||||||
@CrossOrigin(maxAge = 3600)
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/studentAction")
|
@RequestMapping("/studentAction")
|
||||||
public class studentController {
|
public class studentController {
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package test05.interceptor;
|
|||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
@ -12,22 +13,22 @@ import test05.utils.JwtUtils;
|
|||||||
@Component
|
@Component
|
||||||
public class LoginCheckInterceptor implements HandlerInterceptor {
|
public class LoginCheckInterceptor implements HandlerInterceptor {
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
public boolean preHandle(HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler) throws Exception {
|
||||||
String token = request.getHeader("token");
|
String token = request.getHeader("token");
|
||||||
try{
|
try{
|
||||||
JwtUtils.parseJwt(token);
|
JwtUtils.parseJwt(token);
|
||||||
}catch(Exception e){;
|
}catch(Exception e){
|
||||||
response.getWriter().print(JSONObject.toJSONString(Result.error("not login")));
|
response.getWriter().print(JSONObject.toJSONString(Result.error("not login")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
public void postHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler, ModelAndView modelAndView) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
public void afterCompletion(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler, Exception ex) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,28 +12,28 @@ public interface CourseMapper {
|
|||||||
* @param course 作为查询条件,该对象中的默认值表示不对该项筛选。
|
* @param course 作为查询条件,该对象中的默认值表示不对该项筛选。
|
||||||
* @return 查询结果集
|
* @return 查询结果集
|
||||||
*/
|
*/
|
||||||
public List<Course> selectCourse(Course course, int page, int pageSize);
|
List<Course> selectCourse(Course course, int page, int pageSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入课程
|
* 插入课程
|
||||||
* @param course 要插入的课程
|
* @param course 要插入的课程
|
||||||
* @return 影响的行数,大于0时表示插入成功
|
* @return 影响的行数,大于0时表示插入成功
|
||||||
*/
|
*/
|
||||||
public int insertCourse(Course course);
|
int insertCourse(Course course);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新课程
|
* 更新课程
|
||||||
* @param course 更新的课程,id作为更新条件,所有其他字段都将会被更新
|
* @param course 更新的课程,id作为更新条件,所有其他字段都将会被更新
|
||||||
* @return 影响的行数,行数大于0时表示根性成功
|
* @return 影响的行数,行数大于0时表示根性成功
|
||||||
*/
|
*/
|
||||||
public int updateCourse(Course course);
|
int updateCourse(Course course);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除课程
|
* 删除课程
|
||||||
* @param course 删除的课程,id作为删除条件
|
* @param course 删除的课程,id作为删除条件
|
||||||
* @return 影响的行数,行数大于0时表示删除成功
|
* @return 影响的行数,行数大于0时表示删除成功
|
||||||
*/
|
*/
|
||||||
public int deleteCourse(Course course);
|
int deleteCourse(Course course);
|
||||||
|
|
||||||
public int selectCourseCount(Course course);
|
int selectCourseCount(Course course);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,8 +7,9 @@ import java.util.List;
|
|||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ScoreMapper {
|
public interface ScoreMapper {
|
||||||
public List<Score> selectScore(Score score);
|
List<Score> selectScore(Score score);
|
||||||
public int insertScore(Score score);
|
int selectScoreCount(Score score);
|
||||||
public int deleteScore(Score score);
|
int insertScore(Score score);
|
||||||
public int updateScore(Score score);
|
int deleteScore(Score score);
|
||||||
|
int updateScore(Score score);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,9 +7,9 @@ import java.util.List;
|
|||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface StudentMapper {
|
public interface StudentMapper {
|
||||||
public List<Student> selectStudent(Student student, int page, int pageSize);
|
List<Student> selectStudent(Student student, int page, int pageSize);
|
||||||
public int selectStudentCount(Student student);
|
int selectStudentCount(Student student);
|
||||||
public int insertStudent(Student student);
|
int insertStudent(Student student);
|
||||||
public int updateStudent(Student student);
|
int updateStudent(Student student);
|
||||||
public int deleteStudent(Student student);
|
int deleteStudent(Student student);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,13 +10,13 @@ import lombok.NonNull;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class Score {
|
public class Score {
|
||||||
@NonNull
|
@NonNull
|
||||||
private Integer N_STUDENT_ID = -1;
|
private Integer studentId = -1;
|
||||||
@NonNull
|
@NonNull
|
||||||
private Integer N_COURSE_ID = -1;
|
private Integer courseId = -1;
|
||||||
@NonNull
|
@NonNull
|
||||||
private Float F_SCORE = -1.0F;
|
private Float score = -1.0F;
|
||||||
public Score(int stu_id, int course_id){
|
public Score(int stu_id, int course_id){
|
||||||
this.N_STUDENT_ID = stu_id;
|
this.studentId = stu_id;
|
||||||
this.N_COURSE_ID = course_id;
|
this.courseId = course_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import test05.pojo.Course;
|
|||||||
import test05.pojo.Result;
|
import test05.pojo.Result;
|
||||||
|
|
||||||
public interface CourseService {
|
public interface CourseService {
|
||||||
public Result addCourse(Course course);
|
Result addCourse(Course course);
|
||||||
public Result deleteCourse(Course course);
|
Result deleteCourse(Course course);
|
||||||
public Result updateCourse(Course course);
|
Result updateCourse(Course course);
|
||||||
Result getCourse(Course course, int page, int pageSize);
|
Result getCourse(Course course, int page, int pageSize);
|
||||||
}
|
}
|
||||||
|
|||||||
11
test05/src/main/java/test05/service/ScoreService.java
Normal file
11
test05/src/main/java/test05/service/ScoreService.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package test05.service;
|
||||||
|
|
||||||
|
import test05.pojo.Result;
|
||||||
|
import test05.pojo.Score;
|
||||||
|
|
||||||
|
public interface ScoreService {
|
||||||
|
Result addScore(Score score);
|
||||||
|
Result getScore(Score score);
|
||||||
|
Result deleteScore(Score score);
|
||||||
|
Result updateScore(Score score);
|
||||||
|
}
|
||||||
@ -4,8 +4,8 @@ import test05.pojo.Result;
|
|||||||
import test05.pojo.Student;
|
import test05.pojo.Student;
|
||||||
|
|
||||||
public interface StudentService {
|
public interface StudentService {
|
||||||
public Result getStudent(Student student, int page, int pageSize);
|
Result getStudent(Student student, int page, int pageSize);
|
||||||
public Result addStudent(Student student);
|
Result addStudent(Student student);
|
||||||
public Result updateStudent(Student student);
|
Result updateStudent(Student student);
|
||||||
public Result deleteStudent(Student student);
|
Result deleteStudent(Student student);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,5 +9,5 @@ public interface UserService {
|
|||||||
* @param user 包含用户名和密码用于比对
|
* @param user 包含用户名和密码用于比对
|
||||||
* @return 登录结果
|
* @return 登录结果
|
||||||
*/
|
*/
|
||||||
public Result login(User user);
|
Result login(User user);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,47 @@
|
|||||||
|
package test05.service.impl;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import test05.mapper.ScoreMapper;
|
||||||
|
import test05.pojo.Result;
|
||||||
|
import test05.pojo.Score;
|
||||||
|
import test05.service.ScoreService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ScoreServiceImpl implements ScoreService {
|
||||||
|
ScoreMapper scoreMapper;
|
||||||
|
@Autowired
|
||||||
|
public ScoreServiceImpl(ScoreMapper scoreMapper) {
|
||||||
|
this.scoreMapper = scoreMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result addScore(Score score) {
|
||||||
|
if(score.getScore()==-1||score.getStudentId()==-1||score.getCourseId()==-1){
|
||||||
|
return Result.error("incorrect score");
|
||||||
|
}
|
||||||
|
return Result.success(scoreMapper.insertScore(score));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result getScore(Score score) {
|
||||||
|
if(score.getStudentId()==-1||score.getCourseId()==-1){
|
||||||
|
return Result.error("incorrect score");
|
||||||
|
}
|
||||||
|
List<Score> result = scoreMapper.selectScore(score);
|
||||||
|
return Result.success(result, scoreMapper.selectScoreCount(score));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result deleteScore(Score score) {
|
||||||
|
return Result.success(scoreMapper.deleteScore(score)>0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result updateScore(Score score) {
|
||||||
|
return Result.success(scoreMapper.updateScore(score)>0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -26,7 +26,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
return Result.error("user dose not exist");
|
return Result.error("user dose not exist");
|
||||||
}
|
}
|
||||||
if (selectUser.getPassword().equals(user.getPassword())) {
|
if (selectUser.getPassword().equals(user.getPassword())) {
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("id", selectUser.getId());
|
map.put("id", selectUser.getId());
|
||||||
map.put("name", selectUser.getName());
|
map.put("name", selectUser.getName());
|
||||||
return Result.success(JwtUtils.getJwt(map));
|
return Result.success(JwtUtils.getJwt(map));
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import io.jsonwebtoken.security.Keys;
|
|||||||
|
|
||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class JwtUtils {
|
public class JwtUtils {
|
||||||
|
|||||||
@ -2,8 +2,8 @@ spring.application.name=test05
|
|||||||
|
|
||||||
#\u4F7F\u7528\u672C\u5730\u6D4B\u8BD5\u6570\u636E\u5E93
|
#\u4F7F\u7528\u672C\u5730\u6D4B\u8BD5\u6570\u636E\u5E93
|
||||||
spring.datasource.driver-class-name=org.sqlite.JDBC
|
spring.datasource.driver-class-name=org.sqlite.JDBC
|
||||||
spring.datasource.url=jdbc:sqlite:F:\\Work_Area\\desk\\database\\\u5B66\u4E60\\java\u6D4B\u8BD5\u6570\u636E\u5E93\\db_student.db
|
#spring.datasource.url=jdbc:sqlite:F:\\Work_Area\\desk\\database\\\u5B66\u4E60\\java\u6D4B\u8BD5\u6570\u636E\u5E93\\db_student.db
|
||||||
|
spring.datasource.url=jdbc:sqlite::resource:db/db_student.db
|
||||||
##\u4F7F\u7528mysql\u6570\u636E\u5E93
|
##\u4F7F\u7528mysql\u6570\u636E\u5E93
|
||||||
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
#spring.datasource.url=jdbc:mysql://localhost:3306/db_student.db
|
#spring.datasource.url=jdbc:mysql://localhost:3306/db_student.db
|
||||||
|
|||||||
BIN
test05/src/main/resources/db/db_student.db
Normal file
BIN
test05/src/main/resources/db/db_student.db
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
47
test05/src/main/resources/static/css/main.css
Normal file
47
test05/src/main/resources/static/css/main.css
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
html{
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
body{
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
height: 100%;;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
a{
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
darkblue{
|
||||||
|
color: darkblue;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header{
|
||||||
|
background-color: #1cf;
|
||||||
|
line-height: 100%;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-menu-item i{
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.el-menu-item.is-active{
|
||||||
|
font-size: larger;
|
||||||
|
}
|
||||||
|
.aside{
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.H-full{
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.W-full{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
BIN
test05/src/main/resources/static/favicon.ico
Normal file
BIN
test05/src/main/resources/static/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Binary file not shown.
1
test05/src/main/resources/static/index.html
Normal file
1
test05/src/main/resources/static/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!doctype html><html lang="zh-cn"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>student-information-sys</title><script defer="defer" src="/js/chunk-vendors.418e428c.js"></script><script defer="defer" src="/js/app.f724117d.js"></script><link href="/css/chunk-vendors.10dd4e95.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but student-information-sys doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body><link rel="stylesheet" href="css/main.css"></html>
|
||||||
2
test05/src/main/resources/static/js/113.f4fc6765.js
Normal file
2
test05/src/main/resources/static/js/113.f4fc6765.js
Normal file
File diff suppressed because one or more lines are too long
1
test05/src/main/resources/static/js/113.f4fc6765.js.map
Normal file
1
test05/src/main/resources/static/js/113.f4fc6765.js.map
Normal file
File diff suppressed because one or more lines are too long
2
test05/src/main/resources/static/js/143.02b41b0c.js
Normal file
2
test05/src/main/resources/static/js/143.02b41b0c.js
Normal file
File diff suppressed because one or more lines are too long
1
test05/src/main/resources/static/js/143.02b41b0c.js.map
Normal file
1
test05/src/main/resources/static/js/143.02b41b0c.js.map
Normal file
File diff suppressed because one or more lines are too long
2
test05/src/main/resources/static/js/376.23b9bc94.js
Normal file
2
test05/src/main/resources/static/js/376.23b9bc94.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
"use strict";(self["webpackChunkstudent_information_sys"]=self["webpackChunkstudent_information_sys"]||[]).push([[376],{8376:function(e,s,t){t.r(s),t.d(s,{default:function(){return d}});var r=function(){var e=this,s=e._self._c;return s("div",[s("div",{staticClass:"login-card"},[s("el-form",{ref:"form",attrs:{model:e.loginform,"label-width":"80px"}},[s("el-form-item",{attrs:{label:"用户名"}},[s("el-input",{model:{value:e.loginform.username,callback:function(s){e.$set(e.loginform,"username",s)},expression:"loginform.username"}})],1),s("el-form-item",{attrs:{label:"密码"}},[s("el-input",{attrs:{type:"password"},model:{value:e.loginform.password,callback:function(s){e.$set(e.loginform,"password",s)},expression:"loginform.password"}})],1),s("el-form-item",[s("el-button",{attrs:{type:"primary"},on:{click:e.login}},[e._v("登录")])],1)],1)],1)])},o=[],a=(t(6206),t(1728)),l=t.n(a),n={data(){return{loginform:{username:"",password:""}}},methods:{login(){l().ajax({url:this.$apiUrl+"/userAction/login",method:"POST",data:this.loginform,success:e=>{e.success?(localStorage.setItem("user",e.data),l().ajaxSetup({headers:{token:e.data}}),this.$route.query.redirect?this.$router.push({name:this.$route.query.redirect}):this.$router.push("student")):this.$message({type:"error",message:"登录失败,"+e.msg,showClose:!0})},error:e=>{this.$message({type:"error",message:"登录失败,code="+e.status,showClose:!0})}})}},mounted(){}},i=n,u=t(8126),m=(0,u.A)(i,r,o,!1,null,null,null),d=m.exports}}]);
|
||||||
|
//# sourceMappingURL=376.23b9bc94.js.map
|
||||||
1
test05/src/main/resources/static/js/376.23b9bc94.js.map
Normal file
1
test05/src/main/resources/static/js/376.23b9bc94.js.map
Normal file
File diff suppressed because one or more lines are too long
2
test05/src/main/resources/static/js/570.8f51fa60.js
Normal file
2
test05/src/main/resources/static/js/570.8f51fa60.js
Normal file
File diff suppressed because one or more lines are too long
1
test05/src/main/resources/static/js/570.8f51fa60.js.map
Normal file
1
test05/src/main/resources/static/js/570.8f51fa60.js.map
Normal file
File diff suppressed because one or more lines are too long
2
test05/src/main/resources/static/js/61.67aace82.js
Normal file
2
test05/src/main/resources/static/js/61.67aace82.js
Normal file
File diff suppressed because one or more lines are too long
1
test05/src/main/resources/static/js/61.67aace82.js.map
Normal file
1
test05/src/main/resources/static/js/61.67aace82.js.map
Normal file
File diff suppressed because one or more lines are too long
2
test05/src/main/resources/static/js/79.0b01aa55.js
Normal file
2
test05/src/main/resources/static/js/79.0b01aa55.js
Normal file
File diff suppressed because one or more lines are too long
1
test05/src/main/resources/static/js/79.0b01aa55.js.map
Normal file
1
test05/src/main/resources/static/js/79.0b01aa55.js.map
Normal file
File diff suppressed because one or more lines are too long
2
test05/src/main/resources/static/js/994.55fb0c1b.js
Normal file
2
test05/src/main/resources/static/js/994.55fb0c1b.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
"use strict";(self["webpackChunkstudent_information_sys"]=self["webpackChunkstudent_information_sys"]||[]).push([[994],{6994:function(n,t,u){u.r(t),u.d(t,{default:function(){return _}});var s=function(){var n=this;n._self._c;return n._m(0)},e=[function(){var n=this,t=n._self._c;return t("div",[t("h1",[n._v("尚未完成")])])}],r={},i=r,f=u(8126),l=(0,f.A)(i,s,e,!1,null,null,null),_=l.exports}}]);
|
||||||
|
//# sourceMappingURL=994.55fb0c1b.js.map
|
||||||
1
test05/src/main/resources/static/js/994.55fb0c1b.js.map
Normal file
1
test05/src/main/resources/static/js/994.55fb0c1b.js.map
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"js/994.55fb0c1b.js","mappings":"0LAAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAQD,EAAIE,MAAMC,GAAG,OAAOH,EAAII,GAAG,EAC1E,EACIC,EAAkB,CAAC,WAAY,IAAIL,EAAIC,KAAKE,EAAGH,EAAIE,MAAMC,GAAG,OAAOA,EAAG,MAAM,CAACA,EAAG,KAAK,CAACH,EAAIM,GAAG,WACjG,GCEA,GAEC,ECPmgB,I,UCOhgBC,GAAY,OACd,EACAR,EACAM,GACA,EACA,KACA,KACA,MAIF,EAAeE,EAAiB,O","sources":["webpack://student-information-sys/./src/views/teacher/teacherList.vue","webpack://student-information-sys/src/views/teacher/teacherList.vue","webpack://student-information-sys/./src/views/teacher/teacherList.vue?83bc","webpack://student-information-sys/./src/views/teacher/teacherList.vue?700e"],"sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _vm._m(0)\n}\nvar staticRenderFns = [function (){var _vm=this,_c=_vm._self._c;return _c('div',[_c('h1',[_vm._v(\"尚未完成\")])])\n}]\n\nexport { render, staticRenderFns }","<template>\r\n <div><h1>尚未完成</h1></div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n\r\n}\r\n</script>\r\n\r\n<style>\r\n\r\n</style>","import mod from \"-!../../../node_modules/.pnpm/thread-loader@3.0.4_webpack@5.97.1/node_modules/thread-loader/dist/cjs.js!../../../node_modules/.pnpm/babel-loader@8.4.1_@babel+core@7.26.0_webpack@5.97.1/node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!../../../node_modules/.pnpm/vue-loader@15.11.1_@vue+compiler-sfc@3.5.13_css-loader@6.11.0_webpack@5.97.1__lodash@4.17.21__nkjjb5puplgtn2g67cuu4wxlfy/node_modules/vue-loader/lib/index.js??vue-loader-options!./teacherList.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../node_modules/.pnpm/thread-loader@3.0.4_webpack@5.97.1/node_modules/thread-loader/dist/cjs.js!../../../node_modules/.pnpm/babel-loader@8.4.1_@babel+core@7.26.0_webpack@5.97.1/node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!../../../node_modules/.pnpm/vue-loader@15.11.1_@vue+compiler-sfc@3.5.13_css-loader@6.11.0_webpack@5.97.1__lodash@4.17.21__nkjjb5puplgtn2g67cuu4wxlfy/node_modules/vue-loader/lib/index.js??vue-loader-options!./teacherList.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./teacherList.vue?vue&type=template&id=29168d45\"\nimport script from \"./teacherList.vue?vue&type=script&lang=js\"\nexport * from \"./teacherList.vue?vue&type=script&lang=js\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/.pnpm/vue-loader@15.11.1_@vue+compiler-sfc@3.5.13_css-loader@6.11.0_webpack@5.97.1__lodash@4.17.21__nkjjb5puplgtn2g67cuu4wxlfy/node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports"],"names":["render","_vm","this","_self","_c","_m","staticRenderFns","_v","component"],"sourceRoot":""}
|
||||||
2
test05/src/main/resources/static/js/app.966216cd.js
Normal file
2
test05/src/main/resources/static/js/app.966216cd.js
Normal file
File diff suppressed because one or more lines are too long
1
test05/src/main/resources/static/js/app.966216cd.js.map
Normal file
1
test05/src/main/resources/static/js/app.966216cd.js.map
Normal file
File diff suppressed because one or more lines are too long
2
test05/src/main/resources/static/js/app.c72fb026.js
Normal file
2
test05/src/main/resources/static/js/app.c72fb026.js
Normal file
File diff suppressed because one or more lines are too long
1
test05/src/main/resources/static/js/app.c72fb026.js.map
Normal file
1
test05/src/main/resources/static/js/app.c72fb026.js.map
Normal file
File diff suppressed because one or more lines are too long
2
test05/src/main/resources/static/js/app.ea5a820e.js
Normal file
2
test05/src/main/resources/static/js/app.ea5a820e.js
Normal file
File diff suppressed because one or more lines are too long
1
test05/src/main/resources/static/js/app.ea5a820e.js.map
Normal file
1
test05/src/main/resources/static/js/app.ea5a820e.js.map
Normal file
File diff suppressed because one or more lines are too long
2
test05/src/main/resources/static/js/app.f724117d.js
Normal file
2
test05/src/main/resources/static/js/app.f724117d.js
Normal file
File diff suppressed because one or more lines are too long
1
test05/src/main/resources/static/js/app.f724117d.js.map
Normal file
1
test05/src/main/resources/static/js/app.f724117d.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -3,6 +3,7 @@
|
|||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="test05.mapper.CourseMapper">
|
<mapper namespace="test05.mapper.CourseMapper">
|
||||||
|
<!--suppress Annotator -->
|
||||||
<select id="selectCourse" resultType="test05.pojo.Course">
|
<select id="selectCourse" resultType="test05.pojo.Course">
|
||||||
SELECT N_COURSE_ID AS id,
|
SELECT N_COURSE_ID AS id,
|
||||||
VC_COURSE_NAME AS name,
|
VC_COURSE_NAME AS name,
|
||||||
|
|||||||
@ -4,27 +4,36 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="test05.mapper.ScoreMapper">
|
<mapper namespace="test05.mapper.ScoreMapper">
|
||||||
<select id="selectScore" resultType="test05.pojo.Score">
|
<select id="selectScore" resultType="test05.pojo.Score">
|
||||||
SELECT *
|
SELECT N_STUDENT_ID AS studentId,
|
||||||
|
N_COURSE_ID AS courseId,
|
||||||
|
F_SCORE AS score
|
||||||
FROM t_score
|
FROM t_score
|
||||||
WHERE #{N_STUDENT_ID} in (N_STUDENT_ID, -1)
|
WHERE #{studentId} in (N_STUDENT_ID, -1)
|
||||||
AND #{N_COURSE_ID} in (N_COURSE_ID, -1)
|
AND #{courseId} in (N_COURSE_ID, -1)
|
||||||
AND #{F_SCORE} in (F_SCORE, -1);
|
AND #{score} in (F_SCORE, -1);
|
||||||
|
</select>
|
||||||
|
<select id="selectScoreCount" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM t_score
|
||||||
|
WHERE #{studentId} in (N_STUDENT_ID, -1)
|
||||||
|
AND #{courseId} in (N_COURSE_ID, -1)
|
||||||
|
AND #{score} in (F_SCORE, -1);
|
||||||
</select>
|
</select>
|
||||||
<update id="updateScore">
|
<update id="updateScore">
|
||||||
UPDATE t_score
|
UPDATE t_score
|
||||||
SET F_SCORE = #{F_SCORE}
|
SET F_SCORE = #{score}
|
||||||
WHERE N_COURSE_ID = #{N_COURSE_ID}
|
WHERE N_COURSE_ID = #{courseId}
|
||||||
AND N_STUDENT_ID = #{N_STUDENT_ID}
|
AND N_STUDENT_ID = #{studentId}
|
||||||
</update>
|
</update>
|
||||||
<delete id="deleteScore">
|
<delete id="deleteScore">
|
||||||
DELETE
|
DELETE
|
||||||
FROM t_score
|
FROM t_score
|
||||||
WHERE N_STUDENT_ID = #{N_STUDENT_ID}
|
WHERE N_STUDENT_ID = #{studentId}
|
||||||
AND N_COURSE_ID = #{N_COURSE_ID}
|
AND N_COURSE_ID = #{courseId}
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insertScore">
|
<insert id="insertScore">
|
||||||
INSERT INTO t_score
|
INSERT INTO t_score
|
||||||
(N_STUDENT_ID, N_COURSE_ID, F_SCORE)
|
(N_STUDENT_ID, N_COURSE_ID, F_SCORE)
|
||||||
VALUES (#{N_STUDENT_ID}, #{N_COURSE_ID}, #{F_SCORE});
|
VALUES (#{studentId}, #{courseId}, #{score});
|
||||||
</insert>
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -2,6 +2,7 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<!--suppress ALL -->
|
||||||
<mapper namespace="test05.mapper.StudentMapper">
|
<mapper namespace="test05.mapper.StudentMapper">
|
||||||
<select id="selectStudent" resultType="test05.pojo.Student">
|
<select id="selectStudent" resultType="test05.pojo.Student">
|
||||||
SELECT N_STUDENT_ID AS id,
|
SELECT N_STUDENT_ID AS id,
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<!--suppress Annotator -->
|
||||||
<mapper namespace="test05.mapper.UserMapper">
|
<mapper namespace="test05.mapper.UserMapper">
|
||||||
<select id="selectUser" resultType="test05.pojo.User">
|
<select id="selectUser" resultType="test05.pojo.User">
|
||||||
SELECT N_USER_ID AS id,
|
SELECT N_USER_ID AS id,
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
package test05;
|
package test05;
|
||||||
|
|
||||||
import io.jsonwebtoken.Claims;
|
|
||||||
import io.jsonwebtoken.Jws;
|
|
||||||
import io.jsonwebtoken.Jwts;
|
|
||||||
import io.jsonwebtoken.security.Keys;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.opentest4j.TestAbortedException;
|
import org.opentest4j.TestAbortedException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -195,7 +191,7 @@ class Test05ApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void genJwtTest(){
|
public void genJwtTest(){
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("id", "1");
|
map.put("id", "1");
|
||||||
map.put("name", "tom");
|
map.put("name", "tom");
|
||||||
String jwt = JwtUtils.getJwt(map);
|
String jwt = JwtUtils.getJwt(map);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user