diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..7b016a89f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.compile.nullAnalysis.mode": "automatic" +} \ No newline at end of file diff --git a/execute_student_sql.bat b/execute_student_sql.bat new file mode 100644 index 000000000..a67fa844e --- /dev/null +++ b/execute_student_sql.bat @@ -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 \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysStudentController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysStudentController.java new file mode 100644 index 000000000..47e0a7265 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysStudentController.java @@ -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 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 list = sysStudentService.selectSysStudentList(sysStudent); + ExcelUtil util = new ExcelUtil(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)); + } +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysStudent.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysStudent.java new file mode 100644 index 000000000..8b217fff5 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysStudent.java @@ -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(); + } +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysStudentMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysStudentMapper.java new file mode 100644 index 000000000..8ebe6b66e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysStudentMapper.java @@ -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 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); +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysStudentService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysStudentService.java new file mode 100644 index 000000000..c4486a052 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysStudentService.java @@ -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 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); +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysStudentServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysStudentServiceImpl.java new file mode 100644 index 000000000..bc9c26608 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysStudentServiceImpl.java @@ -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 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); + } +} \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysStudentMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysStudentMapper.xml new file mode 100644 index 000000000..8f4ac7b6e --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysStudentMapper.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + select student_id, student_name, avatar, student_introduction, gender, status, del_flag, create_by, create_time, update_by, update_time, remark from sys_student + + + + + + + + insert into sys_student + + student_name, + avatar, + student_introduction, + gender, + status, + del_flag, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{studentName}, + #{avatar}, + #{introduction}, + #{gender}, + #{status}, + #{delFlag}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update sys_student + + student_name = #{studentName}, + avatar = #{avatar}, + student_introduction = #{introduction}, + gender = #{gender}, + status = #{status}, + del_flag = #{delFlag}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where student_id = #{studentId} + + + + update sys_student set del_flag = '2' where student_id = #{studentId} + + + + update sys_student set del_flag = '2' where student_id in + + #{studentId} + + + \ No newline at end of file diff --git a/ruoyi-ui/src/api/student/index.js b/ruoyi-ui/src/api/student/index.js new file mode 100644 index 000000000..912a5f094 --- /dev/null +++ b/ruoyi-ui/src/api/student/index.js @@ -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 + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/api/system/info.js b/ruoyi-ui/src/api/system/info.js new file mode 100644 index 000000000..7b19e2612 --- /dev/null +++ b/ruoyi-ui/src/api/system/info.js @@ -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' + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/api/system/student.js b/ruoyi-ui/src/api/system/student.js new file mode 100644 index 000000000..4b90f80a3 --- /dev/null +++ b/ruoyi-ui/src/api/system/student.js @@ -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' + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/views/dashboard/index.vue b/ruoyi-ui/src/views/dashboard/index.vue new file mode 100644 index 000000000..81f8b2d32 --- /dev/null +++ b/ruoyi-ui/src/views/dashboard/index.vue @@ -0,0 +1,267 @@ + + + + + \ No newline at end of file diff --git a/ruoyi-ui/src/views/student/index.vue b/ruoyi-ui/src/views/student/index.vue new file mode 100644 index 000000000..dcfca137b --- /dev/null +++ b/ruoyi-ui/src/views/student/index.vue @@ -0,0 +1,289 @@ + + + + + \ No newline at end of file diff --git a/ruoyi-ui/src/views/student/info/index.vue b/ruoyi-ui/src/views/student/info/index.vue new file mode 100644 index 000000000..e69de29bb diff --git a/ruoyi-ui/src/views/system/student/index.vue b/ruoyi-ui/src/views/system/student/index.vue new file mode 100644 index 000000000..1ef92cd39 --- /dev/null +++ b/ruoyi-ui/src/views/system/student/index.vue @@ -0,0 +1,335 @@ + + + \ No newline at end of file diff --git a/sql/student.sql b/sql/student.sql new file mode 100644 index 000000000..5a009d6d7 --- /dev/null +++ b/sql/student.sql @@ -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'); \ No newline at end of file