add history login and not divide pages

This commit is contained in:
sobear 2024-05-13 23:14:27 +08:00
parent 7083a0cbb0
commit 5ea1a65e0c
9 changed files with 132 additions and 75 deletions

View File

@ -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);
}

View File

@ -16,4 +16,7 @@ public interface WorkerDao {
int deleteByUserName(String username);
int add(Worker worker);
}

View File

@ -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);
}
}

View File

@ -69,4 +69,6 @@ public class WorkerDaoImpl implements WorkerDao {
public int add(Worker worker) {
return MAPPER.insert(worker);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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