admin stu manage
This commit is contained in:
parent
a2b0187f2e
commit
f5a216cb27
@ -0,0 +1,61 @@
|
||||
package cn.edu.cqwu.repair.controller.admin;
|
||||
|
||||
|
||||
import cn.edu.cqwu.repair.dao.StuDao;
|
||||
import cn.edu.cqwu.repair.entity.Stu;
|
||||
import cn.edu.cqwu.repair.util.Encrypt;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author xtaod
|
||||
*/
|
||||
@Controller
|
||||
public class AdminStuManageController {
|
||||
private final StuDao stuDao;
|
||||
|
||||
@Autowired
|
||||
public AdminStuManageController(StuDao stuDao) {
|
||||
this.stuDao = stuDao;
|
||||
}
|
||||
|
||||
@RequestMapping("/admin/stu_manage/manage.do")
|
||||
public String manage(String username, String userNo, Model model) {
|
||||
if (!username.isEmpty()) {
|
||||
findStusLikeUsername(username, model);
|
||||
} else if (!userNo.isEmpty()) {
|
||||
findStusLikeUserNo(userNo, model);
|
||||
} else {
|
||||
model.addAttribute("stuManageMess", "* 请输入查询条件!");
|
||||
}
|
||||
return "/admin/stu_manage";
|
||||
}
|
||||
|
||||
@RequestMapping("/admin/stu_manage/passReset.do")
|
||||
public String passReset(String username, Model model) {
|
||||
stuPassReset(username, model);
|
||||
return "/admin/stu_manage";
|
||||
}
|
||||
|
||||
private void findStusLikeUsername(String username, Model model) {
|
||||
ArrayList<Stu> stus = stuDao.findStusLikeUsername(username);
|
||||
model.addAttribute("stus", stus);
|
||||
}
|
||||
|
||||
private void findStusLikeUserNo(String userNo, Model model) {
|
||||
ArrayList<Stu> stus = stuDao.findStusLikeUserNo(userNo);
|
||||
model.addAttribute("stus", stus);
|
||||
}
|
||||
|
||||
private void stuPassReset(String username, Model model) {
|
||||
if (stuDao.passModify(username, Encrypt.SHA("000000")) != 0) {
|
||||
model.addAttribute("stuPassResetMess", "* 用户 " + username + " 的密码已重置为‘000000’!");
|
||||
} else {
|
||||
model.addAttribute("stuPassResetMess", "* 用户 " + username + " 的密码清零操作失败!");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,35 +1,34 @@
|
||||
package cn.edu.cqwu.repair.controller.worker;
|
||||
|
||||
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 cn.edu.cqwu.repair.entity.Order;
|
||||
import cn.edu.cqwu.repair.entity.Worker;
|
||||
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 java.util.List;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author sobear
|
||||
*/
|
||||
@Controller
|
||||
public class WorkerFixListController extends HttpServlet{
|
||||
private OrderDao orderDao;
|
||||
private WorkerDao workerDao;
|
||||
public class WorkerFixListController extends HttpServlet {
|
||||
private final OrderDao orderDao;
|
||||
|
||||
@Autowired
|
||||
public WorkerFixListController(WorkerDao workerDao, OrderDao orderDao) {
|
||||
this.workerDao = workerDao;
|
||||
public WorkerFixListController(OrderDao orderDao) {
|
||||
this.orderDao = orderDao;
|
||||
}
|
||||
|
||||
@GetMapping("/workerFixList.do")
|
||||
@RequestMapping("/worker/FixList.do")
|
||||
public String getOrders(Model model, HttpSession session,
|
||||
HttpServletRequest request){
|
||||
HttpServletRequest request) {
|
||||
// 获取Session对象
|
||||
session = request.getSession();
|
||||
|
||||
|
@ -1,32 +1,33 @@
|
||||
package cn.edu.cqwu.repair.controller.worker;
|
||||
|
||||
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 cn.edu.cqwu.repair.entity.Order;
|
||||
import cn.edu.cqwu.repair.entity.Worker;
|
||||
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 java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author sobear
|
||||
*/
|
||||
@Controller
|
||||
public class WorkerHistoryListController extends HttpServlet{
|
||||
private OrderDao orderDao;
|
||||
private WorkerDao workerDao;
|
||||
public class WorkerHistoryListController extends HttpServlet {
|
||||
private final OrderDao orderDao;
|
||||
|
||||
@Autowired
|
||||
public WorkerHistoryListController(WorkerDao workerDao, OrderDao orderDao) {
|
||||
this.workerDao = workerDao;
|
||||
public WorkerHistoryListController(OrderDao orderDao) {
|
||||
this.orderDao = orderDao;
|
||||
}
|
||||
@GetMapping("/workerHistoryList.do")
|
||||
|
||||
@GetMapping("/worker/HistoryList.do")
|
||||
public String getOrders(Model model, HttpSession session,
|
||||
HttpServletRequest request){
|
||||
HttpServletRequest request) {
|
||||
// 获取Session对象
|
||||
session = request.getSession();
|
||||
|
||||
|
@ -1,33 +1,33 @@
|
||||
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 cn.edu.cqwu.repair.entity.Record;
|
||||
import cn.edu.cqwu.repair.entity.Worker;
|
||||
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 java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author sobear
|
||||
*/
|
||||
@Controller
|
||||
public class WorkerHistoryLoginController extends HttpServlet{
|
||||
public class WorkerHistoryLoginController extends HttpServlet {
|
||||
private final RecordDao recordDao;
|
||||
private final WorkerDao workerDao;
|
||||
|
||||
@Autowired
|
||||
public WorkerHistoryLoginController(WorkerDao workerDao, RecordDao recordDao) {
|
||||
this.workerDao = workerDao;
|
||||
public WorkerHistoryLoginController(RecordDao recordDao) {
|
||||
this.recordDao = recordDao;
|
||||
}
|
||||
@GetMapping("/workerHistoryLogin.do")
|
||||
|
||||
@GetMapping("/worker/HistoryLogin.do")
|
||||
public String getOrders(Model model, HttpSession session,
|
||||
HttpServletRequest request){
|
||||
HttpServletRequest request) {
|
||||
// 获取Session对象
|
||||
session = request.getSession();
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class WorkerLoginController {
|
||||
this.recordService = recordService;
|
||||
}
|
||||
|
||||
@RequestMapping("/workerLogin.do")
|
||||
@RequestMapping("/worker/Login.do")
|
||||
public String workerLogin(
|
||||
String username, String password, String code, Model model, HttpSession session,
|
||||
HttpServletRequest request
|
||||
|
@ -31,7 +31,7 @@ public class WorkerOrderStatusController {
|
||||
}else {
|
||||
model.addAttribute("workerListStatusMes", "* 状态更新失败!");
|
||||
}
|
||||
return "forward:/workerFixList.do";
|
||||
return "forward:/worker/FixList.do";
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,5 +13,7 @@ public interface StuDao {
|
||||
|
||||
public int passModify(String username, String newpass);
|
||||
|
||||
public ArrayList<Stu> findStusLikeUsername(String username);
|
||||
ArrayList<Stu> findStusLikeUsername(String username);
|
||||
|
||||
ArrayList<Stu> findStusLikeUserNo(String userNo);
|
||||
}
|
||||
|
@ -60,4 +60,12 @@ public class StuDaoImpl implements StuDao {
|
||||
.where(STU.USERNAME.like(username));
|
||||
return (ArrayList<Stu>) MAPPER.selectListByQuery(qw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Stu> findStusLikeUserNo(String userNo) {
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
qw.select(STU.ALL_COLUMNS)
|
||||
.where(STU.USER_NO.like(userNo));
|
||||
return (ArrayList<Stu>) MAPPER.selectListByQuery(qw);
|
||||
}
|
||||
}
|
||||
|
80
src/main/webapp/admin/stu_manage.jsp
Normal file
80
src/main/webapp/admin/stu_manage.jsp
Normal file
@ -0,0 +1,80 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: xtaod
|
||||
Date: 2024/5/14
|
||||
Time: 下午8:21
|
||||
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="用户维护"/>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<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>
|
||||
<main class="d-flex flex-nowrap">
|
||||
<%@ include file="../includes/header.jsp" %>
|
||||
|
||||
<main class="form-signin w-100 m-auto" style="max-width: 800px;">
|
||||
<img class="mb-4" src="${webroot}/images/logo.jpg" alt="" width="72" height="72">
|
||||
<h1 class="h3 mb-3 fw-normal">${title}</h1>
|
||||
<c:if test="${not empty stuPassResetMess}">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
${stuPassResetMess}
|
||||
</div>
|
||||
</c:if>
|
||||
|
||||
<form action="${webroot}/admin/stu_manage/manage.do" method="post">
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text">用户名</span>
|
||||
<input type="text" class="form-control" name="username" id="username" value="${username}">
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text">学号</span>
|
||||
<input type="text" class="form-control" name="userNo" id="userNo" value="${userNo}">
|
||||
</div>
|
||||
<input class="btn btn-primary w-100 py-2" type="submit" id="submit" value="查询">
|
||||
<br/><br/>
|
||||
</form>
|
||||
|
||||
<c:if test="${not empty stus}">
|
||||
<h5>查询到的用户列表</h5>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">序号</th>
|
||||
<th scope="col">用户名</th>
|
||||
<th scope="col">注册时间</th>
|
||||
<th scope="col">注册IP</th>
|
||||
<th scope="col">密码清零</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${stus}" var="stu" varStatus="rows">
|
||||
<tr>
|
||||
<td>${rows.count}</td>
|
||||
<td>${stu.username}</td>
|
||||
<td>${stu.regtime}</td>
|
||||
<td>${stu.regip}</td>
|
||||
<td><a href="${webroot}/admin/stu_manage/passReset.do?username=${stu.username}">清零</a>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</c:if>
|
||||
</main>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
@ -32,8 +32,8 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="${webroot}/admin/worker.do" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 学生管理
|
||||
<a href="${webroot}/admin/stu_manage.jsp" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 用户维护
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
@ -72,13 +72,13 @@
|
||||
<a href="${webroot}/worker/worker_center_index.jsp" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 个人中心
|
||||
</a>
|
||||
<a href="${webroot}/workerFixList.do" class="nav-link link-body-emphasis" aria-current="page">
|
||||
<a href="${webroot}/worker/FixList.do" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 维修列表
|
||||
</a>
|
||||
<a href="${webroot}/workerHistoryList.do" class="nav-link link-body-emphasis" aria-current="page">
|
||||
<a href="${webroot}/worker/HistoryList.do" class="nav-link link-body-emphasis" aria-current="page">
|
||||
>> 历史维修记录
|
||||
</a>
|
||||
<a href="${webroot}/workerHistoryLogin.do" class="nav-link link-body-emphasis" aria-current="page">
|
||||
<a href="${webroot}/worker/HistoryLogin.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">
|
||||
|
@ -40,7 +40,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form action="${webroot}/workerLogin.do" method="post" >
|
||||
<form action="${webroot}/worker/Login.do" method="post" >
|
||||
<img class="mb-4" src="${webroot}/images/logo.jpg" alt="" width="72" height="72">
|
||||
<h1 class="h3 mb-3 fw-normal">请先登录</h1>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user