diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0efb26c..d0e6afb 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -7,29 +7,16 @@ - - - - - - - - + + + + - - - - - - - - - - + @@ -243,11 +230,6 @@ - - - - - @@ -289,7 +271,7 @@ - + @@ -309,10 +291,10 @@ - + - + diff --git a/src/main/java/cn/ppdxzz/dao/StudentDao.java b/src/main/java/cn/ppdxzz/dao/StudentDao.java index d8da82e..81a4b2b 100644 --- a/src/main/java/cn/ppdxzz/dao/StudentDao.java +++ b/src/main/java/cn/ppdxzz/dao/StudentDao.java @@ -44,7 +44,7 @@ public interface StudentDao { * @param student * @throws Exception */ - @Insert("insert into students(name, sex, sno, stu_class, phone, place, dorm_id, teacher) values(#{name},#{sex},#{sno},#{stu_class},#{phone},#{place},#{dorm_id},#{teacher})") + @Insert("insert into students(name, sex, sno, stu_class, phone, place, dorm_id, teacher, status) values(#{name},#{sex},#{sno},#{stu_class},#{phone},#{place},#{dorm_id},#{teacher},#{status})") void add(Student student) throws Exception; /** @@ -60,7 +60,7 @@ public interface StudentDao { * @param student * @throws Exception */ - @Update("update students set name = #{name},sex = #{sex},sno = #{sno},stu_class = #{stu_class},phone = #{phone},place = #{place},dorm_id = #{dorm_id},teacher = #{teacher} where id = #{id}") + @Update("update students set name = #{name},sex = #{sex},sno = #{sno},stu_class = #{stu_class},phone = #{phone},place = #{place},dorm_id = #{dorm_id},teacher = #{teacher},status = #{status} where id = #{id}") void update(Student student) throws Exception; diff --git a/src/main/java/cn/ppdxzz/domain/Student.java b/src/main/java/cn/ppdxzz/domain/Student.java index 3310613..aa7464f 100644 --- a/src/main/java/cn/ppdxzz/domain/Student.java +++ b/src/main/java/cn/ppdxzz/domain/Student.java @@ -18,11 +18,12 @@ public class Student implements Serializable { private String place;//家庭住址 private String dorm_id;//宿舍号 private String teacher;//育人导师 + private Integer status;//学生状态是否激活:1 激活 0 禁用 public Student() { } - public Student(Integer id, String name, String sex, String sno, String stu_class, String phone, String place, String dorm_id, String teacher) { + public Student(Integer id, String name, String sex, String sno, String stu_class, String phone, String place, String dorm_id, String teacher, Integer status) { this.id = id; this.name = name; this.sex = sex; @@ -32,6 +33,7 @@ public class Student implements Serializable { this.place = place; this.dorm_id = dorm_id; this.teacher = teacher; + this.status = status; } public Integer getId() { @@ -106,6 +108,14 @@ public class Student implements Serializable { this.teacher = teacher; } + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + @Override public String toString() { return "Student{" + @@ -118,6 +128,7 @@ public class Student implements Serializable { ", place='" + place + '\'' + ", dorm_id='" + dorm_id + '\'' + ", teacher='" + teacher + '\'' + + ", status=" + status + '}'; } } diff --git a/src/main/java/cn/ppdxzz/service/impl/StudentServiceImpl.java b/src/main/java/cn/ppdxzz/service/impl/StudentServiceImpl.java index 013c56a..5925cca 100644 --- a/src/main/java/cn/ppdxzz/service/impl/StudentServiceImpl.java +++ b/src/main/java/cn/ppdxzz/service/impl/StudentServiceImpl.java @@ -69,7 +69,7 @@ public class StudentServiceImpl implements StudentService { public boolean add(Student student) throws Exception { if (student == null || student.getName() == null || student.getSex() == null || student.getSno() == null || student.getPhone() == null || student.getPlace() == null || student.getDorm_id() == null - || student.getTeacher() == null || student.getStu_class() == null) { + || student.getTeacher() == null || student.getStu_class() == null || student.getStatus() == null) { return false; } studentDao.add(student); @@ -104,11 +104,11 @@ public class StudentServiceImpl implements StudentService { @Override public InputStream getInputStream() throws Exception { //Excel中的每列列名,依次对应数据库的字段 - String[] title = new String[]{"姓名","性别","学号","班级","联系方式","家庭住址","宿舍号","育人导师"}; + String[] title = new String[]{"姓名","性别","学号","班级","联系方式","家庭住址","宿舍号","育人导师","状态"}; List students = studentDao.findAll(); List datalist = new ArrayList<>(); for (int i = 0; i < students.size(); i++) { - Object[] obj = new Object[8]; + Object[] obj = new Object[9]; obj[0] = students.get(i).getName(); obj[1] = students.get(i).getSex(); obj[2] = students.get(i).getSno(); @@ -117,6 +117,7 @@ public class StudentServiceImpl implements StudentService { obj[5] = students.get(i).getPlace(); obj[6] = students.get(i).getDorm_id(); obj[7] = students.get(i).getTeacher(); + obj[8] = students.get(i).getStatus(); datalist.add(obj); } WriteExcel excel = new WriteExcel(title,datalist); diff --git a/src/main/webapp/WEB-INF/jsp/student-add.jsp b/src/main/webapp/WEB-INF/jsp/student-add.jsp index 3b15c17..23d0e0b 100644 --- a/src/main/webapp/WEB-INF/jsp/student-add.jsp +++ b/src/main/webapp/WEB-INF/jsp/student-add.jsp @@ -79,7 +79,7 @@ 育人导师 - + 小李 小王 @@ -88,10 +88,17 @@ 小张 + 状态 + + + 禁用 + 激活 + + - 确认修改 + 确认添加 返回列表 @@ -123,6 +130,7 @@ var place = $("#place").val().trim(); var dorm3 = $("#dorm3").val().trim(); var teacher = $("#teacher").val().trim(); + var status = $("#status").val().trim(); if (name == 0 || sex == 0 || sno == 0 || stu_class == 0 || phone == 0 || place == 0 || dorm3 == 0 || teacher == 0) { layer.msg('字段不能为空'); @@ -148,7 +156,8 @@ phone: phone, place: place, dorm_id:dorm_id, - teacher:teacher + teacher:teacher, + status:status }, type: "POST", //请求方式为POST dataType: "json", diff --git a/src/main/webapp/WEB-INF/jsp/student-edit.jsp b/src/main/webapp/WEB-INF/jsp/student-edit.jsp index 76fdad8..cb51746 100644 --- a/src/main/webapp/WEB-INF/jsp/student-edit.jsp +++ b/src/main/webapp/WEB-INF/jsp/student-edit.jsp @@ -99,6 +99,24 @@ + + 状态 + + + + 禁用 + 激活 + + + + + 禁用 + 激活 + + + + + 确认修改 @@ -119,6 +137,7 @@ var place = $("#place").val().trim(); var dorm_id = $("#dorm_id").val().trim(); var teacher = $("#teacher").val().trim(); + var status = $("#status").val().trim(); if (name == 0 || sex == 0 || sno == 0 || stu_class == 0 || phone == 0 || place == 0 || dorm_id == 0 || teacher == 0) { layer.msg('字段不能为空'); return false; @@ -143,7 +162,8 @@ phone: phone, place: place, dorm_id:dorm_id, - teacher:teacher + teacher:teacher, + status:status }, type: "POST", //请求方式为POST dataType: "json", diff --git a/src/main/webapp/WEB-INF/jsp/student-list.jsp b/src/main/webapp/WEB-INF/jsp/student-list.jsp index c7e2d48..76762aa 100644 --- a/src/main/webapp/WEB-INF/jsp/student-list.jsp +++ b/src/main/webapp/WEB-INF/jsp/student-list.jsp @@ -85,9 +85,9 @@ 学号 班级 联系方式 - 家庭住址 宿舍号 育人导师 + 状态 操作 @@ -104,9 +104,14 @@ ${student.sno} ${student.stu_class} ${student.phone} - ${student.place} ${student.dorm_id} ${student.teacher} + + 已激活 + + + 禁用 + diff --git a/target/classes/cn/ppdxzz/dao/StudentDao.class b/target/classes/cn/ppdxzz/dao/StudentDao.class index 58ee832..a0e09cf 100644 Binary files a/target/classes/cn/ppdxzz/dao/StudentDao.class and b/target/classes/cn/ppdxzz/dao/StudentDao.class differ diff --git a/target/classes/cn/ppdxzz/domain/Student.class b/target/classes/cn/ppdxzz/domain/Student.class index be0d268..29f622b 100644 Binary files a/target/classes/cn/ppdxzz/domain/Student.class and b/target/classes/cn/ppdxzz/domain/Student.class differ diff --git a/target/classes/cn/ppdxzz/service/impl/StudentServiceImpl.class b/target/classes/cn/ppdxzz/service/impl/StudentServiceImpl.class index 576a792..da7183c 100644 Binary files a/target/classes/cn/ppdxzz/service/impl/StudentServiceImpl.class and b/target/classes/cn/ppdxzz/service/impl/StudentServiceImpl.class differ diff --git a/target/hellossm/WEB-INF/classes/cn/ppdxzz/dao/StudentDao.class b/target/hellossm/WEB-INF/classes/cn/ppdxzz/dao/StudentDao.class index 58ee832..a0e09cf 100644 Binary files a/target/hellossm/WEB-INF/classes/cn/ppdxzz/dao/StudentDao.class and b/target/hellossm/WEB-INF/classes/cn/ppdxzz/dao/StudentDao.class differ diff --git a/target/hellossm/WEB-INF/classes/cn/ppdxzz/domain/Student.class b/target/hellossm/WEB-INF/classes/cn/ppdxzz/domain/Student.class index be0d268..29f622b 100644 Binary files a/target/hellossm/WEB-INF/classes/cn/ppdxzz/domain/Student.class and b/target/hellossm/WEB-INF/classes/cn/ppdxzz/domain/Student.class differ diff --git a/target/hellossm/WEB-INF/classes/cn/ppdxzz/service/impl/StudentServiceImpl.class b/target/hellossm/WEB-INF/classes/cn/ppdxzz/service/impl/StudentServiceImpl.class index 576a792..da7183c 100644 Binary files a/target/hellossm/WEB-INF/classes/cn/ppdxzz/service/impl/StudentServiceImpl.class and b/target/hellossm/WEB-INF/classes/cn/ppdxzz/service/impl/StudentServiceImpl.class differ diff --git a/target/hellossm/WEB-INF/jsp/student-add.jsp b/target/hellossm/WEB-INF/jsp/student-add.jsp index 3b15c17..23d0e0b 100644 --- a/target/hellossm/WEB-INF/jsp/student-add.jsp +++ b/target/hellossm/WEB-INF/jsp/student-add.jsp @@ -79,7 +79,7 @@ 育人导师 - + 小李 小王 @@ -88,10 +88,17 @@ 小张 + 状态 + + + 禁用 + 激活 + + - 确认修改 + 确认添加 返回列表 @@ -123,6 +130,7 @@ var place = $("#place").val().trim(); var dorm3 = $("#dorm3").val().trim(); var teacher = $("#teacher").val().trim(); + var status = $("#status").val().trim(); if (name == 0 || sex == 0 || sno == 0 || stu_class == 0 || phone == 0 || place == 0 || dorm3 == 0 || teacher == 0) { layer.msg('字段不能为空'); @@ -148,7 +156,8 @@ phone: phone, place: place, dorm_id:dorm_id, - teacher:teacher + teacher:teacher, + status:status }, type: "POST", //请求方式为POST dataType: "json", diff --git a/target/hellossm/WEB-INF/jsp/student-edit.jsp b/target/hellossm/WEB-INF/jsp/student-edit.jsp index 76fdad8..cb51746 100644 --- a/target/hellossm/WEB-INF/jsp/student-edit.jsp +++ b/target/hellossm/WEB-INF/jsp/student-edit.jsp @@ -99,6 +99,24 @@ + + 状态 + + + + 禁用 + 激活 + + + + + 禁用 + 激活 + + + + + 确认修改 @@ -119,6 +137,7 @@ var place = $("#place").val().trim(); var dorm_id = $("#dorm_id").val().trim(); var teacher = $("#teacher").val().trim(); + var status = $("#status").val().trim(); if (name == 0 || sex == 0 || sno == 0 || stu_class == 0 || phone == 0 || place == 0 || dorm_id == 0 || teacher == 0) { layer.msg('字段不能为空'); return false; @@ -143,7 +162,8 @@ phone: phone, place: place, dorm_id:dorm_id, - teacher:teacher + teacher:teacher, + status:status }, type: "POST", //请求方式为POST dataType: "json", diff --git a/target/hellossm/WEB-INF/jsp/student-list.jsp b/target/hellossm/WEB-INF/jsp/student-list.jsp index c7e2d48..76762aa 100644 --- a/target/hellossm/WEB-INF/jsp/student-list.jsp +++ b/target/hellossm/WEB-INF/jsp/student-list.jsp @@ -85,9 +85,9 @@ 学号 班级 联系方式 - 家庭住址 宿舍号 育人导师 + 状态 操作 @@ -104,9 +104,14 @@ ${student.sno} ${student.stu_class} ${student.phone} - ${student.place} ${student.dorm_id} ${student.teacher} + + 已激活 + + + 禁用 + diff --git a/target/hellossm/WEB-INF/jsp/visitor-success.jsp b/target/hellossm/WEB-INF/jsp/visitor-success.jsp index 9b62776..444af60 100644 --- a/target/hellossm/WEB-INF/jsp/visitor-success.jsp +++ b/target/hellossm/WEB-INF/jsp/visitor-success.jsp @@ -8,11 +8,11 @@ <%@ page contentType="text/html;charset=UTF-8" language="java" %> - Title + 登记成功 -恭喜您,来访登记成功! +恭喜您,来访登记成功! 注销登记