From d8ce35567ebdf51e62fe0926d790c7f06c0b23ee Mon Sep 17 00:00:00 2001 From: wobeitaoleshigexuruo Date: Sun, 12 May 2024 22:29:51 +0800 Subject: [PATCH] stu upload --- .../controller/stu/StuUploadController.java | 48 ++++++++++ .../cn/edu/cqwu/repair/dao/DeviceDao.java | 12 +++ .../java/cn/edu/cqwu/repair/dao/OrderDao.java | 11 +++ .../cqwu/repair/dao/impl/DeviceDaoImpl.java | 28 ++++++ .../cqwu/repair/dao/impl/OrderDaoImpl.java | 20 ++++ .../java/cn/edu/cqwu/repair/entity/Order.java | 2 +- src/main/webapp/stu/upload.jsp | 94 +++++++++++++++++++ src/main/webapp/student/edit.jsp | 65 ------------- src/main/webapp/student/editPassword.jsp | 16 ---- src/main/webapp/student/register.jsp | 92 ------------------ src/main/webapp/student/success.jsp | 16 ---- 11 files changed, 214 insertions(+), 190 deletions(-) create mode 100644 src/main/java/cn/edu/cqwu/repair/controller/stu/StuUploadController.java create mode 100644 src/main/java/cn/edu/cqwu/repair/dao/DeviceDao.java create mode 100644 src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java create mode 100644 src/main/java/cn/edu/cqwu/repair/dao/impl/DeviceDaoImpl.java create mode 100644 src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java create mode 100644 src/main/webapp/stu/upload.jsp delete mode 100644 src/main/webapp/student/edit.jsp delete mode 100644 src/main/webapp/student/editPassword.jsp delete mode 100644 src/main/webapp/student/register.jsp delete mode 100644 src/main/webapp/student/success.jsp diff --git a/src/main/java/cn/edu/cqwu/repair/controller/stu/StuUploadController.java b/src/main/java/cn/edu/cqwu/repair/controller/stu/StuUploadController.java new file mode 100644 index 0000000..21e2fd5 --- /dev/null +++ b/src/main/java/cn/edu/cqwu/repair/controller/stu/StuUploadController.java @@ -0,0 +1,48 @@ + + +package cn.edu.cqwu.repair.controller.stu; + +import cn.edu.cqwu.repair.dao.OrderDao; +import cn.edu.cqwu.repair.dao.StuDao; +import cn.edu.cqwu.repair.entity.Order; +import cn.edu.cqwu.repair.entity.Stu; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.Mapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.SessionAttribute; + +import javax.servlet.http.HttpServletRequest; + +@Controller +public class StuUploadController { + + StuDao stuDao; + + OrderDao orderDao; + @Autowired + public StuUploadController(StuDao stuDao,OrderDao orderDao) { + this.stuDao = stuDao; + this.orderDao = orderDao; + } + + + @PostMapping("/upload.do") +public String upload(Order order, @SessionAttribute Stu stu, HttpServletRequest request){ + order.setStudentId(stu.getUserid()); + order.setStudentId(0); + int is = orderDao.add(order); + if(is==1){ + request.setAttribute("stuUploadMess","上传成功"); + }else{ + request.setAttribute("stuUploadMess","上传失败"); + + } + return "stu/success"; + } + + + + +} diff --git a/src/main/java/cn/edu/cqwu/repair/dao/DeviceDao.java b/src/main/java/cn/edu/cqwu/repair/dao/DeviceDao.java new file mode 100644 index 0000000..2239dbb --- /dev/null +++ b/src/main/java/cn/edu/cqwu/repair/dao/DeviceDao.java @@ -0,0 +1,12 @@ +package cn.edu.cqwu.repair.dao; + +import cn.edu.cqwu.repair.entity.Device; +import cn.edu.cqwu.repair.entity.Stu; + +import java.util.ArrayList; + +public interface DeviceDao { + + public ArrayList findAllDevice(); + +} diff --git a/src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java b/src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java new file mode 100644 index 0000000..cf7fdb9 --- /dev/null +++ b/src/main/java/cn/edu/cqwu/repair/dao/OrderDao.java @@ -0,0 +1,11 @@ +package cn.edu.cqwu.repair.dao; + +import cn.edu.cqwu.repair.entity.AdminUser; +import cn.edu.cqwu.repair.entity.Order; + +public interface OrderDao { + + int add(Order order); + + +} diff --git a/src/main/java/cn/edu/cqwu/repair/dao/impl/DeviceDaoImpl.java b/src/main/java/cn/edu/cqwu/repair/dao/impl/DeviceDaoImpl.java new file mode 100644 index 0000000..72501fc --- /dev/null +++ b/src/main/java/cn/edu/cqwu/repair/dao/impl/DeviceDaoImpl.java @@ -0,0 +1,28 @@ +package cn.edu.cqwu.repair.dao.impl; + +import cn.edu.cqwu.repair.dao.DeviceDao; +import cn.edu.cqwu.repair.dao.StuDao; +import cn.edu.cqwu.repair.db.ConnectionFactory; +import cn.edu.cqwu.repair.entity.Device; +import cn.edu.cqwu.repair.entity.Stu; +import cn.edu.cqwu.repair.entity.mapper.AdminUserMapper; +import cn.edu.cqwu.repair.entity.mapper.DeviceMapper; +import cn.edu.cqwu.repair.service.RecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +@Component +public class DeviceDaoImpl implements DeviceDao { + private static final DeviceMapper mapper = ConnectionFactory.getMapper(DeviceMapper.class); + + + @Override + public ArrayList findAllDevice() { + + + return (ArrayList) mapper.selectAll(); + } + + +} diff --git a/src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java b/src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java new file mode 100644 index 0000000..7792022 --- /dev/null +++ b/src/main/java/cn/edu/cqwu/repair/dao/impl/OrderDaoImpl.java @@ -0,0 +1,20 @@ +package cn.edu.cqwu.repair.dao.impl; + +import cn.edu.cqwu.repair.dao.OrderDao; +import cn.edu.cqwu.repair.db.ConnectionFactory; +import cn.edu.cqwu.repair.entity.Order; +import cn.edu.cqwu.repair.entity.mapper.DeviceMapper; +import cn.edu.cqwu.repair.entity.mapper.OrderMapper; +import org.springframework.stereotype.Component; + +@Component +public class OrderDaoImpl implements OrderDao { + + private static final OrderMapper mapper = ConnectionFactory.getMapper(OrderMapper.class); + + @Override + public int add(Order order) { + + return mapper.insert(order); + } +} diff --git a/src/main/java/cn/edu/cqwu/repair/entity/Order.java b/src/main/java/cn/edu/cqwu/repair/entity/Order.java index ed394f9..4e50db6 100644 --- a/src/main/java/cn/edu/cqwu/repair/entity/Order.java +++ b/src/main/java/cn/edu/cqwu/repair/entity/Order.java @@ -33,7 +33,7 @@ public class Order { // 故障图片 private String faultImg; - // 订单状态 0 表示未完成 1 表示已完成 + // 订单状态 0 表示未分配 1 表示分配、进行中 2 表示已完成 private int orderStatus; // 订单创建时间 @Column(onInsertValue = "now()") diff --git a/src/main/webapp/stu/upload.jsp b/src/main/webapp/stu/upload.jsp new file mode 100644 index 0000000..b330872 --- /dev/null +++ b/src/main/webapp/stu/upload.jsp @@ -0,0 +1,94 @@ +<%@ page import="cn.edu.cqwu.repair.entity.Device" %> +<%@ 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" %> + + + + + + + + + + + ${title} + + + + + +
+ <%@ include file="../includes/header.jsp" %> + +
+
+ +

上传维修单

+ + + + +
+ + +
+ +
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + + + +

+
+ +
+ +
+ + + + + + + diff --git a/src/main/webapp/student/edit.jsp b/src/main/webapp/student/edit.jsp deleted file mode 100644 index 6778995..0000000 --- a/src/main/webapp/student/edit.jsp +++ /dev/null @@ -1,65 +0,0 @@ - -<%@ 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" %> - - - - - - - - - - - ${title} - - - - - -
- <%@ include file="../includes/header.jsp" %> - -
-
- -

修改用户密码

- - - - -
- - -
- -
- - -
- - - -

-
- -
- -
- - - - - - - diff --git a/src/main/webapp/student/editPassword.jsp b/src/main/webapp/student/editPassword.jsp deleted file mode 100644 index 397a84d..0000000 --- a/src/main/webapp/student/editPassword.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%-- - Created by IntelliJ IDEA. - User: Administrator - Date: 2024/5/12 - Time: 21:10 - To change this template use File | Settings | File Templates. ---%> -<%@ page contentType="text/html;charset=UTF-8" language="java" %> - - - Title - - - - - diff --git a/src/main/webapp/student/register.jsp b/src/main/webapp/student/register.jsp deleted file mode 100644 index dff5b40..0000000 --- a/src/main/webapp/student/register.jsp +++ /dev/null @@ -1,92 +0,0 @@ -<%@ 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" %> - - - - - - - - - - ${title} - - - - - - -
- <%@ include file="../includes/header.jsp" %> - -
-
- -
-
- -

注册

- - - - - - - - -
- - - -
- - - - -
- - - - -
-
- - - - -
- - -
- - - - - -
-
- - - - - diff --git a/src/main/webapp/student/success.jsp b/src/main/webapp/student/success.jsp deleted file mode 100644 index 6d60220..0000000 --- a/src/main/webapp/student/success.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%-- - Created by IntelliJ IDEA. - User: Administrator - Date: 2024/5/12 - Time: 20:03 - To change this template use File | Settings | File Templates. ---%> -<%@ page contentType="text/html;charset=UTF-8" language="java" %> - - - Title - - -

成功

- -