增加了论文首页(郑瑜甜)

pull/1136/head
15892072232 2025-10-30 09:38:50 +08:00
parent fd4f0ef3ae
commit 260abd286f
16 changed files with 1642 additions and 0 deletions

3
.vscode/settings.json vendored 100644
View File

@ -0,0 +1,3 @@
{
"java.compile.nullAnalysis.mode": "automatic"
}

View File

@ -0,0 +1,4 @@
@echo off
mysql -u root -p123456 ry-vue --default-character-set=utf8mb4 -e "source sql/student.sql"
echo SQL execution completed.
pause

View File

@ -0,0 +1,104 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysStudent;
import com.ruoyi.system.service.ISysStudentService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2023-06-01
*/
@RestController
@RequestMapping("/system/student")
public class SysStudentController extends BaseController
{
@Autowired
private ISysStudentService sysStudentService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:student:list')")
@GetMapping("/list")
public TableDataInfo list(SysStudent sysStudent)
{
startPage();
List<SysStudent> list = sysStudentService.selectSysStudentList(sysStudent);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:student:export')")
@Log(title = "学生信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysStudent sysStudent)
{
List<SysStudent> list = sysStudentService.selectSysStudentList(sysStudent);
ExcelUtil<SysStudent> util = new ExcelUtil<SysStudent>(SysStudent.class);
util.exportExcel(response, list, "学生信息数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:student:query')")
@GetMapping(value = "/{studentId}")
public AjaxResult getInfo(@PathVariable("studentId") Long studentId)
{
return AjaxResult.success(sysStudentService.selectSysStudentByStudentId(studentId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:student:add')")
@Log(title = "学生信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysStudent sysStudent)
{
return toAjax(sysStudentService.insertSysStudent(sysStudent));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:student:edit')")
@Log(title = "学生信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysStudent sysStudent)
{
return toAjax(sysStudentService.updateSysStudent(sysStudent));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:student:remove')")
@Log(title = "学生信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{studentIds}")
public AjaxResult remove(@PathVariable Long[] studentIds)
{
return toAjax(sysStudentService.deleteSysStudentByStudentIds(studentIds));
}
}

View File

@ -0,0 +1,125 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* sys_student
*
* @author ruoyi
* @date 2023-06-01
*/
public class SysStudent extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 学生ID */
private Long studentId;
/** 学生姓名 */
@Excel(name = "学生姓名")
private String studentName;
/** 头像地址 */
@Excel(name = "头像地址")
private String avatar;
/** 个人介绍 */
@Excel(name = "个人介绍")
private String introduction;
/** 性别0男 1女 */
@Excel(name = "性别", readConverterExp = "0=男,1=女")
private String gender;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public void setStudentId(Long studentId)
{
this.studentId = studentId;
}
public Long getStudentId()
{
return studentId;
}
public void setStudentName(String studentName)
{
this.studentName = studentName;
}
public String getStudentName()
{
return studentName;
}
public void setAvatar(String avatar)
{
this.avatar = avatar;
}
public String getAvatar()
{
return avatar;
}
public void setIntroduction(String introduction)
{
this.introduction = introduction;
}
public String getIntroduction()
{
return introduction;
}
public void setGender(String gender)
{
this.gender = gender;
}
public String getGender()
{
return gender;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("studentId", getStudentId())
.append("studentName", getStudentName())
.append("avatar", getAvatar())
.append("introduction", getIntroduction())
.append("gender", getGender())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysStudent;
/**
* Mapper
*
* @author ruoyi
* @date 2023-06-01
*/
public interface SysStudentMapper
{
/**
*
*
* @param studentId
* @return
*/
public SysStudent selectSysStudentByStudentId(Long studentId);
/**
*
*
* @param sysStudent
* @return
*/
public List<SysStudent> selectSysStudentList(SysStudent sysStudent);
/**
*
*
* @param sysStudent
* @return
*/
public int insertSysStudent(SysStudent sysStudent);
/**
*
*
* @param sysStudent
* @return
*/
public int updateSysStudent(SysStudent sysStudent);
/**
*
*
* @param studentId
* @return
*/
public int deleteSysStudentByStudentId(Long studentId);
/**
*
*
* @param studentIds
* @return
*/
public int deleteSysStudentByStudentIds(Long[] studentIds);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysStudent;
/**
* Service
*
* @author ruoyi
* @date 2023-06-01
*/
public interface ISysStudentService
{
/**
*
*
* @param studentId
* @return
*/
public SysStudent selectSysStudentByStudentId(Long studentId);
/**
*
*
* @param sysStudent
* @return
*/
public List<SysStudent> selectSysStudentList(SysStudent sysStudent);
/**
*
*
* @param sysStudent
* @return
*/
public int insertSysStudent(SysStudent sysStudent);
/**
*
*
* @param sysStudent
* @return
*/
public int updateSysStudent(SysStudent sysStudent);
/**
*
*
* @param studentIds
* @return
*/
public int deleteSysStudentByStudentIds(Long[] studentIds);
/**
*
*
* @param studentId
* @return
*/
public int deleteSysStudentByStudentId(Long studentId);
}

View File

@ -0,0 +1,96 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysStudentMapper;
import com.ruoyi.system.domain.SysStudent;
import com.ruoyi.system.service.ISysStudentService;
/**
* Service
*
* @author ruoyi
* @date 2023-06-01
*/
@Service
public class SysStudentServiceImpl implements ISysStudentService
{
@Autowired
private SysStudentMapper sysStudentMapper;
/**
*
*
* @param studentId
* @return
*/
@Override
public SysStudent selectSysStudentByStudentId(Long studentId)
{
return sysStudentMapper.selectSysStudentByStudentId(studentId);
}
/**
*
*
* @param sysStudent
* @return
*/
@Override
public List<SysStudent> selectSysStudentList(SysStudent sysStudent)
{
return sysStudentMapper.selectSysStudentList(sysStudent);
}
/**
*
*
* @param sysStudent
* @return
*/
@Override
public int insertSysStudent(SysStudent sysStudent)
{
sysStudent.setCreateTime(DateUtils.getNowDate());
return sysStudentMapper.insertSysStudent(sysStudent);
}
/**
*
*
* @param sysStudent
* @return
*/
@Override
public int updateSysStudent(SysStudent sysStudent)
{
sysStudent.setUpdateTime(DateUtils.getNowDate());
return sysStudentMapper.updateSysStudent(sysStudent);
}
/**
*
*
* @param studentIds
* @return
*/
@Override
public int deleteSysStudentByStudentIds(Long[] studentIds)
{
return sysStudentMapper.deleteSysStudentByStudentIds(studentIds);
}
/**
*
*
* @param studentId
* @return
*/
@Override
public int deleteSysStudentByStudentId(Long studentId)
{
return sysStudentMapper.deleteSysStudentByStudentId(studentId);
}
}

View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysStudentMapper">
<resultMap type="SysStudent" id="SysStudentResult">
<result property="studentId" column="student_id" />
<result property="studentName" column="student_name" />
<result property="avatar" column="avatar" />
<result property="introduction" column="student_introduction" />
<result property="gender" column="gender" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSysStudentVo">
select student_id, student_name, avatar, student_introduction, gender, status, del_flag, create_by, create_time, update_by, update_time, remark from sys_student
</sql>
<select id="selectSysStudentList" parameterType="SysStudent" resultMap="SysStudentResult">
<include refid="selectSysStudentVo"/>
<where>
<if test="studentName != null and studentName != ''"> and student_name like concat('%', #{studentName}, '%')</if>
<if test="gender != null and gender != ''"> and gender = #{gender}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
and del_flag = '0'
</where>
</select>
<select id="selectSysStudentByStudentId" parameterType="Long" resultMap="SysStudentResult">
<include refid="selectSysStudentVo"/>
where student_id = #{studentId}
</select>
<insert id="insertSysStudent" parameterType="SysStudent" useGeneratedKeys="true" keyProperty="studentId">
insert into sys_student
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="studentName != null and studentName != ''">student_name,</if>
<if test="avatar != null">avatar,</if>
<if test="introduction != null">student_introduction,</if>
<if test="gender != null">gender,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="studentName != null and studentName != ''">#{studentName},</if>
<if test="avatar != null">#{avatar},</if>
<if test="introduction != null">#{introduction},</if>
<if test="gender != null">#{gender},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSysStudent" parameterType="SysStudent">
update sys_student
<trim prefix="SET" suffixOverrides=",">
<if test="studentName != null and studentName != ''">student_name = #{studentName},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="introduction != null">student_introduction = #{introduction},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where student_id = #{studentId}
</update>
<delete id="deleteSysStudentByStudentId" parameterType="Long">
update sys_student set del_flag = '2' where student_id = #{studentId}
</delete>
<delete id="deleteSysStudentByStudentIds" parameterType="String">
update sys_student set del_flag = '2' where student_id in
<foreach item="studentId" collection="array" open="(" separator="," close=")">
#{studentId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询学生列表
export function listStudent(query) {
return request({
url: '/system/student/list',
method: 'get',
params: query
})
}
// 查询学生详细
export function getStudent(id) {
return request({
url: '/system/student/' + id,
method: 'get'
})
}
// 新增学生
export function addStudent(data) {
return request({
url: '/system/student',
method: 'post',
data: data
})
}
// 修改学生
export function updateStudent(data) {
return request({
url: '/system/student',
method: 'put',
data: data
})
}
// 删除学生
export function delStudent(id) {
return request({
url: '/system/student/' + id,
method: 'delete'
})
}
// 导出学生
export function exportStudent(query) {
return request({
url: '/system/student/export',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询学生信息列表
export function listInfo(query) {
return request({
url: '/system/info/list',
method: 'get',
params: query
})
}
// 查询学生信息详细
export function getInfo(studentId) {
return request({
url: '/system/info/' + studentId,
method: 'get'
})
}
// 新增学生信息
export function addInfo(data) {
return request({
url: '/system/info',
method: 'post',
data: data
})
}
// 修改学生信息
export function updateInfo(data) {
return request({
url: '/system/info',
method: 'put',
data: data
})
}
// 删除学生信息
export function delInfo(studentId) {
return request({
url: '/system/info/' + studentId,
method: 'delete'
})
}

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询学生信息列表
export function listStudent(query) {
return request({
url: '/system/student/list',
method: 'get',
params: query
})
}
// 查询学生信息详细
export function getStudent(studentId) {
return request({
url: '/system/student/' + studentId,
method: 'get'
})
}
// 新增学生信息
export function addStudent(data) {
return request({
url: '/system/student',
method: 'post',
data: data
})
}
// 修改学生信息
export function updateStudent(data) {
return request({
url: '/system/student',
method: 'put',
data: data
})
}
// 删除学生信息
export function delStudent(studentId) {
return request({
url: '/system/student/' + studentId,
method: 'delete'
})
}

View File

@ -0,0 +1,267 @@
<template>
<div class="dashboard-editor-container">
<el-card class="paper-home-card">
<template #header>
<div class="paper-home-header">
<span>论文首页郑瑜甜</span>
</div>
</template>
<!-- 个人信息展示区 -->
<el-card class="info-card" style="margin-bottom: 20px;">
<div class="personal-info">
<div class="avatar">
<img src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" alt="用户头像" />
</div>
<div class="info-content">
<h3>郑瑜甜</h3>
<div class="info-item">
<svg-icon icon-class="user" class="info-icon" />
<span>学号2023001001</span>
</div>
<div class="info-item">
<svg-icon icon-class="phone" class="info-icon" />
<span>联系电话13800138000</span>
</div>
<div class="info-item">
<svg-icon icon-class="building" class="info-icon" />
<span>学院计算机科学与技术学院</span>
</div>
<div class="info-item">
<svg-icon icon-class="email" class="info-icon" />
<span>邮箱test@example.com</span>
</div>
</div>
</div>
</el-card>
<!-- 毕业论文基本信息板块 -->
<el-card class="info-card" style="margin-bottom: 20px;">
<div slot="header" class="card-header">
<span>毕业论文基本信息</span>
</div>
<el-form :model="paperInfo" label-width="100px" size="small">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="论文题目">
<span>{{ paperInfo.title }}</span>
</el-form-item>
<el-form-item label="论文类型">
<span>{{ paperInfo.type }}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="提交日期">
<span>{{ paperInfo.submitDate }}</span>
</el-form-item>
<el-form-item label="论文状态">
<el-tag type="success">{{ paperInfo.status }}</el-tag>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="论文摘要">
<p style="line-height: 1.6;">{{ paperInfo.abstract }}</p>
</el-form-item>
</el-col>
</el-row>
<div style="text-align: right; margin-top: 10px;">
<el-button type="primary" size="small">编辑论文信息</el-button>
<el-button type="success" size="small" style="margin-left: 10px;">上传论文</el-button>
</div>
</el-form>
</el-card>
<!-- 论文成果介绍部分 -->
<el-card class="info-card">
<div slot="header" class="card-header">
<span>毕业论文成果详细介绍</span>
</div>
<el-tabs v-model="activeTab">
<el-tab-pane label="研究内容">
<div class="tab-content">
<p>本研究基于深度学习算法提出了一种改进的图像识别模型研究主要包括以下内容</p>
<ol>
<li>分析了当前图像识别领域的研究现状和存在的问题</li>
<li>提出了一种基于卷积神经网络的改进模型架构</li>
<li>设计了特殊的数据增强方法提高模型的泛化能力</li>
<li>通过实验验证了模型在多个数据集上的性能表现</li>
</ol>
</div>
</el-tab-pane>
<el-tab-pane label="研究方法">
<div class="tab-content">
<p>本研究采用了以下研究方法</p>
<ol>
<li><strong>文献研究法</strong>系统梳理了国内外相关研究文献了解研究现状和发展趋势</li>
<li><strong>实验研究法</strong>设计了对比实验验证了所提方法的有效性</li>
<li><strong>定量分析法</strong>使用准确率召回率F1值等指标对实验结果进行量化分析</li>
<li><strong>案例分析法</strong>通过具体案例展示了模型在实际应用中的表现</li>
</ol>
</div>
</el-tab-pane>
<el-tab-pane label="研究成果">
<div class="tab-content">
<p>本研究取得了以下成果</p>
<ol>
<li>提出了一种新的卷积神经网络架构在标准数据集上的准确率达到95.8%</li>
<li>开发了一套完整的图像识别系统原型具有良好的实时性能</li>
<li>发表了相关学术论文2篇申请了1项发明专利</li>
<li>研究成果在实际场景中进行了试点应用取得了良好效果</li>
</ol>
</div>
</el-tab-pane>
</el-tabs>
</el-card>
</el-card>
</div>
</template>
<script>
export default {
name: 'PaperHome',
data() {
return {
activeTab: '0',
paperInfo: {
title: '基于深度学习的图像识别系统研究与实现',
type: '工程设计',
submitDate: '2023-05-15',
status: '已提交',
abstract: '本文研究了基于深度学习的图像识别技术,提出了一种改进的卷积神经网络模型,并在实际应用场景中进行了测试和验证。实验结果表明,该模型在图像分类和识别任务上具有较高的准确率和效率,为相关领域的应用提供了新的技术方案。'
}
}
},
mounted() {
//
// this.loadPaperInfo();
},
methods: {
//
loadPaperInfo() {
// API
// this.$http.get('/api/paper/info').then(res => { this.paperInfo = res.data; });
}
}
}
</script>
<style lang="scss" scoped>
.dashboard-editor-container {
padding: 20px;
background-color: #f5f7fa;
min-height: calc(100vh - 60px);
}
.paper-home-card {
margin-bottom: 20px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.paper-home-header {
font-size: 20px;
font-weight: bold;
color: #1f2937;
display: flex;
align-items: center;
justify-content: center;
padding: 10px 0;
}
.info-card {
margin-bottom: 20px;
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
}
.card-header {
font-size: 16px;
font-weight: 600;
color: #333;
}
.personal-info {
display: flex;
align-items: center;
padding: 10px 0;
}
.avatar {
width: 100px;
height: 100px;
border-radius: 50%;
overflow: hidden;
margin-right: 30px;
border: 3px solid #e8e8e8;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.avatar img {
width: 100%;
height: 100%;
object-fit: cover;
}
.info-content h3 {
margin: 0 0 20px 0;
font-size: 22px;
color: #1f2937;
}
.info-item {
display: flex;
align-items: center;
margin-bottom: 12px;
font-size: 14px;
color: #666;
}
.info-icon {
width: 20px;
height: 20px;
margin-right: 10px;
color: #409eff;
}
.tab-content {
padding: 20px 0;
line-height: 1.8;
color: #666;
}
.tab-content p {
margin-bottom: 15px;
font-size: 15px;
}
.tab-content ol {
padding-left: 25px;
}
.tab-content li {
margin-bottom: 10px;
}
.tab-content strong {
color: #333;
font-weight: 600;
}
@media (max-width: 768px) {
.dashboard-editor-container {
padding: 10px;
}
.personal-info {
flex-direction: column;
text-align: center;
}
.avatar {
margin-right: 0;
margin-bottom: 20px;
}
.paper-home-header {
font-size: 18px;
}
}
</style>

View File

@ -0,0 +1,289 @@
<template>
<div class="app-container">
<el-card>
<template #header>
<div class="card-header">
<span>学生管理</span>
</div>
</template>
<div class="filter-container">
<el-input
v-model="queryParams.studentName"
placeholder="请输入学生姓名"
clearable
size="small"
class="mb-2 mr-2"
style="width: 240px"
/>
<el-input
v-model="queryParams.studentId"
placeholder="请输入学生ID"
clearable
size="small"
class="mb-2 mr-2"
style="width: 240px"
/>
<el-button
type="primary"
icon="el-icon-search"
size="small"
@click="handleQuery"
class="mb-2"
>
搜索
</el-button>
<el-button
icon="el-icon-refresh"
size="small"
@click="resetQuery"
class="mb-2"
>
重置
</el-button>
</div>
<el-table
v-loading="loading"
:data="studentList"
@selection-change="handleSelectionChange"
border
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="学生ID" prop="studentId" align="center" width="120" />
<el-table-column label="学生姓名" prop="studentName" align="center" />
<el-table-column label="学生年龄" prop="studentAge" align="center" width="120" />
<el-table-column label="学生性别" prop="studentSex" align="center" width="120">
<template slot-scope="scope">
<el-tag v-if="scope.row.studentSex === '1'" type="success"></el-tag>
<el-tag v-else-if="scope.row.studentSex === '0'" type="info"></el-tag>
<el-tag v-else type="danger">未知</el-tag>
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createTime" align="center" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="180">
<template slot-scope="scope">
<el-button
type="primary"
icon="el-icon-edit"
size="small"
@click="handleUpdate(scope.row)"
>
修改
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="small"
@click="handleDelete(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
<!-- 添加或修改学生对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="form.studentName" placeholder="请输入学生姓名" />
</el-form-item>
<el-form-item label="学生年龄" prop="studentAge">
<el-input v-model="form.studentAge" placeholder="请输入学生年龄" type="number" />
</el-form-item>
<el-form-item label="学生性别" prop="studentSex">
<el-radio-group v-model="form.studentSex">
<el-radio label="1"></el-radio>
<el-radio label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listStudent, getStudent, delStudent, addStudent, updateStudent } from "@/api/student";
import { parseTime } from "@/utils/ruoyi";
export default {
name: "Student",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
studentList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
studentName: null,
studentId: null
},
//
form: {},
//
rules: {
studentName: [
{ required: true, message: "学生姓名不能为空", trigger: "blur" }
],
studentAge: [
{ required: true, message: "学生年龄不能为空", trigger: "blur" },
{ type: "number", message: "学生年龄必须为数字值", trigger: "blur" }
],
studentSex: [
{ required: true, message: "学生性别不能为空", trigger: "blur" }
]
}
};
},
created() {
this.getList();
},
methods: {
/** 查询学生列表 */
getList() {
this.loading = true;
listStudent(this.queryParams).then(res => {
this.studentList = res.rows;
this.total = res.total;
this.loading = false;
});
},
//
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
//
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
//
handleAdd() {
this.reset();
this.open = true;
this.title = "添加学生";
},
//
handleUpdate(row) {
this.reset();
const id = row.id || this.ids[0];
getStudent(id).then(res => {
this.form = res.data;
this.open = true;
this.title = "修改学生";
});
},
//
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateStudent(this.form).then(res => {
if (res.code === 200) {
this.$message.success("修改成功");
this.open = false;
this.getList();
} else {
this.$message.error(res.msg);
}
});
} else {
addStudent(this.form).then(res => {
if (res.code === 200) {
this.$message.success("新增成功");
this.open = false;
this.getList();
} else {
this.$message.error(res.msg);
}
});
}
}
});
},
//
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm(
"确定要删除选中的学生吗?",
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
)
.then(function() {
return delStudent(ids);
})
.then(res => {
if (res.code === 200) {
this.$message.success("删除成功");
this.getList();
} else {
this.$message.error(res.msg);
}
})
.catch(function() {});
},
//
reset() {
this.form = {};
this.resetForm("form");
},
//
cancel() {
this.open = false;
this.reset();
}
}
};
</script>
<style scoped>
.filter-container {
padding-bottom: 10px;
}
</style>

View File

@ -0,0 +1,335 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="学生姓名" prop="studentName">
<el-input
v-model="queryParams.studentName"
placeholder="请输入学生姓名"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="性别" prop="gender">
<el-select v-model="queryParams.gender" placeholder="请选择性别" clearable>
<el-option
v-for="dict in dict.type.sys_user_sex"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:student:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:student:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:student:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:student:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="studentList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="学生ID" align="center" prop="studentId" />
<el-table-column label="学生姓名" align="center" prop="studentName" />
<el-table-column label="头像" align="center" prop="avatar" width="100">
<template slot-scope="scope">
<img v-if="scope.row.avatar" :src="scope.row.avatar" style="width: 50px; height: 50px; border-radius: 50%;" />
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="性别" align="center" prop="gender">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_user_sex" :value="scope.row.gender"/>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:student:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:student:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改学生信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="学生姓名" prop="studentName">
<el-input v-model="form.studentName" placeholder="请输入学生姓名" />
</el-form-item>
<el-form-item label="头像" prop="avatar">
<el-input v-model="form.avatar" placeholder="请输入头像URL地址" />
</el-form-item>
<el-form-item label="个人介绍" prop="introduction">
<el-input v-model="form.introduction" type="textarea" placeholder="请输入个人介绍" />
</el-form-item>
<el-form-item label="性别" prop="gender">
<el-radio-group v-model="form.gender">
<el-radio
v-for="dict in dict.type.sys_user_sex"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listStudent, getStudent, delStudent, addStudent, updateStudent } from "@/api/system/student";
export default {
name: "Student",
dicts: ['sys_user_sex', 'sys_normal_disable'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
studentList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
studentName: null,
gender: null,
status: null,
},
//
form: {},
//
rules: {
studentName: [
{ required: true, message: "学生姓名不能为空", trigger: "blur" }
],
gender: [
{ required: true, message: "性别不能为空", trigger: "change" }
],
status: [
{ required: true, message: "状态不能为空", trigger: "change" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询学生信息列表 */
getList() {
this.loading = true;
listStudent(this.queryParams).then(response => {
this.studentList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
studentId: null,
studentName: null,
avatar: null,
introduction: null,
gender: "0",
status: "0",
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.studentId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加学生信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const studentId = row.studentId || this.ids
getStudent(studentId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改学生信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.studentId != null) {
updateStudent(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addStudent(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const studentIds = row.studentId || this.ids;
this.$modal.confirm('是否确认删除学生信息编号为"' + studentIds + '"的数据项?').then(function() {
return delStudent(studentIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/student/export', {
...this.queryParams
}, `student_${new Date().getTime()}.xlsx`)
}
}
};
</script>

57
sql/student.sql 100644
View File

@ -0,0 +1,57 @@
-- ----------------------------
-- 学生信息表
-- ----------------------------
drop table if exists sys_student;
create table sys_student (
student_id bigint(20) not null auto_increment comment '学生ID',
student_name varchar(30) not null comment '学生姓名',
avatar varchar(255) default '' comment '头像地址',
introduction text comment '个人介绍',
gender char(1) default '0' comment '性别0男 1女',
status char(1) default '0' comment '状态0正常 1停用',
del_flag char(1) default '0' comment '删除标志0代表存在 2代表删除',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
remark varchar(500) default null comment '备注',
primary key (student_id)
) engine=innodb auto_increment=1000 default charset=utf8mb4 comment = '学生信息表';
-- ----------------------------
-- 初始化-学生信息表数据
-- ----------------------------
insert into sys_student values(1, '张三', '/profile/avatar/2023/01/15/xxx_1.jpg', '计算机科学专业大三学生热爱编程擅长Java和Python开发。', '0', '0', '0', 'admin', sysdate(), '', null, '优秀学生');
insert into sys_student values(2, '李四', '/profile/avatar/2023/02/20/xxx_2.jpg', '软件工程专业大二学生对前端开发有浓厚兴趣熟悉Vue和React框架。', '1', '0', '0', 'admin', sysdate(), '', null, '前端爱好者');
insert into sys_student values(3, '王五', '/profile/avatar/2023/03/10/xxx_3.jpg', '信息安全专业大三学生热衷于网络安全研究曾参与多次CTF比赛。', '0', '0', '0', 'admin', sysdate(), '', null, '安全达人');
insert into sys_student values(4, '赵六', '/profile/avatar/2023/04/05/xxx_4.jpg', '数据科学专业大二学生擅长数据分析和机器学习熟悉Python和R语言。', '1', '0', '0', 'admin', sysdate(), '', null, '数据分析师');
insert into sys_student values(5, '钱七', '/profile/avatar/2023/05/12/xxx_5.jpg', '人工智能专业大三学生,研究方向为深度学习和自然语言处理。', '0', '0', '0', 'admin', sysdate(), '', null, 'AI研究者');
-- ----------------------------
-- 学生信息菜单
-- ----------------------------
-- 一级菜单
insert into sys_menu values('2100', '学生管理', '0', '5', 'student', null, '', '', 1, 0, 'M', '0', '0', '', 'education', 'admin', sysdate(), '', null, '学生管理目录');
-- 二级菜单
insert into sys_menu values('2101', '学生信息', '2100', '1', 'info', 'student/info/index', '', '', 1, 0, 'C', '0', '0', 'student:info:list', 'user', 'admin', sysdate(), '', null, '学生信息菜单');
-- 学生信息按钮
insert into sys_menu values('2102', '学生查询', '2101', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'student:info:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('2103', '学生新增', '2101', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'student:info:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('2104', '学生修改', '2101', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'student:info:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('2105', '学生删除', '2101', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'student:info:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('2106', '学生导出', '2101', '5', '', '', '', '', 1, 0, 'F', '0', '0', 'student:info:export', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu values('2107', '学生导入', '2101', '6', '', '', '', '', 1, 0, 'F', '0', '0', 'student:info:import', '#', 'admin', sysdate(), '', null, '');
-- ----------------------------
-- 学生信息权限分配给超级管理员角色
-- ----------------------------
insert into sys_role_menu values ('1', '2100');
insert into sys_role_menu values ('1', '2101');
insert into sys_role_menu values ('1', '2102');
insert into sys_role_menu values ('1', '2103');
insert into sys_role_menu values ('1', '2104');
insert into sys_role_menu values ('1', '2105');
insert into sys_role_menu values ('1', '2106');
insert into sys_role_menu values ('1', '2107');