Compare commits
2 Commits
7083a0cbb0
...
a2b0187f2e
Author | SHA1 | Date | |
---|---|---|---|
a2b0187f2e | |||
5ea1a65e0c |
@ -0,0 +1,46 @@
|
||||
package cn.edu.cqwu.repair.controller.worker;
|
||||
|
||||
import cn.edu.cqwu.repair.dao.RecordDao;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
@Controller
|
||||
public class WorkerHistoryLoginController extends HttpServlet{
|
||||
private final RecordDao recordDao;
|
||||
private final WorkerDao workerDao;
|
||||
@Autowired
|
||||
public WorkerHistoryLoginController(WorkerDao workerDao, RecordDao recordDao) {
|
||||
this.workerDao = workerDao;
|
||||
this.recordDao = recordDao;
|
||||
}
|
||||
@GetMapping("/workerHistoryLogin.do")
|
||||
public String getOrders(Model model, HttpSession session,
|
||||
HttpServletRequest request){
|
||||
// 获取Session对象
|
||||
session = request.getSession();
|
||||
|
||||
// 从Session中获取ID数据
|
||||
Worker workerUser = (Worker) session.getAttribute("workerUser");
|
||||
// 调用DAO的方法来获取数据库中的历史登录数据
|
||||
List<Record> records = (List<Record>) recordDao.findHistoryRecord(workerUser.getUsername());
|
||||
|
||||
// 将订单数据添加到Model中,以便在JSP页面中使用
|
||||
model.addAttribute("records", records);
|
||||
|
||||
// 返回到展示订单列表的JSP页面
|
||||
return "/worker/worker_history_loginList";
|
||||
}
|
||||
|
||||
}
|
@ -3,8 +3,12 @@ package cn.edu.cqwu.repair.dao;
|
||||
import cn.edu.cqwu.repair.entity.Record;
|
||||
import cn.edu.cqwu.repair.util.PageModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface RecordDao {
|
||||
int add(Record record);
|
||||
|
||||
PageModel pageByLogname(String logname, String group, int pageSize, int pageNo);
|
||||
|
||||
public ArrayList<Record> findHistoryRecord(String workername);
|
||||
}
|
||||
|
@ -16,4 +16,7 @@ public interface WorkerDao {
|
||||
int deleteByUserName(String username);
|
||||
|
||||
int add(Worker worker);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,14 +2,17 @@ package cn.edu.cqwu.repair.dao.impl;
|
||||
|
||||
import cn.edu.cqwu.repair.dao.RecordDao;
|
||||
import cn.edu.cqwu.repair.db.ConnectionFactory;
|
||||
import cn.edu.cqwu.repair.entity.Order;
|
||||
import cn.edu.cqwu.repair.entity.Record;
|
||||
import cn.edu.cqwu.repair.entity.mapper.RecordMapper;
|
||||
import cn.edu.cqwu.repair.util.PageModel;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.edu.cqwu.repair.entity.table.OrderTableDef.ORDER;
|
||||
import static cn.edu.cqwu.repair.entity.table.RecordTableDef.RECORD;
|
||||
|
||||
/**
|
||||
@ -33,4 +36,11 @@ public class RecordDaoImpl implements RecordDao {
|
||||
List<Record> recordsList = mapper.selectListByQuery(qw);
|
||||
return new PageModel(pageSize, pageNo, recordsList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Record> findHistoryRecord(String workername){
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
qw.select(RECORD.ALL_COLUMNS).where(RECORD.LOGNAME.eq(workername));
|
||||
return (ArrayList<Record>) mapper.selectListByQuery(qw);
|
||||
}
|
||||
}
|
||||
|
@ -69,4 +69,6 @@ public class WorkerDaoImpl implements WorkerDao {
|
||||
public int add(Worker worker) {
|
||||
return MAPPER.insert(worker);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -78,7 +78,7 @@
|
||||
<a href="${webroot}/workerHistoryList.do" 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}/workerHistoryLogin.do" 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">
|
||||
|
@ -112,39 +112,6 @@
|
||||
|
||||
|
||||
|
||||
<%--<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>--%>
|
||||
<%--<script>--%>
|
||||
<%-- $(document).ready(function () {--%>
|
||||
<%-- $('.status-btn').click(function () {--%>
|
||||
<%-- var orderId = $(this).data('order-id');--%>
|
||||
<%-- var currentStatus = $(this).data('current-status');--%>
|
||||
<%-- var newStatus = currentStatus === 0 ? 1 : 0; // 切换状态,0表示未完成,1表示已完成--%>
|
||||
<%-- var requestData = {--%>
|
||||
<%-- orderId: orderId,--%>
|
||||
<%-- newStatus: newStatus--%>
|
||||
<%-- };--%>
|
||||
|
||||
<%-- $.ajax({--%>
|
||||
<%-- type: 'POST',--%>
|
||||
<%-- url: '/updateOrderStatus', // 替换成你的后端处理更新订单状态的接口地址--%>
|
||||
<%-- data: requestData,--%>
|
||||
<%-- success: function (response) {--%>
|
||||
<%-- // 更新按钮文本和数据属性--%>
|
||||
<%-- if (newStatus === 1) {--%>
|
||||
<%-- $(this).text('未完成').data('current-status', 1);--%>
|
||||
<%-- } else {--%>
|
||||
<%-- $(this).text('已完成').data('current-status', 1);--%>
|
||||
<%-- }--%>
|
||||
<%-- },--%>
|
||||
<%-- error: function () {--%>
|
||||
<%-- alert('更新订单状态失败');--%>
|
||||
<%-- }--%>
|
||||
<%-- });--%>
|
||||
<%-- });--%>
|
||||
<%-- });--%>
|
||||
<%--</script>--%>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
|
@ -112,41 +112,6 @@
|
||||
|
||||
</main>
|
||||
|
||||
|
||||
|
||||
<%--<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>--%>
|
||||
<%--<script>--%>
|
||||
<%-- $(document).ready(function () {--%>
|
||||
<%-- $('.status-btn').click(function () {--%>
|
||||
<%-- var orderId = $(this).data('order-id');--%>
|
||||
<%-- var currentStatus = $(this).data('current-status');--%>
|
||||
<%-- var newStatus = currentStatus === 0 ? 1 : 0; // 切换状态,0表示未完成,1表示已完成--%>
|
||||
<%-- var requestData = {--%>
|
||||
<%-- orderId: orderId,--%>
|
||||
<%-- newStatus: newStatus--%>
|
||||
<%-- };--%>
|
||||
|
||||
<%-- $.ajax({--%>
|
||||
<%-- type: 'POST',--%>
|
||||
<%-- url: '/updateOrderStatus', // 替换成你的后端处理更新订单状态的接口地址--%>
|
||||
<%-- data: requestData,--%>
|
||||
<%-- success: function (response) {--%>
|
||||
<%-- // 更新按钮文本和数据属性--%>
|
||||
<%-- if (newStatus === 1) {--%>
|
||||
<%-- $(this).text('未完成').data('current-status', 1);--%>
|
||||
<%-- } else {--%>
|
||||
<%-- $(this).text('已完成').data('current-status', 1);--%>
|
||||
<%-- }--%>
|
||||
<%-- },--%>
|
||||
<%-- error: function () {--%>
|
||||
<%-- alert('更新订单状态失败');--%>
|
||||
<%-- }--%>
|
||||
<%-- });--%>
|
||||
<%-- });--%>
|
||||
<%-- });--%>
|
||||
<%--</script>--%>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
|
@ -2,15 +2,70 @@
|
||||
Created by IntelliJ IDEA.
|
||||
User: sobear
|
||||
Date: 2024/5/12
|
||||
Time: 21:44
|
||||
Time: 21:41
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
|
||||
<c:set var="title" value="工人历史登录记录"/>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>${title}</title>
|
||||
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css" crossorigin="anonymous">
|
||||
<script src="${webroot}/js/bootstrap.bundle.min.js"></script>
|
||||
<link rel="stylesheet" href="${webroot}/styles/sidebar.css" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="${webroot}/styles/index.css" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<p>历史登录记录</p>
|
||||
<main class="d-flex flex-nowrap">
|
||||
<%@ include file="../includes/header.jsp" %>
|
||||
<main class="w-100 m-auto">
|
||||
<c:choose>
|
||||
<c:when test="${not empty requestScope.records}">
|
||||
<div class="table-responsive">
|
||||
<table class="table align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">登录用户</th>
|
||||
<th scope="col">用户类型</th>
|
||||
<th scope="col">登录ip</th>
|
||||
<th scope="col">登录时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${records}" var="records">
|
||||
<tr>
|
||||
<td>${records.logname}</td>
|
||||
<td>${records.usergroup}</td>
|
||||
<td>${records.logip}</td>
|
||||
<td>${records.logtime}</td>
|
||||
<!-- 添加其他订单信息的列 -->
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="alert alert-primary square-alert" role="alert">
|
||||
你还没有登录记录哦!!!
|
||||
</div>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
|
||||
</main>
|
||||
|
||||
</main>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
||||
|
@ -2,15 +2,66 @@
|
||||
Created by IntelliJ IDEA.
|
||||
User: sobear
|
||||
Date: 2024/5/12
|
||||
Time: 21:45
|
||||
Time: 21:41
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
<c:set var="webroot" value="${pageContext.request.contextPath}"/>
|
||||
<c:set var="title" value="工人端修改密码"/>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>${title}</title>
|
||||
<link rel="stylesheet" href="${webroot}/styles/bootstrap.min.css" crossorigin="anonymous">
|
||||
<script src="${webroot}/js/bootstrap.bundle.min.js"></script>
|
||||
<link rel="stylesheet" href="${webroot}/styles/sidebar.css" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="${webroot}/styles/index.css" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<p>修改信息</p>
|
||||
<main class="d-flex flex-nowrap">
|
||||
<%@ include file="../includes/header.jsp" %>
|
||||
|
||||
<main class="w-100 m-auto">
|
||||
<div class="container" style="margin: 50px;">
|
||||
<table class="table table-bordered table-hover" id="tb">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<input type="checkbox">
|
||||
</th>
|
||||
<th>登录用户名</th>
|
||||
<th>用户类型</th>
|
||||
<th>登录ip</th>
|
||||
<th>登录时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="checkbox" class="checks">
|
||||
</td>
|
||||
<td>ve</td>
|
||||
<td>ve</td>
|
||||
<td>ve</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</main>
|
||||
|
||||
|
||||
</main>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user