stu upload
This commit is contained in:
parent
d351746543
commit
8eae23474d
@ -1,6 +1,7 @@
|
||||
package cn.edu.cqwu.repair.controller.stu;
|
||||
|
||||
import cn.edu.cqwu.repair.dao.OrderDao;
|
||||
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;
|
||||
@ -8,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.SessionAttribute;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Controller
|
||||
public class StuConsultController {
|
||||
@ -21,8 +23,14 @@ public class StuConsultController {
|
||||
|
||||
@RequestMapping("/stu/consult")
|
||||
public String consult(HttpServletRequest request, @SessionAttribute Stu stu) {
|
||||
request.setAttribute("repairOrder", orderDao.findByStudent_id(stu.getUserid()));
|
||||
|
||||
ArrayList<Order> orders = orderDao.findByStudent_id(stu.getUserid());
|
||||
if(orders!=null) {
|
||||
System.out.println(orders);
|
||||
request.setAttribute("Orders", orders);
|
||||
}else{
|
||||
System.out.println("订单空");
|
||||
request.setAttribute("stuConsultMess","订单为空");
|
||||
}
|
||||
return "/stu/consult";
|
||||
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ DeviceDao deviceDao;
|
||||
this.deviceDao = deviceDao;
|
||||
}
|
||||
|
||||
// @RequestMapping("/stu/upload.jsp")
|
||||
// @RequestMapping("/stu/upload")
|
||||
// public String consult(HttpServletRequest request) {
|
||||
// request.setAttribute("devices", deviceDao.findAllDevice());
|
||||
//
|
||||
|
@ -7,7 +7,7 @@ import java.util.ArrayList;
|
||||
public interface OrderDao {
|
||||
|
||||
int add(Order order);
|
||||
Order findByStudent_id(int id);
|
||||
ArrayList<Order> findByStudent_id(int stuId);
|
||||
ArrayList<Order> findByWorkerId(int workerId);
|
||||
|
||||
public int statusModify(int orderId);
|
||||
|
@ -6,7 +6,7 @@ import java.util.ArrayList;
|
||||
|
||||
public interface StuDao {
|
||||
public int add(Stu stu);
|
||||
|
||||
public int update(Stu stu);
|
||||
public Stu findByUsername(String username);
|
||||
|
||||
public Stu validateLogin(String username, String password);
|
||||
|
@ -28,8 +28,10 @@ public class OrderDaoImpl implements OrderDao {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order findByStudent_id(int id) {
|
||||
return null;
|
||||
public ArrayList<Order> findByStudent_id(int stuId) {
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
qw.select(ORDER.ALL_COLUMNS).where(ORDER.STUDENT_ID.eq(stuId));
|
||||
return (ArrayList<Order>) mapper.selectListByQuery(qw);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,9 @@ public class StuDaoImpl implements StuDao {
|
||||
public int add(Stu stu) {
|
||||
return MAPPER.insert(stu);
|
||||
}
|
||||
public int update(Stu stu) {
|
||||
return MAPPER.update(stu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stu findByUsername(String username) {
|
||||
|
@ -15,10 +15,30 @@
|
||||
<c:choose>
|
||||
<c:when test="${not empty sessionScope.stu}">
|
||||
<li class="nav-item">
|
||||
<a href="${webroot}/stu/notice.jsp" class="nav-link link-body-emphasis" aria-current="page">
|
||||
<a href="${webroot}/stu/main.jsp" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 主页
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="${webroot}/stu/data.jsp" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 个人资料
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="${webroot}/stu/upload.jsp" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 上传订单
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="${webroot}/stu/current" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 当前订单
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="${webroot}/stu/consult" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 历史订单
|
||||
</a>
|
||||
</li>
|
||||
</c:when>
|
||||
<c:when test="${not empty sessionScope.adminUser}">
|
||||
<li class="nav-item">
|
||||
|
@ -6,7 +6,7 @@
|
||||
<%@ page isELIgnored="false" %>
|
||||
<c:set var="title" value="上传表单"/>
|
||||
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
|
||||
<c:set var="repairOrder" value="${requestScope.repairOrder}"/>
|
||||
<c:set var="repairOrder" value="${requestScope.Orders}"/>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css">
|
||||
@ -23,43 +23,70 @@
|
||||
<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>
|
||||
<main class=" w-100 m-auto">
|
||||
|
||||
<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.stuConsultMess}">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
${requestScope.stuConsultMess}
|
||||
</div>
|
||||
</c:if>
|
||||
<div class="form-floating">
|
||||
|
||||
<c:if test="${not empty requestScope.Orders}">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">序号</th>
|
||||
<th scope="col">联系人名称</th>
|
||||
<th scope="col">联系人电话</th>
|
||||
<th scope="col">详细地点</th>
|
||||
<th scope="col">故障描述</th>
|
||||
<th scope="col">故障图片</th>
|
||||
<th scope="col">处理状态</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach var="repairOrder" items="${requestScope.Orders}" varStatus="loop">
|
||||
<tr>
|
||||
<td>${loop.index + 1}</td>
|
||||
<td>${repairOrder.contact}</td>
|
||||
<td>${repairOrder.phone}</td>
|
||||
<td>${repairOrder.address}</td>
|
||||
<td>${repairOrder.faultDesc}</td>
|
||||
<td><img src="${repairOrder.faultImg}" alt="故障图片"></td>
|
||||
<td>
|
||||
<c:choose>
|
||||
<c:when test="${repairOrder.orderStatus==0}">
|
||||
待安排维修人员
|
||||
</c:when>
|
||||
<c:when test="${repairOrder.orderStatus==1}">
|
||||
正在维修中
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
维修已完成
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</c:if>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</main>
|
||||
<script src="${webroot}/js/pass.js" type="javascript"></script>
|
||||
<script>
|
||||
const toastLiveExample = document.getElementById('liveToast')
|
||||
<%--<script src="${webroot}/js/pass.js" type="javascript"></script>--%>
|
||||
<%--<script>--%>
|
||||
<%-- const toastLiveExample = document.getElementById('liveToast')--%>
|
||||
|
||||
const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample)
|
||||
toastBootstrap.show()
|
||||
</script>
|
||||
<%-- const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample)--%>
|
||||
<%-- toastBootstrap.show()--%>
|
||||
<%--</script>--%>
|
||||
<%--<script src="${webroot}/js/pass.js"></script>--%>
|
||||
|
||||
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user