- "1.0" encoding="UTF-8"?>
- <project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0modelVersion>
-
- <groupId>org.examplegroupId>
- <artifactId>studentSystemWorkartifactId>
- <version>1.0-SNAPSHOTversion>
-
- <properties>
- <maven.compiler.source>8maven.compiler.source>
- <maven.compiler.target>8maven.compiler.target>
- properties>
-
- <dependencies>
- <dependency>
- <groupId>org.projectlombokgroupId>
- <artifactId>lombokartifactId>
- <version>1.18.16version>
- dependency>
- <dependency>
- <groupId>org.mybatisgroupId>
- <artifactId>mybatisartifactId>
- <version>3.5.1version>
- dependency>
- <dependency>
- <groupId>mysqlgroupId>
- <artifactId>mysql-connector-javaartifactId>
- <version>8.0.25version>
- <scope>runtimescope>
- dependency>
- <dependency>
- <groupId>junitgroupId>
- <artifactId>junitartifactId>
- <version>4.12version>
- <scope>testscope>
- dependency>
-
- <dependency>
- <groupId>javax.servletgroupId>
- <artifactId>javax.servlet-apiartifactId>
- <version>3.1.0version>
- dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.coregroupId>
- <artifactId>jackson-coreartifactId>
- <version>2.7.3version>
- dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.coregroupId>
- <artifactId>jackson-databindartifactId>
- <version>2.7.3version>
- dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.coregroupId>
- <artifactId>jackson-annotationsartifactId>
- <version>2.7.3version>
- dependency>
-
- <dependency>
- <groupId>commons-langgroupId>
- <artifactId>commons-langartifactId>
- <version>2.6version>
- dependency>
- <dependency>
- <groupId>org.apache.commonsgroupId>
- <artifactId>commons-lang3artifactId>
- <version>3.4version>
- dependency>
- <dependency>
- <groupId>junitgroupId>
- <artifactId>junitartifactId>
- <version>4.13version>
- <scope>testscope>
- dependency>
-
- <dependency>
- <groupId>commons-beanutilsgroupId>
- <artifactId>commons-beanutilsartifactId>
- <version>1.8.3version>
- dependency>
-
- <dependency>
- <groupId>commons-logginggroupId>
- <artifactId>commons-loggingartifactId>
- <version>1.1.1version>
- dependency>
-
- <dependency>
- <groupId>commons-dbutilsgroupId>
- <artifactId>commons-dbutilsartifactId>
- <version>1.6version>
- dependency>
-
- <dependency>
- <groupId>log4jgroupId>
- <artifactId>log4jartifactId>
- <version>1.2.17version>
- dependency>
-
- <dependency>
- <groupId>com.mchangegroupId>
- <artifactId>c3p0artifactId>
- <version>0.9.5version>
- dependency>
-
- <dependency>
- <groupId>com.github.pagehelpergroupId>
- <artifactId>pagehelperartifactId>
- <version>5.1.10version>
- dependency>
- dependencies>
-
- project>
- html>
- <html>
-
- <head>
- <title>title>
- <meta charset="UTF-8">
- <link rel="stylesheet" href="element-ui-2.13.0/lib/theme-chalk/index.css" />
- <script type="text/javascript" src="vue/vue-v2.6.10.js">script>
- <script type="text/javascript" src="element-ui-2.13.0/lib/index.js">script>
- <script type="text/javascript" src="vue/axios-0.18.0.js">script>
- head>
-
- <body>
- <div id="app">
- <template>
- <el-table :data="tableData" @selection-change="handleSelectionChange" size="medium"
- highlight-current-row="true" style="width: 100%">
- <el-table-column type="selection" width="55" prop="sid">
- el-table-column>
- <el-table-column width="100px" label="序号" type="index">
- el-table-column>
- <el-table-column label="姓名" prop="sname">
- el-table-column>
- <el-table-column label="性别" prop="gender">
- el-table-column>
- <el-table-column label="班级" prop="tbClass.caption">
- el-table-column>
- <el-table-column>
- <template slot="header" slot-scope="scope">
- <el-input v-model="search" size="mini" placeholder="请输入姓名" />
- template>
- el-table-column>
-
- <el-table-column>
- <template slot="header" slot-scope="scope">
- <el-radio v-model="sex" label="男">男el-radio>
- <el-radio v-model="sex" label="女">女el-radio>
- template>
- el-table-column>
- <el-table-column>
- <template slot="header" slot-scope="scope">
- <el-button type="success" @click="findAll()">搜索el-button>
- template>
- <template slot-scope="scope">
- <el-button size="mini" @click="handleLook(scope.$index, scope.row)">查看课程信息el-button>
- template>
- el-table-column>
- el-table>
- template>
- <br />
- <el-row>
- <el-button type="warning" @click="delAll()">删除选中el-button>
- el-row>
- <template>
- <div class="block" align="right">
- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
- :current-page="currentPage" :page-sizes="[3, 4, 5, 6]" :page-size="pageSize"
- layout="total, sizes, prev, pager, next, jumper" :total="totalCount">
- el-pagination>
- div>
- template>
-
-
- <el-dialog title="查看课程信息" :visible.sync="dialogFormVisible">
- <el-form ref="ruleForm" :model="ruleForm" label-width="80px">
- <el-form-item label="学生姓名">
- <el-input v-model="ruleForm.sname" style="width: 210px;" readonly>el-input>
- el-form-item>
- el-form>
- <el-table :data="tableCourse" @selection-change="handleSelectionChange" size="medium"
- highlight-current-row="true" style="width: 100%">
- <el-table-column width="100px" label="序号" type="index">
- el-table-column>
- <el-table-column label="课程" prop="courses[0].cname">
- el-table-column>
- <el-table-column label="成绩" prop="num">
- el-table-column>
- <el-table-column label="老师" prop="courses[0].teacher.tname">
- el-table-column>
- el-table>
- el-dialog>
- div>
- body>
- <script>
- axios.defaults.withCredentials = true
- new Vue({
- el: "#app",
- data: {
- /*表格数据*/
- tableData: [],
- tableCourse: [],
- /*条件查询关键字*/
- search: '',
- sex: "",
- //批量删除存放选中的复选框
- multipleSelection: [],
- //存放删除的数据
- delarr: [],
- //当前页
- currentPage: 1,
- //每页显示条数
- pageSize: 3,
- //总条数
- totalCount: '',
- //总页数
- totalPage: '',
- // 是否展示课程信息对话框
- dialogFormVisible: false,
- ruleForm: {
- sid: '',
- sname: '',
- gender: '',
- tbClass: '',
- class_id: '',
- },
- },
- methods: {
-
- findAll() {
- let param = new URLSearchParams();
- param.append("type", "showStuByPage");
- param.append("page", this.currentPage);
- param.append("rows", this.pageSize);
- param.append("sname", this.search);
- param.append("gender", this.sex);
- axios({
- method: "post",
- url: "http://localhost:8080/studentSystemWork_war_exploded/studentServlet",
- data: param
- }).then(obj => {
- this.tableData = obj.data.list;
- this.totalCount = obj.data.total;
- });
- },
-
- handleSizeChange: function (size) {
- this.pageSize = size;
- this.findAll();
- },
-
- handleCurrentChange: function (currentPage) {
- this.currentPage = currentPage;
- this.findAll();
- },
-
- delAll() {
- //获取删除的ID
- this.delarr = [];
- for (let i = 0; i < this.multipleSelection.length; i++) {
- this.delarr.push(this.multipleSelection[i].sid);
- }
- //判断要删除的文件是否为空
- if (this.delarr.length == 0) {
- this.$message.warning("请选择要删除的数据!")
- } else {
- this.$confirm("是否确认删除?", "提示", { type: 'warning' }).then(() => {
- //点击确认删除
- let param = new URLSearchParams();
- param.append("sids", this.delarr.join())
- param.append("type", "deleteStudents")
- axios({
- method: "post",
- url: "http://localhost:8080/studentSystemWork_war_exploded/studentServlet",
- data: param
- }).then(obj => {
- if (obj.data) {
- this.$message.success("删除成功!");
- setTimeout(function () {
- window.location.href = "index.html"
- }, 1500)
- } else {
- this.$message.error("删除失败!")
- }
- });
- });
- }
- },
-
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
-
- handleLook(index, row) {
- this.dialogFormVisible = true;
- this.ruleForm = row;
- let param = new URLSearchParams();
- param.append("type","getStudentCourseById")
- param.append("sid",row.sid);
- axios({
- method: "post",
- url: "http://localhost:8080/studentSystemWork_war_exploded/scoreServlet",
- data: param
- }).then(obj => {
- this.tableCourse = obj.data;
- });
- },
-
- },
-
- created() {
- this.findAll();
- }
-
- })
- script>
-
- html>
- package com.etime.dao;
-
- import com.etime.pojo.Student;
- import com.etime.pojo.TbClass;
- import org.apache.ibatis.annotations.*;
-
- import java.util.List;
-
- public interface StudentDao {
- @Select({""})
- int getCountStudent(Student student);
-
- @Select({""})
- @Results({
- @Result(property = "sid",column = "sid"),
- @Result(property = "gender",column = "gender"),
- @Result(property = "class_id",column = "class_id"),
- @Result(property = "sname",column = "sname"),
- @Result(property = "tbClass",column = "class_id",javaType = TbClass.class,
- one = @One(select = "com.etime.dao.TbClassDao.getClassByCid"))
- })
- List
showStuByPage(Student student); -
- @Delete({""})
- int deleteStudents(List
list) ; - }




具体完整代码看资源
