Compare commits

..

No commits in common. "815a6c4a7811fd4b78e50621f0a09b031fe46633" and "f3445238b3d3f9a6a7d1fa358ebac1257c7acbc7" have entirely different histories.

12 changed files with 44 additions and 177 deletions

View File

@ -4,7 +4,6 @@
<option name="state">
<map>
<entry key="file://$PROJECT_DIR$/src/main/webapp/student/register.jsp" value="file://$PROJECT_DIR$/src/main/webapp/student" />
<entry key="file://$PROJECT_DIR$/src/main/webapp/worker/worker_center_index.jsp" value="file://$PROJECT_DIR$/src/main/webapp/worker" />
</map>
</option>
</component>

View File

@ -1,52 +0,0 @@
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<Order> orders = (List<Order>) orderDao.findByWorkerId(workerUser.getUserid());
// 将订单数据添加到Model中以便在JSP页面中使用
model.addAttribute("orders", orders);
// 返回到展示订单列表的JSP页面
return "/worker/worker_fixList";
}
}

View File

@ -51,7 +51,7 @@ public class WorkerLoginController {
session.setAttribute("workerUser", user);
return "redirect:/worker/worker_center_index.jsp";
} else {
model.addAttribute("workerLoginMess", "* 登录异常!");
model.addAttribute("adminLoginMess", "* 登录异常!");
return "/worker_login";
}
}

View File

@ -1,13 +1,11 @@
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<Order> findByWorkerId(int workerId);
}

View File

@ -3,34 +3,18 @@ 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<Order> findByWorkerId(int workerId){
QueryWrapper qw = new QueryWrapper();
qw.select(ORDER.ALL_COLUMNS).where(ORDER.WORKER_ID.eq(workerId));
return (ArrayList<Order>) mapper.selectListByQuery(qw);
}
}

View File

@ -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 {

View File

@ -64,20 +64,20 @@
</c:when>
<c:when test="${not empty sessionScope.workerUser}">
<li class="nav-item">
<a href="${webroot}/worker/worker_center_index.jsp" class="nav-link link-body-emphasis" aria-current="page">
<a href="${webroot}/admin/state.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 个人中心
</a>
<a href="${webroot}/worker/worker_fixList.jsp" class="nav-link link-body-emphasis" aria-current="page">
<a href="${webroot}/admin/state.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 维修列表
</a>
<a href="${webroot}/worker/worker_history_fixList.jsp" class="nav-link link-body-emphasis" aria-current="page">
<a href="${webroot}/admin/state.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 历史维修记录
</a>
<a href="${webroot}/worker/worker_history_loginList.jsp" class="nav-link link-body-emphasis" aria-current="page">
<a href="${webroot}/admin/state.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 历史登录记录
</a>
<a href="${webroot}/worker/worker_modify.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 修改用户信息
<a href="${webroot}/admin/state.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 个人中心
</a>
</li>
</c:when>

View File

@ -36,10 +36,42 @@
<a href="${webroot}/"
class="d-flex align-items-center mb-3 mb-md-0 me-md-auto link-body-emphasis text-decoration-none">
<img src="${webroot}/images/logo.jpg" alt="" width="32" height="32" class="rounded-circle me-2">
<span class="fs-4">工人个人中心</span>
<span class="fs-4">维修管理系统</span>
</a>
<hr>
<%@ include file="../includes/menu.jsp" %>
<ul class="nav nav-pills flex-column mb-auto">
<c:choose>
<c:when test="${not empty sessionScope.username}">
<li class="nav-item">
<a href="${webroot}/stu/notice.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 主页
</a>
</li>
<li class="nav-item">
<a href="${webroot}/xx.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 个人中心
</a>
</li>
<li class="nav-item">
<a href="${webroot}/xx.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 已接任务
</a>
</li>
<li class="nav-item">
<a href="${webroot}/xx.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 历史任务
</a>
</li>
</c:when>
<c:otherwise>
<li class="nav-item">
<a href="${webroot}/" class="nav-link link-body-emphasis" aria-current="page">
>> 主页
</a>
</li>
</c:otherwise>
</c:choose>
</ul>
</div>
</header>
<main>
@ -47,6 +79,7 @@
<div class="row">
<div class="col-md-8 offset-md-2">
<!-- 工人个人中心主页内容 -->
<h1 class="text-center">工人个人中心</h1>
<div class="highlight"> <!-- 添加了红色边框的容器 -->
<div class="card">
<div class="card-body">
@ -71,6 +104,5 @@
</div>
</div>
</main>
<%@ include file="../includes/footer.jsp" %>
</body>
</html>

View File

@ -1,46 +0,0 @@
<%--
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" %>
<html>
<head>
<title>订单列表</title>
</head>
<body>
<h1>订单列表</h1>
<table border="1">
<tr>
<th>订单ID</th>
<th>设备ID</th>
<th>联系人ID</th>
<th>联系电话</th>
<th>维修地址</th>
<th>故障描述</th>
<th>故障图片</th>
<th>订单状态</th>
<th>创建时间</th>
<th>完成时间</th>
</tr>
<!-- 使用forEach循环来遍历订单列表 -->
<c:forEach items="${orders}" var="order">
<tr>
<td>${order.orderId}</td>
<td>${order.deviceId}</td>
<td>${order.studentId}</td>
<td>${order.phone}</td>
<td>${order.address}</td>
<td>${order.contact}</td>
<td>${order.faultImg}</td>
<td>${order.orderStatus}</td>
<td>${order.createTime}</td>
<td>${order.finishTime}</td>
</tr>
</c:forEach>
</table>
</body>
</html>

View File

@ -1,16 +0,0 @@
<%--
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" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<p>这是历史维修记录</p>
</body>
</html>

View File

@ -1,16 +0,0 @@
<%--
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" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<p>历史登录记录</p>
</body>
</html>

View File

@ -1,16 +0,0 @@
<%--
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" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<p>修改信息</p>
</body>
</html>