diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/TestStudentsController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/TestStudentsController.java new file mode 100644 index 0000000..8ecc2e0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/TestStudentsController.java @@ -0,0 +1,104 @@ +package com.ruoyi.system.controller; + +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.TestStudents; +import com.ruoyi.system.service.ITestStudentsService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 学生Controller + * + * @author ruoyi + * @date 2025-02-18 + */ +@RestController +@RequestMapping("/system/students") +public class TestStudentsController extends BaseController +{ + @Autowired + private ITestStudentsService testStudentsService; + + /** + * 查询学生列表 + */ + @PreAuthorize("@ss.hasPermi('system:students:list')") + @GetMapping("/list") + public TableDataInfo list(TestStudents testStudents) + { + startPage(); + List list = testStudentsService.selectTestStudentsList(testStudents); + return getDataTable(list); + } + + /** + * 导出学生列表 + */ + @PreAuthorize("@ss.hasPermi('system:students:export')") + @Log(title = "学生", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, TestStudents testStudents) + { + List list = testStudentsService.selectTestStudentsList(testStudents); + ExcelUtil util = new ExcelUtil(TestStudents.class); + util.exportExcel(response, list, "学生数据"); + } + + /** + * 获取学生详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:students:query')") + @GetMapping(value = "/{studentId}") + public AjaxResult getInfo(@PathVariable("studentId") Long studentId) + { + return success(testStudentsService.selectTestStudentsByStudentId(studentId)); + } + + /** + * 新增学生 + */ + @PreAuthorize("@ss.hasPermi('system:students:add')") + @Log(title = "学生", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody TestStudents testStudents) + { + return toAjax(testStudentsService.insertTestStudents(testStudents)); + } + + /** + * 修改学生 + */ + @PreAuthorize("@ss.hasPermi('system:students:edit')") + @Log(title = "学生", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody TestStudents testStudents) + { + return toAjax(testStudentsService.updateTestStudents(testStudents)); + } + + /** + * 删除学生 + */ + @PreAuthorize("@ss.hasPermi('system:students:remove')") + @Log(title = "学生", businessType = BusinessType.DELETE) + @DeleteMapping("/{studentIds}") + public AjaxResult remove(@PathVariable Long[] studentIds) + { + return toAjax(testStudentsService.deleteTestStudentsByStudentIds(studentIds)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/TestStudents.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TestStudents.java new file mode 100644 index 0000000..3cc4dbc --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TestStudents.java @@ -0,0 +1,125 @@ +package com.ruoyi.system.domain; + +import java.util.List; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +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; + +/** + * 学生对象 test_students + * + * @author ruoyi + * @date 2025-02-18 + */ +public class TestStudents extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 学生ID */ + private Long studentId; + + /** 学生姓名 */ + @Excel(name = "学生姓名") + private String name; + + /** 学生年龄 */ + @Excel(name = "学生年龄") + private Long age; + + /** 性别 */ + @Excel(name = "性别") + private String gender; + + /** 专业 */ + @Excel(name = "专业") + private String major; + + /** 入学日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "入学日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date enrollmentDate; + + /** 学生成绩信息 */ + private List testStudentsScoresList; + + public void setStudentId(Long studentId) + { + this.studentId = studentId; + } + + public Long getStudentId() + { + return studentId; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + public void setAge(Long age) + { + this.age = age; + } + + public Long getAge() + { + return age; + } + public void setGender(String gender) + { + this.gender = gender; + } + + public String getGender() + { + return gender; + } + public void setMajor(String major) + { + this.major = major; + } + + public String getMajor() + { + return major; + } + public void setEnrollmentDate(Date enrollmentDate) + { + this.enrollmentDate = enrollmentDate; + } + + public Date getEnrollmentDate() + { + return enrollmentDate; + } + + public List getTestStudentsScoresList() + { + return testStudentsScoresList; + } + + public void setTestStudentsScoresList(List testStudentsScoresList) + { + this.testStudentsScoresList = testStudentsScoresList; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("studentId", getStudentId()) + .append("name", getName()) + .append("age", getAge()) + .append("gender", getGender()) + .append("major", getMajor()) + .append("enrollmentDate", getEnrollmentDate()) + .append("testStudentsScoresList", getTestStudentsScoresList()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/TestStudentsScores.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TestStudentsScores.java new file mode 100644 index 0000000..a5252c3 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TestStudentsScores.java @@ -0,0 +1,79 @@ +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; + +/** + * 学生成绩对象 test_students_scores + * + * @author ruoyi + * @date 2025-02-18 + */ +public class TestStudentsScores extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 分数ID */ + private Long scoreId; + + /** 学生ID */ + @Excel(name = "学生ID") + private Long studentId; + + /** 课程名称 */ + @Excel(name = "课程名称") + private String courseName; + + /** 课程分数 */ + @Excel(name = "课程分数") + private Long score; + + public void setScoreId(Long scoreId) + { + this.scoreId = scoreId; + } + + public Long getScoreId() + { + return scoreId; + } + public void setStudentId(Long studentId) + { + this.studentId = studentId; + } + + public Long getStudentId() + { + return studentId; + } + public void setCourseName(String courseName) + { + this.courseName = courseName; + } + + public String getCourseName() + { + return courseName; + } + public void setScore(Long score) + { + this.score = score; + } + + public Long getScore() + { + return score; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("scoreId", getScoreId()) + .append("studentId", getStudentId()) + .append("courseName", getCourseName()) + .append("score", getScore()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TestStudentsMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TestStudentsMapper.java new file mode 100644 index 0000000..3242202 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TestStudentsMapper.java @@ -0,0 +1,87 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.TestStudents; +import com.ruoyi.system.domain.TestStudentsScores; + +/** + * 学生Mapper接口 + * + * @author ruoyi + * @date 2025-02-18 + */ +public interface TestStudentsMapper +{ + /** + * 查询学生 + * + * @param studentId 学生主键 + * @return 学生 + */ + public TestStudents selectTestStudentsByStudentId(Long studentId); + + /** + * 查询学生列表 + * + * @param testStudents 学生 + * @return 学生集合 + */ + public List selectTestStudentsList(TestStudents testStudents); + + /** + * 新增学生 + * + * @param testStudents 学生 + * @return 结果 + */ + public int insertTestStudents(TestStudents testStudents); + + /** + * 修改学生 + * + * @param testStudents 学生 + * @return 结果 + */ + public int updateTestStudents(TestStudents testStudents); + + /** + * 删除学生 + * + * @param studentId 学生主键 + * @return 结果 + */ + public int deleteTestStudentsByStudentId(Long studentId); + + /** + * 批量删除学生 + * + * @param studentIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteTestStudentsByStudentIds(Long[] studentIds); + + /** + * 批量删除学生成绩 + * + * @param studentIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteTestStudentsScoresByStudentIds(Long[] studentIds); + + /** + * 批量新增学生成绩 + * + * @param testStudentsScoresList 学生成绩列表 + * @return 结果 + */ + public int batchTestStudentsScores(List testStudentsScoresList); + + + /** + * 通过学生主键删除学生成绩信息 + * + * @param studentId 学生ID + * @return 结果 + */ + public int deleteTestStudentsScoresByStudentId(Long studentId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITestStudentsService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITestStudentsService.java new file mode 100644 index 0000000..136dde4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITestStudentsService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.TestStudents; + +/** + * 学生Service接口 + * + * @author ruoyi + * @date 2025-02-18 + */ +public interface ITestStudentsService +{ + /** + * 查询学生 + * + * @param studentId 学生主键 + * @return 学生 + */ + public TestStudents selectTestStudentsByStudentId(Long studentId); + + /** + * 查询学生列表 + * + * @param testStudents 学生 + * @return 学生集合 + */ + public List selectTestStudentsList(TestStudents testStudents); + + /** + * 新增学生 + * + * @param testStudents 学生 + * @return 结果 + */ + public int insertTestStudents(TestStudents testStudents); + + /** + * 修改学生 + * + * @param testStudents 学生 + * @return 结果 + */ + public int updateTestStudents(TestStudents testStudents); + + /** + * 批量删除学生 + * + * @param studentIds 需要删除的学生主键集合 + * @return 结果 + */ + public int deleteTestStudentsByStudentIds(Long[] studentIds); + + /** + * 删除学生信息 + * + * @param studentId 学生主键 + * @return 结果 + */ + public int deleteTestStudentsByStudentId(Long studentId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TestStudentsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TestStudentsServiceImpl.java new file mode 100644 index 0000000..b8e75f0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TestStudentsServiceImpl.java @@ -0,0 +1,131 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.ArrayList; +import com.ruoyi.common.utils.StringUtils; +import org.springframework.transaction.annotation.Transactional; +import com.ruoyi.system.domain.TestStudentsScores; +import com.ruoyi.system.mapper.TestStudentsMapper; +import com.ruoyi.system.domain.TestStudents; +import com.ruoyi.system.service.ITestStudentsService; + +/** + * 学生Service业务层处理 + * + * @author ruoyi + * @date 2025-02-18 + */ +@Service +public class TestStudentsServiceImpl implements ITestStudentsService +{ + @Autowired + private TestStudentsMapper testStudentsMapper; + + /** + * 查询学生 + * + * @param studentId 学生主键 + * @return 学生 + */ + @Override + public TestStudents selectTestStudentsByStudentId(Long studentId) + { + return testStudentsMapper.selectTestStudentsByStudentId(studentId); + } + + /** + * 查询学生列表 + * + * @param testStudents 学生 + * @return 学生 + */ + @Override + public List selectTestStudentsList(TestStudents testStudents) + { + return testStudentsMapper.selectTestStudentsList(testStudents); + } + + /** + * 新增学生 + * + * @param testStudents 学生 + * @return 结果 + */ + @Transactional + @Override + public int insertTestStudents(TestStudents testStudents) + { + int rows = testStudentsMapper.insertTestStudents(testStudents); + insertTestStudentsScores(testStudents); + return rows; + } + + /** + * 修改学生 + * + * @param testStudents 学生 + * @return 结果 + */ + @Transactional + @Override + public int updateTestStudents(TestStudents testStudents) + { + testStudentsMapper.deleteTestStudentsScoresByStudentId(testStudents.getStudentId()); + insertTestStudentsScores(testStudents); + return testStudentsMapper.updateTestStudents(testStudents); + } + + /** + * 批量删除学生 + * + * @param studentIds 需要删除的学生主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteTestStudentsByStudentIds(Long[] studentIds) + { + testStudentsMapper.deleteTestStudentsScoresByStudentIds(studentIds); + return testStudentsMapper.deleteTestStudentsByStudentIds(studentIds); + } + + /** + * 删除学生信息 + * + * @param studentId 学生主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteTestStudentsByStudentId(Long studentId) + { + testStudentsMapper.deleteTestStudentsScoresByStudentId(studentId); + return testStudentsMapper.deleteTestStudentsByStudentId(studentId); + } + + /** + * 新增学生成绩信息 + * + * @param testStudents 学生对象 + */ + public void insertTestStudentsScores(TestStudents testStudents) + { + List testStudentsScoresList = testStudents.getTestStudentsScoresList(); + Long studentId = testStudents.getStudentId(); + if (StringUtils.isNotNull(testStudentsScoresList)) + { + List list = new ArrayList(); + for (TestStudentsScores testStudentsScores : testStudentsScoresList) + { + testStudentsScores.setStudentId(studentId); + list.add(testStudentsScores); + } + if (list.size() > 0) + { + testStudentsMapper.batchTestStudentsScores(list); + } + } + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/TestStudentsMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TestStudentsMapper.xml new file mode 100644 index 0000000..70f1724 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/TestStudentsMapper.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select student_id, name, age, gender, major, enrollment_date from test_students + + + + + + + + + + insert into test_students + + name, + age, + gender, + major, + enrollment_date, + + + #{name}, + #{age}, + #{gender}, + #{major}, + #{enrollmentDate}, + + + + + update test_students + + name = #{name}, + age = #{age}, + gender = #{gender}, + major = #{major}, + enrollment_date = #{enrollmentDate}, + + where student_id = #{studentId} + + + + delete from test_students where student_id = #{studentId} + + + + delete from test_students where student_id in + + #{studentId} + + + + + delete from test_students_scores where student_id in + + #{studentId} + + + + + delete from test_students_scores where student_id = #{studentId} + + + + insert into test_students_scores( score_id, student_id, course_name, score) values + + ( #{item.scoreId}, #{item.studentId}, #{item.courseName}, #{item.score}) + + + \ No newline at end of file diff --git a/ruoyi-ui/.env.development b/ruoyi-ui/.env.development index 302ecd1..d868248 100644 --- a/ruoyi-ui/.env.development +++ b/ruoyi-ui/.env.development @@ -1,10 +1,10 @@ # 页面标题 -VUE_APP_TITLE = 若依管理系统 +VUE_APP_TITLE = 研筑机试管理 # 开发环境配置 ENV = 'development' -# 若依管理系统/开发环境 +# 研筑机试管理/开发环境 VUE_APP_BASE_API = '/dev-api' # 路由懒加载 diff --git a/ruoyi-ui/.env.production b/ruoyi-ui/.env.production index b4893b0..9246565 100644 --- a/ruoyi-ui/.env.production +++ b/ruoyi-ui/.env.production @@ -1,8 +1,8 @@ # 页面标题 -VUE_APP_TITLE = 若依管理系统 +VUE_APP_TITLE = 研筑机试管理 # 生产环境配置 ENV = 'production' -# 若依管理系统/生产环境 +# 研筑机试管理/生产环境 VUE_APP_BASE_API = '/prod-api' diff --git a/ruoyi-ui/.env.staging b/ruoyi-ui/.env.staging index 209b64e..b4c1755 100644 --- a/ruoyi-ui/.env.staging +++ b/ruoyi-ui/.env.staging @@ -1,5 +1,5 @@ # 页面标题 -VUE_APP_TITLE = 若依管理系统 +VUE_APP_TITLE = 研筑机试管理 BABEL_ENV = production @@ -8,5 +8,5 @@ NODE_ENV = production # 测试环境配置 ENV = 'staging' -# 若依管理系统/测试环境 +# 研筑机试管理/测试环境 VUE_APP_BASE_API = '/stage-api' diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 392d7db..9195d4d 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,7 +1,7 @@ { "name": "ruoyi", "version": "3.8.9", - "description": "若依管理系统", + "description": "研筑机试管理", "author": "若依", "license": "MIT", "scripts": { diff --git a/ruoyi-ui/public/favicon.ico b/ruoyi-ui/public/favicon.ico index e263760..d92e0b8 100644 Binary files a/ruoyi-ui/public/favicon.ico and b/ruoyi-ui/public/favicon.ico differ diff --git a/ruoyi-ui/src/api/system/students.js b/ruoyi-ui/src/api/system/students.js new file mode 100644 index 0000000..d1130b1 --- /dev/null +++ b/ruoyi-ui/src/api/system/students.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询学生列表 +export function listStudents(query) { + return request({ + url: '/system/students/list', + method: 'get', + params: query + }) +} + +// 查询学生详细 +export function getStudents(studentId) { + return request({ + url: '/system/students/' + studentId, + method: 'get' + }) +} + +// 新增学生 +export function addStudents(data) { + return request({ + url: '/system/students', + method: 'post', + data: data + }) +} + +// 修改学生 +export function updateStudents(data) { + return request({ + url: '/system/students', + method: 'put', + data: data + }) +} + +// 删除学生 +export function delStudents(studentId) { + return request({ + url: '/system/students/' + studentId, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 92a6482..a053d6f 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -12,7 +12,7 @@

若依后台管理框架

- 一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了若依管理系统,她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。 + 一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了研筑机试管理,她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。

当前版本: v{{ version }} diff --git a/ruoyi-ui/src/views/system/students/index.vue b/ruoyi-ui/src/views/system/students/index.vue new file mode 100644 index 0000000..0f5d289 --- /dev/null +++ b/ruoyi-ui/src/views/system/students/index.vue @@ -0,0 +1,335 @@ + + + diff --git a/ruoyi-ui/vue.config.js b/ruoyi-ui/vue.config.js index 8afb50b..12126da 100644 --- a/ruoyi-ui/vue.config.js +++ b/ruoyi-ui/vue.config.js @@ -7,7 +7,7 @@ function resolve(dir) { const CompressionPlugin = require('compression-webpack-plugin') -const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题 +const name = process.env.VUE_APP_TITLE || '研筑机试管理' // 网页标题 const port = process.env.port || process.env.npm_config_port || 80 // 端口