diff --git a/.idea/webContexts.xml b/.idea/webContexts.xml index 0aa5ca8..847b281 100644 --- a/.idea/webContexts.xml +++ b/.idea/webContexts.xml @@ -4,6 +4,7 @@ diff --git a/src/main/java/cn/edu/cqwu/repair/controller/worker/WorkerFixListController.java b/src/main/java/cn/edu/cqwu/repair/controller/worker/WorkerFixListController.java new file mode 100644 index 0000000..92a73ea --- /dev/null +++ b/src/main/java/cn/edu/cqwu/repair/controller/worker/WorkerFixListController.java @@ -0,0 +1,52 @@ +package cn.edu.cqwu.repair.controller.worker; + +import cn.edu.cqwu.repair.dao.WorkerDao; +import org.springframework.stereotype.Controller; + + +import cn.edu.cqwu.repair.dao.OrderDao; + +import javax.servlet.http.*; +import cn.edu.cqwu.repair.entity.*; +import cn.edu.cqwu.repair.service.RecordService; +import cn.edu.cqwu.repair.util.Encrypt; +import cn.edu.cqwu.repair.util.Verify; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import java.util.List;import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + + + +@Controller +public class WorkerFixListController extends HttpServlet{ + private OrderDao orderDao; + private WorkerDao workerDao; + @Autowired + public WorkerFixListController(WorkerDao workerDao, OrderDao orderDao) { + this.workerDao = workerDao; + this.orderDao = orderDao; + } + + @GetMapping("/workerFixList.do") + public String getOrders(Model model, HttpSession session, + HttpServletRequest request){ + // 获取Session对象 + session = request.getSession(); + + // 从Session中获取ID数据 + Worker workerUser = (Worker) session.getAttribute("workerUser"); + // 调用DAO的方法来获取数据库中的订单数据 + List orders = (List) orderDao.findByWorkerId(workerUser.getUserid()); + + // 将订单数据添加到Model中,以便在JSP页面中使用 + model.addAttribute("orders", orders); + + // 返回到展示订单列表的JSP页面 + return "/worker/worker_fixList"; + } +} diff --git a/src/main/java/cn/edu/cqwu/repair/controller/worker/WorkerLoginController.java b/src/main/java/cn/edu/cqwu/repair/controller/worker/WorkerLoginController.java index 3479f52..da63b64 100644 --- a/src/main/java/cn/edu/cqwu/repair/controller/worker/WorkerLoginController.java +++ b/src/main/java/cn/edu/cqwu/repair/controller/worker/WorkerLoginController.java @@ -51,7 +51,7 @@ public class WorkerLoginController { session.setAttribute("workerUser", user); return "redirect:/worker/worker_center_index.jsp"; } else { - model.addAttribute("adminLoginMess", "* 登录异常!"); + model.addAttribute("workerLoginMess", "* 登录异常!"); return "/worker_login"; } } 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 cf7fdb9..bfa628d 100644 --- a/src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java +++ b/src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java @@ -1,11 +1,13 @@ package cn.edu.cqwu.repair.dao; -import cn.edu.cqwu.repair.entity.AdminUser; import cn.edu.cqwu.repair.entity.Order; +import java.util.ArrayList; + public interface OrderDao { int add(Order order); + ArrayList findByWorkerId(int workerId); } 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 7792022..496830a 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 @@ -3,18 +3,34 @@ 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.Worker; import cn.edu.cqwu.repair.entity.mapper.DeviceMapper; import cn.edu.cqwu.repair.entity.mapper.OrderMapper; +import cn.edu.cqwu.repair.entity.mapper.WorkerMapper; +import com.mybatisflex.core.query.QueryWrapper; import org.springframework.stereotype.Component; +import java.util.ArrayList; + +import static cn.edu.cqwu.repair.entity.table.WorkerTableDef.WORKER; +import static cn.edu.cqwu.repair.entity.table.OrderTableDef.ORDER; + @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); } + + @Override + public ArrayList findByWorkerId(int workerId){ + QueryWrapper qw = new QueryWrapper(); + qw.select(ORDER.ALL_COLUMNS).where(ORDER.WORKER_ID.eq(workerId)); + return (ArrayList) mapper.selectListByQuery(qw); + } } diff --git a/src/main/java/cn/edu/cqwu/repair/dao/impl/WorkerDaoImpl.java b/src/main/java/cn/edu/cqwu/repair/dao/impl/WorkerDaoImpl.java index c12b51f..9569d4e 100644 --- a/src/main/java/cn/edu/cqwu/repair/dao/impl/WorkerDaoImpl.java +++ b/src/main/java/cn/edu/cqwu/repair/dao/impl/WorkerDaoImpl.java @@ -12,7 +12,7 @@ import org.springframework.stereotype.Component; import java.util.ArrayList; -import static cn.edu.cqwu.repair.entity.table.StuTableDef.STU; + import static cn.edu.cqwu.repair.entity.table.WorkerTableDef.WORKER; @Component public class WorkerDaoImpl implements WorkerDao { diff --git a/src/main/webapp/includes/menu.jsp b/src/main/webapp/includes/menu.jsp index b8ad27d..4d0717b 100644 --- a/src/main/webapp/includes/menu.jsp +++ b/src/main/webapp/includes/menu.jsp @@ -64,20 +64,20 @@ diff --git a/src/main/webapp/worker/worker_center_index.jsp b/src/main/webapp/worker/worker_center_index.jsp index e08a07d..aae6841 100644 --- a/src/main/webapp/worker/worker_center_index.jsp +++ b/src/main/webapp/worker/worker_center_index.jsp @@ -36,42 +36,10 @@ - 维修管理系统 + 工人个人中心
- + <%@ include file="../includes/menu.jsp" %>
@@ -79,7 +47,6 @@
-

工人个人中心

@@ -104,5 +71,6 @@
+<%@ include file="../includes/footer.jsp" %> diff --git a/src/main/webapp/worker/worker_fixList.jsp b/src/main/webapp/worker/worker_fixList.jsp new file mode 100644 index 0000000..62b2377 --- /dev/null +++ b/src/main/webapp/worker/worker_fixList.jsp @@ -0,0 +1,46 @@ +<%-- + Created by IntelliJ IDEA. + User: sobear + Date: 2024/5/12 + Time: 21:41 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + 订单列表 + + +

订单列表

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
订单ID设备ID联系人ID联系电话维修地址故障描述故障图片订单状态创建时间完成时间
${order.orderId}${order.deviceId}${order.studentId}${order.phone}${order.address}${order.contact}${order.faultImg}${order.orderStatus}${order.createTime}${order.finishTime}
+ + diff --git a/src/main/webapp/worker/worker_history_fixList.jsp b/src/main/webapp/worker/worker_history_fixList.jsp new file mode 100644 index 0000000..349b5d3 --- /dev/null +++ b/src/main/webapp/worker/worker_history_fixList.jsp @@ -0,0 +1,16 @@ +<%-- + Created by IntelliJ IDEA. + User: sobear + Date: 2024/5/12 + Time: 21:41 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + +

这是历史维修记录

+ + diff --git a/src/main/webapp/worker/worker_history_loginList.jsp b/src/main/webapp/worker/worker_history_loginList.jsp new file mode 100644 index 0000000..14ef283 --- /dev/null +++ b/src/main/webapp/worker/worker_history_loginList.jsp @@ -0,0 +1,16 @@ +<%-- + Created by IntelliJ IDEA. + User: sobear + Date: 2024/5/12 + Time: 21:44 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + +

历史登录记录

+ + diff --git a/src/main/webapp/worker/worker_modify.jsp b/src/main/webapp/worker/worker_modify.jsp new file mode 100644 index 0000000..b906574 --- /dev/null +++ b/src/main/webapp/worker/worker_modify.jsp @@ -0,0 +1,16 @@ +<%-- + Created by IntelliJ IDEA. + User: sobear + Date: 2024/5/12 + Time: 21:45 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + +

修改信息

+ +