赞
踩
1效果图
显示学生成绩可以完成三个显示并且是分页显示,分别是查看全部学生成绩,查看总成绩合格学生成绩,查看不合格学生总成绩。另外学生的总成绩可以根据以小到大的顺序或者相反排序。
分页采用了 mybatis-plus 的分页插件 表单页面采用了 element-plus 表单组件
- <div class="manage">
- <h1>学生成绩管理系统(教师端)</h1>
- <div align="left" style="margin: 10px 0">
- <el-input v-model="search" placeholder=" 请 输 入 关 键 字 " style="width: 30%"></el-input>
- <el-button style="margin-left: 10px" type="primary" @click="list">查询</el-button>
- <el-button style="margin-left: 10px" type="primary" @click="add">新增学生</el-button>
- <el-button style="margin-left: 10px" type="primary" @click="all">全部学生</el-button>
- <el-button style="margin-left: 10px" type="primary" v-model="choose" @click="qualified">合格学生</el-button>
- <el-button style="margin-left: 10px" type="primary" v-model="choose" @click="unqualified">挂科学生</el-button>
- </div>
- <el-table :data="tableData" stripe style="width: 90%">
- <el-table-column prop="username" label="学号"></el-table-column>
- <el-table-column prop="name" label="姓名"></el-table-column>
- <el-table-column prop="midscore" label="期中成绩(40%)"></el-table-column>
- <el-table-column prop="finalscore" label="期末成绩(40%)"></el-table-column>
- <el-table-column prop="dailyscore" label="平时成绩(20%)"></el-table-column>
- <el-table-column sortable prop="totalscore" label="最终成绩"></el-table-column>
- <el-table-column>
- <template #default="scope">
- <el-button v-model="choose1" @click="handleEdit(scope.row.username)" type="text">编辑</el-button>
- <el-popconfirm title="确认删除吗?" @confirm="handleDelete(scope.row.username)">
- <template #reference>
- <el-button size="small" type="danger">删除</el-button>
- </template>
- </el-popconfirm>
- </template>
- </el-table-column>
- </el-table>
- <el-dialog title="提示" v-model="dialogVisible" width="30%">
- <el-form :model="form" label-width="120px" :rules="rules" ref="form">
- <el-form-item label="学号" prop="username">
- <el-input v-model="form.username" style="width: 80%"></el-input>
- {{ this.validMsg.username }}
- </el-form-item>
- <el-form-item label="姓名" prop="name">
- <el-input v-model="form.name" style="width: 80%"></el-input>
- {{ this.validMsg.name }}
- </el-form-item>
- <el-form-item label="期中成绩(40%)" prop="midscore">
- <el-input v-model="form.midscore" style="width: 80%"></el-input>
- {{ this.validMsg.midscore }}
- </el-form-item>
- <el-form-item label="期末成绩(40%)" prop="finalscore">
- <el-input v-model="form.finalscore" style="width: 80%"></el-input>
- {{ this.validMsg.finalscore }}
- </el-form-item>
- <el-form-item label="平时成绩(20%)" prop="dailyscore">
- <el-input v-model="form.dailyscore" style="width: 80%"></el-input>
- {{ this.validMsg.dailyscore }}
- </el-form-item>
- </el-form>
- <template #footer><span class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button
- type="primary" @click="save()">确 定</el-button> </span>
- </template>
- </el-dialog>
- <!--添加分页导航-->
- <div style="margin: 10px 0">
- <el-pagination
- @size-change="handlePageSizeChange"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-sizes="[3,5,10]"
- :page-size="pageSize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>
- </div>
- //全部成绩请求
- @GetMapping(value = "/gradeByConditionPage")
- public Result listGradeByConditionPage(@RequestParam(defaultValue = "1") Integer pageNum,
- @RequestParam(defaultValue = "5") Integer pageSize,
- @RequestParam(defaultValue = "") String search) {
- LambdaQueryWrapper<Grade> queryWrapper = Wrappers.lambdaQuery();
- if (StringUtils.hasText(search)) {
- queryWrapper.like(Grade:: getName, search);
- }
- Page<Grade> page = gradeService.page(new Page<>(pageNum, pageSize), queryWrapper);
- return Result.success(page);
- }
-
-
- //不合格成绩请求
- @GetMapping(value = "/unqualified")
- public Result selectGradeUnqualified(@RequestParam(defaultValue = "1") Integer pageNum,
- @RequestParam(defaultValue = "5") Integer pageSize) {
- LambdaQueryWrapper<Grade> queryWrapper = Wrappers.lambdaQuery();
- queryWrapper.lt(Grade::getTotalscore, 60);
- Page<Grade> page = gradeService.page(new Page<>(pageNum, pageSize), queryWrapper);
- return Result.success(page);
- }
- //合格成绩请求
- @GetMapping(value = "/qualified")
- public Result selectGradeQualified(@RequestParam(defaultValue = "1") Integer pageNum,
- @RequestParam(defaultValue = "5") Integer pageSize) {
- LambdaQueryWrapper<Grade> queryWrapper = Wrappers.lambdaQuery();
- queryWrapper.ge(Grade::getTotalscore, 60);
- Page<Grade> page = gradeService.page(new Page<>(pageNum, pageSize), queryWrapper);
- return Result.success(page);
- }
教师端的学生成绩显示功能分为三种情况,合格,不合格,全部,依次对应三种请求,接受三种返回数据并且完美显示到界面,后端有着 装配分页插件,使用了lambda表达式,按照条件查询数据。以上就是学生成绩显示功能,添加,删除功能后续发布,敬请期待,有缺漏的地方欢迎指正
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。