add worker login

This commit is contained in:
sobear 2024-05-12 21:30:10 +08:00
parent bdd1279167
commit 208d5bcd27
4 changed files with 32 additions and 1 deletions

View File

@ -9,7 +9,7 @@
</option>
<option name="workspaceImportForciblyTurnedOn" value="true" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="18" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -1,10 +1,12 @@
package cn.edu.cqwu.repair.service;
import cn.edu.cqwu.repair.entity.AdminUser;
import cn.edu.cqwu.repair.entity.Worker;
import cn.edu.cqwu.repair.util.PageModel;
public interface RecordService {
int add(AdminUser user, String ip);
int add(Worker user, String ip);
PageModel pageByLogname(String logname, String group, int pageSize, int pageNo);
}

View File

@ -3,6 +3,7 @@ package cn.edu.cqwu.repair.service.impl;
import cn.edu.cqwu.repair.dao.RecordDao;
import cn.edu.cqwu.repair.entity.AdminUser;
import cn.edu.cqwu.repair.entity.Record;
import cn.edu.cqwu.repair.entity.Worker;
import cn.edu.cqwu.repair.service.RecordService;
import cn.edu.cqwu.repair.util.PageModel;
import org.springframework.beans.factory.annotation.Autowired;
@ -26,6 +27,15 @@ public class RecordServiceImpl implements RecordService {
return recordDao.add(record);
}
@Override
public int add(Worker user, String ip) {
Record record = new Record();
record.setLogname(user.getUsername());
record.setUsergroup("工人");
record.setLogip(ip);
return recordDao.add(record);
}
@Override
public PageModel pageByLogname(String logname, String group, int pageSize, int pageNo) {
return recordDao.pageByLogname(logname, group, pageSize, pageNo);

View File

@ -62,6 +62,25 @@
</a>
</li>
</c:when>
<c:when test="${not empty sessionScope.workerUser}">
<li class="nav-item">
<a href="${webroot}/admin/state.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 个人中心
</a>
<a href="${webroot}/admin/state.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 维修列表
</a>
<a href="${webroot}/admin/state.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 历史维修记录
</a>
<a href="${webroot}/admin/state.jsp" class="nav-link link-body-emphasis" aria-current="page">
>> 历史登录记录
</a>
<a href="${webroot}/admin/state.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">