From 8eae23474dc9967ee0065a9502ec05bfc0d17d4b Mon Sep 17 00:00:00 2001 From: wobeitaoleshigexuruo Date: Wed, 5 Jun 2024 21:35:27 +0800 Subject: [PATCH] stu upload --- .../controller/stu/StuConsultController.java | 12 ++- .../controller/stu/StuUploadController.java | 2 +- .../java/cn/edu/cqwu/repair/dao/OrderDao.java | 2 +- .../java/cn/edu/cqwu/repair/dao/StuDao.java | 2 +- .../cqwu/repair/dao/impl/OrderDaoImpl.java | 6 +- .../edu/cqwu/repair/dao/impl/StuDaoImpl.java | 3 + src/main/webapp/includes/menu.jsp | 22 ++++- src/main/webapp/stu/consult.jsp | 87 ++++++++++++------- 8 files changed, 98 insertions(+), 38 deletions(-) diff --git a/src/main/java/cn/edu/cqwu/repair/controller/stu/StuConsultController.java b/src/main/java/cn/edu/cqwu/repair/controller/stu/StuConsultController.java index fec2b80..96fa96c 100644 --- a/src/main/java/cn/edu/cqwu/repair/controller/stu/StuConsultController.java +++ b/src/main/java/cn/edu/cqwu/repair/controller/stu/StuConsultController.java @@ -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 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"; } diff --git a/src/main/java/cn/edu/cqwu/repair/controller/stu/StuUploadController.java b/src/main/java/cn/edu/cqwu/repair/controller/stu/StuUploadController.java index 4c41d02..c1d5f61 100644 --- a/src/main/java/cn/edu/cqwu/repair/controller/stu/StuUploadController.java +++ b/src/main/java/cn/edu/cqwu/repair/controller/stu/StuUploadController.java @@ -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()); // diff --git a/src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java b/src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java index 2f4eb6f..40782b7 100644 --- a/src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java +++ b/src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java @@ -7,7 +7,7 @@ import java.util.ArrayList; public interface OrderDao { int add(Order order); - Order findByStudent_id(int id); + ArrayList findByStudent_id(int stuId); ArrayList findByWorkerId(int workerId); public int statusModify(int orderId); diff --git a/src/main/java/cn/edu/cqwu/repair/dao/StuDao.java b/src/main/java/cn/edu/cqwu/repair/dao/StuDao.java index c85c4e0..525eb32 100644 --- a/src/main/java/cn/edu/cqwu/repair/dao/StuDao.java +++ b/src/main/java/cn/edu/cqwu/repair/dao/StuDao.java @@ -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); diff --git a/src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java b/src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java index 9cc2efd..313e9ba 100644 --- a/src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java +++ b/src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java @@ -28,8 +28,10 @@ public class OrderDaoImpl implements OrderDao { } @Override - public Order findByStudent_id(int id) { - return null; + public ArrayList findByStudent_id(int stuId) { + QueryWrapper qw = new QueryWrapper(); + qw.select(ORDER.ALL_COLUMNS).where(ORDER.STUDENT_ID.eq(stuId)); + return (ArrayList) mapper.selectListByQuery(qw); } @Override diff --git a/src/main/java/cn/edu/cqwu/repair/dao/impl/StuDaoImpl.java b/src/main/java/cn/edu/cqwu/repair/dao/impl/StuDaoImpl.java index bc577a8..6c14a6f 100644 --- a/src/main/java/cn/edu/cqwu/repair/dao/impl/StuDaoImpl.java +++ b/src/main/java/cn/edu/cqwu/repair/dao/impl/StuDaoImpl.java @@ -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) { diff --git a/src/main/webapp/includes/menu.jsp b/src/main/webapp/includes/menu.jsp index 10e63a3..31b846c 100644 --- a/src/main/webapp/includes/menu.jsp +++ b/src/main/webapp/includes/menu.jsp @@ -15,10 +15,30 @@ + + + +