stu upload
This commit is contained in:
parent
9e960f8cba
commit
d8ce35567e
@ -0,0 +1,48 @@
|
||||
|
||||
|
||||
package cn.edu.cqwu.repair.controller.stu;
|
||||
|
||||
import cn.edu.cqwu.repair.dao.OrderDao;
|
||||
import cn.edu.cqwu.repair.dao.StuDao;
|
||||
import cn.edu.cqwu.repair.entity.Order;
|
||||
import cn.edu.cqwu.repair.entity.Stu;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.Mapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.SessionAttribute;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Controller
|
||||
public class StuUploadController {
|
||||
|
||||
StuDao stuDao;
|
||||
|
||||
OrderDao orderDao;
|
||||
@Autowired
|
||||
public StuUploadController(StuDao stuDao,OrderDao orderDao) {
|
||||
this.stuDao = stuDao;
|
||||
this.orderDao = orderDao;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/upload.do")
|
||||
public String upload(Order order, @SessionAttribute Stu stu, HttpServletRequest request){
|
||||
order.setStudentId(stu.getUserid());
|
||||
order.setStudentId(0);
|
||||
int is = orderDao.add(order);
|
||||
if(is==1){
|
||||
request.setAttribute("stuUploadMess","上传成功");
|
||||
}else{
|
||||
request.setAttribute("stuUploadMess","上传失败");
|
||||
|
||||
}
|
||||
return "stu/success";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
12
src/main/java/cn/edu/cqwu/repair/dao/DeviceDao.java
Normal file
12
src/main/java/cn/edu/cqwu/repair/dao/DeviceDao.java
Normal file
@ -0,0 +1,12 @@
|
||||
package cn.edu.cqwu.repair.dao;
|
||||
|
||||
import cn.edu.cqwu.repair.entity.Device;
|
||||
import cn.edu.cqwu.repair.entity.Stu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface DeviceDao {
|
||||
|
||||
public ArrayList<Device> findAllDevice();
|
||||
|
||||
}
|
11
src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java
Normal file
11
src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java
Normal file
@ -0,0 +1,11 @@
|
||||
package cn.edu.cqwu.repair.dao;
|
||||
|
||||
import cn.edu.cqwu.repair.entity.AdminUser;
|
||||
import cn.edu.cqwu.repair.entity.Order;
|
||||
|
||||
public interface OrderDao {
|
||||
|
||||
int add(Order order);
|
||||
|
||||
|
||||
}
|
28
src/main/java/cn/edu/cqwu/repair/dao/impl/DeviceDaoImpl.java
Normal file
28
src/main/java/cn/edu/cqwu/repair/dao/impl/DeviceDaoImpl.java
Normal file
@ -0,0 +1,28 @@
|
||||
package cn.edu.cqwu.repair.dao.impl;
|
||||
|
||||
import cn.edu.cqwu.repair.dao.DeviceDao;
|
||||
import cn.edu.cqwu.repair.dao.StuDao;
|
||||
import cn.edu.cqwu.repair.db.ConnectionFactory;
|
||||
import cn.edu.cqwu.repair.entity.Device;
|
||||
import cn.edu.cqwu.repair.entity.Stu;
|
||||
import cn.edu.cqwu.repair.entity.mapper.AdminUserMapper;
|
||||
import cn.edu.cqwu.repair.entity.mapper.DeviceMapper;
|
||||
import cn.edu.cqwu.repair.service.RecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@Component
|
||||
public class DeviceDaoImpl implements DeviceDao {
|
||||
private static final DeviceMapper mapper = ConnectionFactory.getMapper(DeviceMapper.class);
|
||||
|
||||
|
||||
@Override
|
||||
public ArrayList<Device> findAllDevice() {
|
||||
|
||||
|
||||
return (ArrayList<Device>) mapper.selectAll();
|
||||
}
|
||||
|
||||
|
||||
}
|
20
src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java
Normal file
20
src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java
Normal file
@ -0,0 +1,20 @@
|
||||
package cn.edu.cqwu.repair.dao.impl;
|
||||
|
||||
import cn.edu.cqwu.repair.dao.OrderDao;
|
||||
import cn.edu.cqwu.repair.db.ConnectionFactory;
|
||||
import cn.edu.cqwu.repair.entity.Order;
|
||||
import cn.edu.cqwu.repair.entity.mapper.DeviceMapper;
|
||||
import cn.edu.cqwu.repair.entity.mapper.OrderMapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class OrderDaoImpl implements OrderDao {
|
||||
|
||||
private static final OrderMapper mapper = ConnectionFactory.getMapper(OrderMapper.class);
|
||||
|
||||
@Override
|
||||
public int add(Order order) {
|
||||
|
||||
return mapper.insert(order);
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ public class Order {
|
||||
// 故障图片
|
||||
private String faultImg;
|
||||
|
||||
// 订单状态 0 表示未完成 1 表示已完成
|
||||
// 订单状态 0 表示未分配 1 表示分配、进行中 2 表示已完成
|
||||
private int orderStatus;
|
||||
// 订单创建时间
|
||||
@Column(onInsertValue = "now()")
|
||||
|
94
src/main/webapp/stu/upload.jsp
Normal file
94
src/main/webapp/stu/upload.jsp
Normal file
@ -0,0 +1,94 @@
|
||||
<%@ page import="cn.edu.cqwu.repair.entity.Device" %>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
<c:set var="title" value="上传表单"/>
|
||||
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css">
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>${title}</title>
|
||||
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css" crossorigin="anonymous">
|
||||
<script src="${webroot}/js/bootstrap.bundle.min.js"></script>
|
||||
<link rel="stylesheet" href="${webroot}/styles/sidebar.css" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="${webroot}/styles/index.css" crossorigin="anonymous"></head>
|
||||
<body>
|
||||
<main class="d-flex flex-nowrap">
|
||||
<%@ include file="../includes/header.jsp" %>
|
||||
|
||||
<main class="form-signin w-100 m-auto">
|
||||
<form action="${webroot}/upload.do" method="post" >
|
||||
<img class="mb-4" src="${webroot}/images/logo.jpg" alt="" width="72" height="72">
|
||||
<h1 class="h3 mb-3 fw-normal">上传维修单</h1>
|
||||
|
||||
<c:if test="${not empty requestScope.stuUploadMess}">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
${requestScope.stuUploadMess}
|
||||
</div>
|
||||
</c:if>
|
||||
<div class="form-floating">
|
||||
|
||||
<select id="deviceId" name="deviceId">
|
||||
|
||||
|
||||
<%-- 使用 JSP 语法获取 application 中的设备数组 --%>
|
||||
<% Device[] devices = (Device[]) application.getAttribute("devices"); %>
|
||||
|
||||
<%-- 循环遍历设备数组,并将每个设备作为下拉框的选项 --%>
|
||||
<% for (Device device : devices) { %>
|
||||
<option value="<%= device.getDeviceName() %>"><%= device.getDeviceName() %></option>
|
||||
<% } %>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" name="contact" id="contact" required>
|
||||
<label for="contact">联系人名称</label>
|
||||
</div>
|
||||
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" name="phone" id="phone" required>
|
||||
<label for="phone">联系人电话</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" name="address" id="address" required>
|
||||
<label for="address">详细地点</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" name="faultDesc" id="faultDesc" required>
|
||||
<label for="faultDesc">故障描述</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" name="faultImg" id="faultImg" required>
|
||||
<label for="faultImg">故障图片</label>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<button class="btn btn-primary w-100 py-2" type="submit" id="submit">提交</button>
|
||||
<br/><br/>
|
||||
</form>
|
||||
|
||||
</main>
|
||||
|
||||
</main>
|
||||
<script src="${webroot}/js/pass.js" type="javascript"></script>
|
||||
<script>
|
||||
const toastLiveExample = document.getElementById('liveToast')
|
||||
|
||||
const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample)
|
||||
toastBootstrap.show()
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,65 +0,0 @@
|
||||
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
<c:set var="title" value="用户主页"/>
|
||||
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css">
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>${title}</title>
|
||||
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css" crossorigin="anonymous">
|
||||
<script src="${webroot}/js/bootstrap.bundle.min.js"></script>
|
||||
<link rel="stylesheet" href="${webroot}/styles/sidebar.css" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="${webroot}/styles/index.css" crossorigin="anonymous"></head>
|
||||
<body>
|
||||
<main class="d-flex flex-nowrap">
|
||||
<%@ include file="../includes/header.jsp" %>
|
||||
|
||||
<main class="form-signin w-100 m-auto">
|
||||
<form action="${webroot}/stueditpassword.do" method="post" >
|
||||
<img class="mb-4" src="${webroot}/images/logo.jpg" alt="" width="72" height="72">
|
||||
<h1 class="h3 mb-3 fw-normal">修改用户密码</h1>
|
||||
|
||||
<c:if test="${not empty requestScope.stuEditMess}">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
${requestScope.stuEditMess}
|
||||
</div>
|
||||
</c:if>
|
||||
<div class="form-floating">
|
||||
<input type="password" class="form-control" name="oldpassword" id="oldpassword" required>
|
||||
<label for="oldpassword">旧密码</label>
|
||||
</div>
|
||||
|
||||
<div class="form-floating">
|
||||
<input type="password" class="form-control" name="password" id="password" required>
|
||||
<label for="password">新密码</label>
|
||||
</div>
|
||||
|
||||
|
||||
<button class="btn btn-primary w-100 py-2" type="submit" id="submit">确定</button>
|
||||
<br/><br/>
|
||||
</form>
|
||||
|
||||
</main>
|
||||
|
||||
</main>
|
||||
<script src="${webroot}/js/pass.js" type="javascript"></script>
|
||||
<script>
|
||||
const toastLiveExample = document.getElementById('liveToast')
|
||||
|
||||
const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample)
|
||||
toastBootstrap.show()
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,16 +0,0 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: Administrator
|
||||
Date: 2024/5/12
|
||||
Time: 21:10
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,92 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
<c:set var="title" value="注册"/>
|
||||
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css">
|
||||
|
||||
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>${title}</title>
|
||||
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css" crossorigin="anonymous">
|
||||
<script src="${webroot}/js/bootstrap.bundle.min.js"></script>
|
||||
<link rel="stylesheet" href="${webroot}/styles/sidebar.css" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="${webroot}/styles/index.css" crossorigin="anonymous"></head>
|
||||
</head>
|
||||
<body>
|
||||
<main class="d-flex flex-nowrap">
|
||||
<%@ include file="../includes/header.jsp" %>
|
||||
|
||||
<main class="form-signin w-100 m-auto">
|
||||
<div class="toast-container position-fixed bottom-0 end-0 p-3">
|
||||
<div id="liveToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
|
||||
<div class="toast-header">
|
||||
<img src="${webroot}/images/logo.jpg" class="rounded me-2" width="32" height="32">
|
||||
<strong class="me-auto">提示</strong>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="toast-body">
|
||||
1、请牢记您注册时填写的用户名和密码,登录本系统时您需要提供正确的用户名和密码!</br>
|
||||
2、忘记用户名或者密码请联系学校管理员!
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form action="${webroot}/sturegist.do" method="post">
|
||||
<img class="mb-4" src="${webroot}/images/logo.jpg" alt="" width="72" height="72">
|
||||
<h1 class="h3 mb-3 fw-normal">注册</h1>
|
||||
|
||||
<c:if test="${not empty requestScope.stuRegistMess}">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
${requestScope.stuRegistMess}
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" name="userNo" id="userNo" required>
|
||||
<label for="userNo">学号</label>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="form-floating">
|
||||
|
||||
<input type="text" class="form-control" name="username" id="username" required>
|
||||
<label for="username">用户名</label>
|
||||
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
|
||||
<input type="password" class="form-control" name="password" id="password" required>
|
||||
<label for="password">密码</label>
|
||||
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary w-100 py-2" type="submit" id="submit">注册</button>
|
||||
</form>
|
||||
<a href="${webroot}/index.jsp">
|
||||
<button class="btn btn-primary w-100 py-2">去登录</button>
|
||||
</a>
|
||||
|
||||
|
||||
</main>
|
||||
</main>
|
||||
<script src="${webroot}/js/pass.js" type="javascript"></script>
|
||||
<script>
|
||||
const toastLiveExample = document.getElementById('liveToast')
|
||||
|
||||
const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample)
|
||||
toastBootstrap.show()
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,16 +0,0 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: Administrator
|
||||
Date: 2024/5/12
|
||||
Time: 20:03
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>成功</h1>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user