stu upload
This commit is contained in:
parent
d351746543
commit
8eae23474d
@ -1,6 +1,7 @@
|
|||||||
package cn.edu.cqwu.repair.controller.stu;
|
package cn.edu.cqwu.repair.controller.stu;
|
||||||
|
|
||||||
import cn.edu.cqwu.repair.dao.OrderDao;
|
import cn.edu.cqwu.repair.dao.OrderDao;
|
||||||
|
import cn.edu.cqwu.repair.entity.Order;
|
||||||
import cn.edu.cqwu.repair.entity.Stu;
|
import cn.edu.cqwu.repair.entity.Stu;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@ -8,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.SessionAttribute;
|
import org.springframework.web.bind.annotation.SessionAttribute;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class StuConsultController {
|
public class StuConsultController {
|
||||||
@ -21,8 +23,14 @@ public class StuConsultController {
|
|||||||
|
|
||||||
@RequestMapping("/stu/consult")
|
@RequestMapping("/stu/consult")
|
||||||
public String consult(HttpServletRequest request, @SessionAttribute Stu stu) {
|
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";
|
return "/stu/consult";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ DeviceDao deviceDao;
|
|||||||
this.deviceDao = deviceDao;
|
this.deviceDao = deviceDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @RequestMapping("/stu/upload.jsp")
|
// @RequestMapping("/stu/upload")
|
||||||
// public String consult(HttpServletRequest request) {
|
// public String consult(HttpServletRequest request) {
|
||||||
// request.setAttribute("devices", deviceDao.findAllDevice());
|
// request.setAttribute("devices", deviceDao.findAllDevice());
|
||||||
//
|
//
|
||||||
|
@ -7,7 +7,7 @@ import java.util.ArrayList;
|
|||||||
public interface OrderDao {
|
public interface OrderDao {
|
||||||
|
|
||||||
int add(Order order);
|
int add(Order order);
|
||||||
Order findByStudent_id(int id);
|
ArrayList<Order> findByStudent_id(int stuId);
|
||||||
ArrayList<Order> findByWorkerId(int workerId);
|
ArrayList<Order> findByWorkerId(int workerId);
|
||||||
|
|
||||||
public int statusModify(int orderId);
|
public int statusModify(int orderId);
|
||||||
|
@ -6,7 +6,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public interface StuDao {
|
public interface StuDao {
|
||||||
public int add(Stu stu);
|
public int add(Stu stu);
|
||||||
|
public int update(Stu stu);
|
||||||
public Stu findByUsername(String username);
|
public Stu findByUsername(String username);
|
||||||
|
|
||||||
public Stu validateLogin(String username, String password);
|
public Stu validateLogin(String username, String password);
|
||||||
|
@ -28,8 +28,10 @@ public class OrderDaoImpl implements OrderDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Order findByStudent_id(int id) {
|
public ArrayList<Order> findByStudent_id(int stuId) {
|
||||||
return null;
|
QueryWrapper qw = new QueryWrapper();
|
||||||
|
qw.select(ORDER.ALL_COLUMNS).where(ORDER.STUDENT_ID.eq(stuId));
|
||||||
|
return (ArrayList<Order>) mapper.selectListByQuery(qw);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,6 +22,9 @@ public class StuDaoImpl implements StuDao {
|
|||||||
public int add(Stu stu) {
|
public int add(Stu stu) {
|
||||||
return MAPPER.insert(stu);
|
return MAPPER.insert(stu);
|
||||||
}
|
}
|
||||||
|
public int update(Stu stu) {
|
||||||
|
return MAPPER.update(stu);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stu findByUsername(String username) {
|
public Stu findByUsername(String username) {
|
||||||
|
@ -15,10 +15,30 @@
|
|||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="${not empty sessionScope.stu}">
|
<c:when test="${not empty sessionScope.stu}">
|
||||||
<li class="nav-item">
|
<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>
|
</a>
|
||||||
</li>
|
</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>
|
||||||
<c:when test="${not empty sessionScope.adminUser}">
|
<c:when test="${not empty sessionScope.adminUser}">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<%@ page isELIgnored="false" %>
|
<%@ page isELIgnored="false" %>
|
||||||
<c:set var="title" value="上传表单"/>
|
<c:set var="title" value="上传表单"/>
|
||||||
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
|
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
|
||||||
<c:set var="repairOrder" value="${requestScope.repairOrder}"/>
|
<c:set var="repairOrder" value="${requestScope.Orders}"/>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css">
|
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css">
|
||||||
@ -23,43 +23,70 @@
|
|||||||
<main class="d-flex flex-nowrap">
|
<main class="d-flex flex-nowrap">
|
||||||
<%@ include file="../includes/header.jsp" %>
|
<%@ include file="../includes/header.jsp" %>
|
||||||
|
|
||||||
<main class="form-signin w-100 m-auto">
|
<main class=" 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>
|
|
||||||
|
|
||||||
|
<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>
|
</div>
|
||||||
</c:if>
|
</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>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
<script src="${webroot}/js/pass.js" type="javascript"></script>
|
<%--<script src="${webroot}/js/pass.js" type="javascript"></script>--%>
|
||||||
<script>
|
<%--<script>--%>
|
||||||
const toastLiveExample = document.getElementById('liveToast')
|
<%-- const toastLiveExample = document.getElementById('liveToast')--%>
|
||||||
|
|
||||||
const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample)
|
<%-- const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample)--%>
|
||||||
toastBootstrap.show()
|
<%-- toastBootstrap.show()--%>
|
||||||
</script>
|
<%--</script>--%>
|
||||||
|
<%--<script src="${webroot}/js/pass.js"></script>--%>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
Reference in New Issue
Block a user