diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 8d66637..f8fb95b 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,5 +1,60 @@ \ No newline at end of file diff --git a/src/main/java/cn/edu/cqwu/repair/controller/worker/WorkerHistoryLoginController.java b/src/main/java/cn/edu/cqwu/repair/controller/worker/WorkerHistoryLoginController.java index c92d0e1..3f1a251 100644 --- a/src/main/java/cn/edu/cqwu/repair/controller/worker/WorkerHistoryLoginController.java +++ b/src/main/java/cn/edu/cqwu/repair/controller/worker/WorkerHistoryLoginController.java @@ -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 records = (List) 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"; diff --git a/src/main/java/cn/edu/cqwu/repair/dao/RecordDao.java b/src/main/java/cn/edu/cqwu/repair/dao/RecordDao.java index e881d11..5d74563 100644 --- a/src/main/java/cn/edu/cqwu/repair/dao/RecordDao.java +++ b/src/main/java/cn/edu/cqwu/repair/dao/RecordDao.java @@ -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 findHistoryRecord(String workername); } diff --git a/src/main/java/cn/edu/cqwu/repair/dao/impl/RecordDaoImpl.java b/src/main/java/cn/edu/cqwu/repair/dao/impl/RecordDaoImpl.java index 6f3e89d..b4791f6 100644 --- a/src/main/java/cn/edu/cqwu/repair/dao/impl/RecordDaoImpl.java +++ b/src/main/java/cn/edu/cqwu/repair/dao/impl/RecordDaoImpl.java @@ -36,11 +36,4 @@ public class RecordDaoImpl implements RecordDao { List recordsList = mapper.selectListByQuery(qw); return new PageModel(pageSize, pageNo, recordsList); } - - @Override - public ArrayList findHistoryRecord(String workername){ - QueryWrapper qw = new QueryWrapper(); - qw.select(RECORD.ALL_COLUMNS).where(RECORD.LOGNAME.eq(workername)); - return (ArrayList) mapper.selectListByQuery(qw); - } } diff --git a/src/main/webapp/includes/menu.jsp b/src/main/webapp/includes/menu.jsp index 8fa25c1..4dd4960 100644 --- a/src/main/webapp/includes/menu.jsp +++ b/src/main/webapp/includes/menu.jsp @@ -81,11 +81,6 @@ >> 设备管理 - diff --git a/src/main/webapp/worker/worker_history_loginList.jsp b/src/main/webapp/worker/worker_history_loginList.jsp index 5cfd238..3ba0303 100644 --- a/src/main/webapp/worker/worker_history_loginList.jsp +++ b/src/main/webapp/worker/worker_history_loginList.jsp @@ -24,48 +24,35 @@
<%@ include file="../includes/header.jsp" %> -
- - -
- - + +
+ +

${title}

+ +
+ + + + + + + + + + + - - - - + + + + + - - - - - - - - - - - - -
序号登录名用户组登录时间登录IP
登录用户用户类型登录ip登录时间${pm.fromIndex + row.index + 1}${recode.logname}${recode.usergroup}${recode.logtime}${recode.logip}
${records.logname}${records.usergroup}${records.logip}${records.logtime}
- - - - - -
+ + + + ${pm.pageNav}
- - -
- - - - -