2020.2.19 修改学生模块功能,新增一个状态属性,用以区分学生是否毕业

main
ppdxzz 5 years ago
parent cf809c9525
commit ce94ca27b4

@ -7,29 +7,16 @@
</component>
<component name="ChangeListManager">
<list default="true" id="8033210d-c341-4f39-a328-95fe94016f00" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/jsLibraryMappings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/jsLibraryMappings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/controller/AdminController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/controller/AdminController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/controller/VisitorController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/controller/VisitorController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/admin-add.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/admin-add.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/admin-edit.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/admin-edit.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/admin-list.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/admin-list.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/main.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/main.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/regist_visitor.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/regist_visitor.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/dao/StudentDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/dao/StudentDao.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/domain/Student.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/domain/Student.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/service/impl/StudentServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/cn/ppdxzz/service/impl/StudentServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/student-add.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/student-add.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/student-edit.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/student-edit.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/student-list.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/student-list.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/visitor-list.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/visitor-list.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/visitor-success.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/jsp/visitor-success.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/cn/ppdxzz/controller/AdminController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/cn/ppdxzz/controller/AdminController.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/cn/ppdxzz/utils/LocalIp.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/classes/cn/ppdxzz/controller/AdminController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/classes/cn/ppdxzz/controller/AdminController.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/admin-add.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/admin-add.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/admin-edit.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/admin-edit.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/admin-list.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/admin-list.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/main.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/main.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/student-add.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/student-add.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/student-list.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/student-list.jsp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-cli/inputFiles.lst" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/visitor-success.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/target/hellossm/WEB-INF/jsp/visitor-success.jsp" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -243,11 +230,6 @@
<item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
<item name="Tomcat Server" type="7427dc5b:ServiceModel$ServiceGroupNode" />
</path>
<path>
<item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
<item name="Tomcat Server" type="7427dc5b:ServiceModel$ServiceGroupNode" />
<item name="Finished" type="7427dc5b:ServiceModel$ServiceGroupNode" />
</path>
</expand>
<select />
</treeState>
@ -289,7 +271,7 @@
<workItem from="1582001026668" duration="32026000" />
<workItem from="1582077952665" duration="5952000" />
<workItem from="1582093960673" duration="5496000" />
<workItem from="1582099866858" duration="2360000" />
<workItem from="1582099866858" duration="5125000" />
</task>
<servers />
</component>
@ -309,10 +291,10 @@
<screen x="0" y="0" width="1366" height="728" />
</state>
<state x="137" y="23" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.1366.728@0.0.1366.728" timestamp="1581485477637" />
<state x="488" y="84" key="#com.intellij.ide.util.MemberChooser" timestamp="1582031252663">
<state x="488" y="84" key="#com.intellij.ide.util.MemberChooser" timestamp="1582102994586">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state x="488" y="84" key="#com.intellij.ide.util.MemberChooser/0.0.1366.728@0.0.1366.728" timestamp="1582031252663" />
<state x="488" y="84" key="#com.intellij.ide.util.MemberChooser/0.0.1366.728@0.0.1366.728" timestamp="1582102994586" />
<state x="435" y="110" key="FileChooserDialogImpl" timestamp="1582098741224">
<screen x="0" y="0" width="1366" height="728" />
</state>

@ -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;

@ -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 +
'}';
}
}

@ -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<Student> students = studentDao.findAll();
List<Object[]> 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);

@ -79,7 +79,7 @@
</tr>
<tr>
<td><label for="teacher">育人导师</label></td>
<td colspan="3">
<td>
<select class="form-control" name="teacher" id="teacher">
<option value="小李" selected>小李</option>
<option value="小王">小王</option>
@ -88,10 +88,17 @@
<option value="小张">小张</option>
</select>
</td>
<td><label for="status">状态</label></td>
<td>
<select class="form-control" name="status" id="status">
<option value="0" selected>禁用</option>
<option value="1">激活</option>
</select>
</td>
</tr>
<tr>
<td colspan="4">
<button type="button" id="add-student" class="btn btn-primary">确认修改</button>
<button type="button" id="add-student" class="btn btn-primary">确认添加</button>
<a type="button" href="${pageContext.request.contextPath}/student/findAll" class="btn btn-default">返回列表</a>
</td>
</tr>
@ -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",

@ -99,6 +99,24 @@
</td>
</tr>
<tr>
<td><label for="status">状态</label></td>
<td>
<c:if test="${stu.status == 0}">
<select class="form-control" name="status" id="status">
<option value="0" selected>禁用</option>
<option value="1">激活</option>
</select>
</c:if>
<c:if test="${stu.status == 1}">
<select class="form-control" name="status" id="status">
<option value="0">禁用</option>
<option value="1" selected>激活</option>
</select>
</c:if>
</td>
</tr>
<tr>
<td colspan="4">
<button type="button" id="edit-btn" class="btn btn-primary">确认修改</button>
@ -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",

@ -85,9 +85,9 @@
<th style="text-align: center">学号</th>
<th style="text-align: center">班级</th>
<th style="text-align: center">联系方式</th>
<th style="text-align: center">家庭住址</th>
<th style="text-align: center">宿舍号</th>
<th style="text-align: center">育人导师</th>
<th style="text-align: center">状态</th>
<c:if test="${sessionScope.adminInfo.power > 1}">
<th style="text-align: center">操作</th>
</c:if>
@ -104,9 +104,14 @@
<td>${student.sno}</td>
<td>${student.stu_class}</td>
<td>${student.phone}</td>
<td>${student.place}</td>
<td>${student.dorm_id}</td>
<td>${student.teacher}</td>
<c:if test="${student.status == 1}">
<td><button class="layui-btn layui-btn-normal layui-btn-sm">已激活</button></td>
</c:if>
<c:if test="${student.status == 0}">
<td><button class="layui-btn layui-btn-danger layui-btn-sm">禁用</button></td>
</c:if>
<c:if test="${sessionScope.adminInfo.power > 1}">
<td class="td-manage">
<a title="编辑" href="${pageContext.request.contextPath}/student/editStudent?sno=${student.sno}">

@ -79,7 +79,7 @@
</tr>
<tr>
<td><label for="teacher">育人导师</label></td>
<td colspan="3">
<td>
<select class="form-control" name="teacher" id="teacher">
<option value="小李" selected>小李</option>
<option value="小王">小王</option>
@ -88,10 +88,17 @@
<option value="小张">小张</option>
</select>
</td>
<td><label for="status">状态</label></td>
<td>
<select class="form-control" name="status" id="status">
<option value="0" selected>禁用</option>
<option value="1">激活</option>
</select>
</td>
</tr>
<tr>
<td colspan="4">
<button type="button" id="add-student" class="btn btn-primary">确认修改</button>
<button type="button" id="add-student" class="btn btn-primary">确认添加</button>
<a type="button" href="${pageContext.request.contextPath}/student/findAll" class="btn btn-default">返回列表</a>
</td>
</tr>
@ -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",

@ -99,6 +99,24 @@
</td>
</tr>
<tr>
<td><label for="status">状态</label></td>
<td>
<c:if test="${stu.status == 0}">
<select class="form-control" name="status" id="status">
<option value="0" selected>禁用</option>
<option value="1">激活</option>
</select>
</c:if>
<c:if test="${stu.status == 1}">
<select class="form-control" name="status" id="status">
<option value="0">禁用</option>
<option value="1" selected>激活</option>
</select>
</c:if>
</td>
</tr>
<tr>
<td colspan="4">
<button type="button" id="edit-btn" class="btn btn-primary">确认修改</button>
@ -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",

@ -85,9 +85,9 @@
<th style="text-align: center">学号</th>
<th style="text-align: center">班级</th>
<th style="text-align: center">联系方式</th>
<th style="text-align: center">家庭住址</th>
<th style="text-align: center">宿舍号</th>
<th style="text-align: center">育人导师</th>
<th style="text-align: center">状态</th>
<c:if test="${sessionScope.adminInfo.power > 1}">
<th style="text-align: center">操作</th>
</c:if>
@ -104,9 +104,14 @@
<td>${student.sno}</td>
<td>${student.stu_class}</td>
<td>${student.phone}</td>
<td>${student.place}</td>
<td>${student.dorm_id}</td>
<td>${student.teacher}</td>
<c:if test="${student.status == 1}">
<td><button class="layui-btn layui-btn-normal layui-btn-sm">已激活</button></td>
</c:if>
<c:if test="${student.status == 0}">
<td><button class="layui-btn layui-btn-danger layui-btn-sm">禁用</button></td>
</c:if>
<c:if test="${sessionScope.adminInfo.power > 1}">
<td class="td-manage">
<a title="编辑" href="${pageContext.request.contextPath}/student/editStudent?sno=${student.sno}">

@ -8,11 +8,11 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<title>登记成功</title>
</head>
<body>
<h3>恭喜您,来访登记成功!</h3>
<h4 style="text-align: center;">恭喜您,来访登记成功!</h4>
<br>
<a href="${pageContext.request.contextPath}/visitor/login_out?id=${id}">注销登记</a>
</body>

Loading…
Cancel
Save