stu upload
This commit is contained in:
parent
815a6c4a78
commit
1c04962f9f
@ -0,0 +1,31 @@
|
||||
package cn.edu.cqwu.repair.controller.stu;
|
||||
|
||||
import cn.edu.cqwu.repair.dao.OrderDao;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.SessionAttribute;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Controller
|
||||
public class StuConsultController {
|
||||
|
||||
OrderDao orderDao;
|
||||
|
||||
@Autowired
|
||||
public StuConsultController(OrderDao orderDao) {
|
||||
this.orderDao = orderDao;
|
||||
}
|
||||
|
||||
@RequestMapping("/stu/consult")
|
||||
public String consult(HttpServletRequest request, @SessionAttribute Stu stu) {
|
||||
request.setAttribute("repairOrder", orderDao.findByStudent_id(stu.getUserid()));
|
||||
|
||||
return "/stu/consult";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
package cn.edu.cqwu.repair.controller.stu;
|
||||
|
||||
import cn.edu.cqwu.repair.dao.DeviceDao;
|
||||
import cn.edu.cqwu.repair.dao.OrderDao;
|
||||
import cn.edu.cqwu.repair.dao.StuDao;
|
||||
import cn.edu.cqwu.repair.entity.Order;
|
||||
@ -19,19 +20,28 @@ import javax.servlet.http.HttpServletRequest;
|
||||
public class StuUploadController {
|
||||
|
||||
StuDao stuDao;
|
||||
|
||||
DeviceDao deviceDao;
|
||||
OrderDao orderDao;
|
||||
@Autowired
|
||||
public StuUploadController(StuDao stuDao,OrderDao orderDao) {
|
||||
public StuUploadController(StuDao stuDao,OrderDao orderDao,DeviceDao deviceDao) {
|
||||
this.stuDao = stuDao;
|
||||
this.orderDao = orderDao;
|
||||
this.deviceDao = deviceDao;
|
||||
}
|
||||
|
||||
// @RequestMapping("/stu/upload.jsp")
|
||||
// public String consult(HttpServletRequest request) {
|
||||
// request.setAttribute("devices", deviceDao.findAllDevice());
|
||||
//
|
||||
// return "/stu/upload";
|
||||
//
|
||||
// }
|
||||
|
||||
@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","上传成功");
|
||||
@ -39,7 +49,7 @@ public String upload(Order order, @SessionAttribute Stu stu, HttpServletRequest
|
||||
request.setAttribute("stuUploadMess","上传失败");
|
||||
|
||||
}
|
||||
return "stu/success";
|
||||
return "/stu/success";
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ import java.util.ArrayList;
|
||||
public interface OrderDao {
|
||||
|
||||
int add(Order order);
|
||||
|
||||
Order findByStudent_id(int id);
|
||||
ArrayList<Order> findByWorkerId(int workerId);
|
||||
|
||||
}
|
||||
|
@ -27,6 +27,11 @@ public class OrderDaoImpl implements OrderDao {
|
||||
return mapper.insert(order);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order findByStudent_id(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Order> findByWorkerId(int workerId){
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
|
66
src/main/webapp/stu/consult.jsp
Normal file
66
src/main/webapp/stu/consult.jsp
Normal file
@ -0,0 +1,66 @@
|
||||
<%@ 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}"/>
|
||||
<c:set var="repairOrder" value="${requestScope.repairOrder}"/>
|
||||
<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">
|
||||
<c:if test="${not empty repairOrder}">
|
||||
<div>
|
||||
<p><strong>联系人名称:</strong>${repairOrder.contact}</p>
|
||||
<p><strong>联系人电话:</strong>${repairOrder.phone}</p>
|
||||
<p><strong>详细地点:</strong>${repairOrder.address}</p>
|
||||
<p><strong>故障描述:</strong>${repairOrder.faultDesc}</p>
|
||||
<p><strong>故障图片:</strong><img src="${repairOrder.faultImg}" alt="故障图片"></p>
|
||||
|
||||
<p><strong>处理状态:</strong>
|
||||
|
||||
<c:choose>
|
||||
<c:when test="${repairOrder.orderStatus==0}">
|
||||
待安排维修人员
|
||||
</c:when>
|
||||
<c:when test="${repairOrder.orderStatus==1}">
|
||||
正在维修中
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
维修已完成
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
</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,4 +1,5 @@
|
||||
<%@ page import="cn.edu.cqwu.repair.entity.Device" %>
|
||||
<%@ page import="java.util.ArrayList" %>
|
||||
<%@ 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" %>
|
||||
@ -39,7 +40,7 @@
|
||||
|
||||
|
||||
<%-- 使用 JSP 语法获取 application 中的设备数组 --%>
|
||||
<% Device[] devices = (Device[]) application.getAttribute("devices"); %>
|
||||
<% ArrayList<Device> devices = (ArrayList<Device>) application.getAttribute("device"); %>
|
||||
|
||||
<%-- 循环遍历设备数组,并将每个设备作为下拉框的选项 --%>
|
||||
<% for (Device device : devices) { %>
|
||||
|
Loading…
Reference in New Issue
Block a user