fix: worker login history
This commit is contained in:
parent
395d43c7a3
commit
9acc5b3d3c
@ -1,5 +1,60 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AliAccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliControlFlowStatementWithoutBraces" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliDeprecation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliEqualsAvoidNull" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliLongLiteralsEndingWithLowercaseL" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliMissingOverrideAnnotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AliWrapperTypeEquality" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAbstractClassShouldStartWithAbstractNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidApacheBeanUtilsCopy" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidCallStaticSimpleDateFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidCommentBehindStatement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidComplexCondition" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidConcurrentCompetitionRandom" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidDoubleOrFloatEqualCompare" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidManuallyCreateThread" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidMissUseOfMathRandom" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidNegationOperator" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidNewDateGetTime" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidPatternCompileInMethod" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidReturnInFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidStartWithDollarAndUnderLineNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaAvoidUseTimer" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaBooleanPropertyShouldNotStartWithIs" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaClassCastExceptionWithToArray" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaClassMustHaveAuthor" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaClassNamingShouldBeCamel" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaCollectionInitShouldAssignCapacity" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaCommentsMustBeJavadocFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaConcurrentExceptionWithModifyOriginSubList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaCountDownShouldInFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaDontModifyInForeachCircle" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaExceptionClassShouldEndWithException" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaLockShouldWithTryFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaLowerCamelCaseVariableNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaMethodReturnWrapperType" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaMethodTooLong" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaPackageNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaPojoMustOverrideToString" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaPojoMustUsePrimitiveField" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaRemoveCommentedCode" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaSneakyThrowsWithoutExceptionType" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaStringConcat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaSwitchExpression" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaSwitchStatement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaTestClassShouldEndWithTestNaming" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaThreadLocalShouldRemove" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaThreadPoolCreation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaThreadShouldSetName" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaTransactionMustHaveRollback" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUndefineMagicConstant" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUnsupportedExceptionWithModifyAsList" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUseQuietReferenceNotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AlibabaUseRightCaseForDateFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MapOrSetKeyShouldOverrideHashCodeEquals" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
@ -1,17 +1,16 @@
|
||||
package cn.edu.cqwu.repair.controller.worker;
|
||||
|
||||
import cn.edu.cqwu.repair.dao.RecordDao;
|
||||
import cn.edu.cqwu.repair.entity.Record;
|
||||
import cn.edu.cqwu.repair.entity.Worker;
|
||||
import cn.edu.cqwu.repair.util.PageModel;
|
||||
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.SessionAttribute;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author sobear
|
||||
@ -26,18 +25,19 @@ public class WorkerHistoryLoginController extends HttpServlet {
|
||||
}
|
||||
|
||||
@GetMapping("/worker/HistoryLogin.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);
|
||||
public String adminRecord(
|
||||
@SessionAttribute Worker workerUser, Model model, HttpServletRequest request) {
|
||||
String pageNoS = request.getParameter("pageNo");
|
||||
int pageNo = 1;
|
||||
try {
|
||||
pageNo = Integer.parseInt(pageNoS);
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
PageModel pm = recordDao.pageByLogname(
|
||||
workerUser.getUsername(), "工人", 10, pageNo
|
||||
);
|
||||
pm.setPageNav("HistoryLogin.do");
|
||||
model.addAttribute("pm", pm);
|
||||
|
||||
// 返回到展示订单列表的JSP页面
|
||||
return "/worker/worker_history_loginList";
|
||||
|
@ -3,12 +3,8 @@ 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);
|
||||
}
|
||||
|
@ -36,11 +36,4 @@ 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);
|
||||
}
|
||||
}
|
||||
|
@ -81,11 +81,6 @@
|
||||
>> 设备管理
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="${webroot}/admin/state.jsp" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 耗材管理
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="${webroot}/admin/state.jsp" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 统计报表
|
||||
@ -108,12 +103,6 @@
|
||||
<a href="${webroot}/worker/HistoryList.do" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 历史维修记录
|
||||
</a>
|
||||
<a href="${webroot}/worker/HistoryLogin.do" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 历史登录记录
|
||||
</a>
|
||||
<a href="${webroot}/worker/pass.do" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 修改用户信息
|
||||
</a>
|
||||
</li>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
|
@ -24,48 +24,35 @@
|
||||
<body>
|
||||
<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>
|
||||
|
||||
<main class="form-signin w-100 m-auto" style="max-width: 600px;">
|
||||
<img class="mb-4" src="${webroot}/images/logo.jpg" alt="" width="72" height="72">
|
||||
<h1 class="h3 mb-3 fw-normal">${title}</h1>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">序号</th>
|
||||
<th scope="col">登录名</th>
|
||||
<th scope="col">用户组</th>
|
||||
<th scope="col">登录时间</th>
|
||||
<th scope="col">登录IP</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${pm.data}" var="recode" varStatus="row">
|
||||
<tr>
|
||||
<th scope="col">登录用户</th>
|
||||
<th scope="col">用户类型</th>
|
||||
<th scope="col">登录ip</th>
|
||||
<th scope="col">登录时间</th>
|
||||
<td>${pm.fromIndex + row.index + 1}</td>
|
||||
<td>${recode.logname}</td>
|
||||
<td>${recode.usergroup}</td>
|
||||
<td>${recode.logtime}</td>
|
||||
<td>${recode.logip}</td>
|
||||
</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>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
${pm.pageNav}
|
||||
</main>
|
||||
|
||||
|
||||
</main>
|
||||
|
||||
</main>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user