提交代码
parent
0b6db48732
commit
e1a8918435
|
@ -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<TestStudents> 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<TestStudents> list = testStudentsService.selectTestStudentsList(testStudents);
|
||||||
|
ExcelUtil<TestStudents> util = new ExcelUtil<TestStudents>(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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<TestStudentsScores> 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<TestStudentsScores> getTestStudentsScoresList()
|
||||||
|
{
|
||||||
|
return testStudentsScoresList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTestStudentsScoresList(List<TestStudentsScores> 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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<TestStudents> 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<TestStudentsScores> testStudentsScoresList);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过学生主键删除学生成绩信息
|
||||||
|
*
|
||||||
|
* @param studentId 学生ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteTestStudentsScoresByStudentId(Long studentId);
|
||||||
|
}
|
|
@ -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<TestStudents> 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);
|
||||||
|
}
|
|
@ -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<TestStudents> 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<TestStudentsScores> testStudentsScoresList = testStudents.getTestStudentsScoresList();
|
||||||
|
Long studentId = testStudents.getStudentId();
|
||||||
|
if (StringUtils.isNotNull(testStudentsScoresList))
|
||||||
|
{
|
||||||
|
List<TestStudentsScores> list = new ArrayList<TestStudentsScores>();
|
||||||
|
for (TestStudentsScores testStudentsScores : testStudentsScoresList)
|
||||||
|
{
|
||||||
|
testStudentsScores.setStudentId(studentId);
|
||||||
|
list.add(testStudentsScores);
|
||||||
|
}
|
||||||
|
if (list.size() > 0)
|
||||||
|
{
|
||||||
|
testStudentsMapper.batchTestStudentsScores(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
<?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.TestStudentsMapper">
|
||||||
|
|
||||||
|
<resultMap type="TestStudents" id="TestStudentsResult">
|
||||||
|
<result property="studentId" column="student_id" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="age" column="age" />
|
||||||
|
<result property="gender" column="gender" />
|
||||||
|
<result property="major" column="major" />
|
||||||
|
<result property="enrollmentDate" column="enrollment_date" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="TestStudentsTestStudentsScoresResult" type="TestStudents" extends="TestStudentsResult">
|
||||||
|
<collection property="testStudentsScoresList" ofType="TestStudentsScores" column="student_id" select="selectTestStudentsScoresList" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap type="TestStudentsScores" id="TestStudentsScoresResult">
|
||||||
|
<result property="scoreId" column="score_id" />
|
||||||
|
<result property="studentId" column="student_id" />
|
||||||
|
<result property="courseName" column="course_name" />
|
||||||
|
<result property="score" column="score" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectTestStudentsVo">
|
||||||
|
select student_id, name, age, gender, major, enrollment_date from test_students
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectTestStudentsList" parameterType="TestStudents" resultMap="TestStudentsResult">
|
||||||
|
<include refid="selectTestStudentsVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="age != null "> and age = #{age}</if>
|
||||||
|
<if test="gender != null and gender != ''"> and gender = #{gender}</if>
|
||||||
|
<if test="major != null and major != ''"> and major = #{major}</if>
|
||||||
|
<if test="enrollmentDate != null "> and enrollment_date = #{enrollmentDate}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTestStudentsByStudentId" parameterType="Long" resultMap="TestStudentsTestStudentsScoresResult">
|
||||||
|
select student_id, name, age, gender, major, enrollment_date
|
||||||
|
from test_students
|
||||||
|
where student_id = #{studentId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTestStudentsScoresList" resultMap="TestStudentsScoresResult">
|
||||||
|
select score_id, student_id, course_name, score
|
||||||
|
from test_students_scores
|
||||||
|
where student_id = #{student_id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertTestStudents" parameterType="TestStudents" useGeneratedKeys="true" keyProperty="studentId">
|
||||||
|
insert into test_students
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="name != null">name,</if>
|
||||||
|
<if test="age != null">age,</if>
|
||||||
|
<if test="gender != null">gender,</if>
|
||||||
|
<if test="major != null">major,</if>
|
||||||
|
<if test="enrollmentDate != null">enrollment_date,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="name != null">#{name},</if>
|
||||||
|
<if test="age != null">#{age},</if>
|
||||||
|
<if test="gender != null">#{gender},</if>
|
||||||
|
<if test="major != null">#{major},</if>
|
||||||
|
<if test="enrollmentDate != null">#{enrollmentDate},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateTestStudents" parameterType="TestStudents">
|
||||||
|
update test_students
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="name != null">name = #{name},</if>
|
||||||
|
<if test="age != null">age = #{age},</if>
|
||||||
|
<if test="gender != null">gender = #{gender},</if>
|
||||||
|
<if test="major != null">major = #{major},</if>
|
||||||
|
<if test="enrollmentDate != null">enrollment_date = #{enrollmentDate},</if>
|
||||||
|
</trim>
|
||||||
|
where student_id = #{studentId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteTestStudentsByStudentId" parameterType="Long">
|
||||||
|
delete from test_students where student_id = #{studentId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteTestStudentsByStudentIds" parameterType="String">
|
||||||
|
delete from test_students where student_id in
|
||||||
|
<foreach item="studentId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{studentId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteTestStudentsScoresByStudentIds" parameterType="String">
|
||||||
|
delete from test_students_scores where student_id in
|
||||||
|
<foreach item="studentId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{studentId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteTestStudentsScoresByStudentId" parameterType="Long">
|
||||||
|
delete from test_students_scores where student_id = #{studentId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="batchTestStudentsScores">
|
||||||
|
insert into test_students_scores( score_id, student_id, course_name, score) values
|
||||||
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
|
( #{item.scoreId}, #{item.studentId}, #{item.courseName}, #{item.score})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
|
@ -1,10 +1,10 @@
|
||||||
# 页面标题
|
# 页面标题
|
||||||
VUE_APP_TITLE = 若依管理系统
|
VUE_APP_TITLE = 研筑机试管理
|
||||||
|
|
||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
ENV = 'development'
|
ENV = 'development'
|
||||||
|
|
||||||
# 若依管理系统/开发环境
|
# 研筑机试管理/开发环境
|
||||||
VUE_APP_BASE_API = '/dev-api'
|
VUE_APP_BASE_API = '/dev-api'
|
||||||
|
|
||||||
# 路由懒加载
|
# 路由懒加载
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# 页面标题
|
# 页面标题
|
||||||
VUE_APP_TITLE = 若依管理系统
|
VUE_APP_TITLE = 研筑机试管理
|
||||||
|
|
||||||
# 生产环境配置
|
# 生产环境配置
|
||||||
ENV = 'production'
|
ENV = 'production'
|
||||||
|
|
||||||
# 若依管理系统/生产环境
|
# 研筑机试管理/生产环境
|
||||||
VUE_APP_BASE_API = '/prod-api'
|
VUE_APP_BASE_API = '/prod-api'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# 页面标题
|
# 页面标题
|
||||||
VUE_APP_TITLE = 若依管理系统
|
VUE_APP_TITLE = 研筑机试管理
|
||||||
|
|
||||||
BABEL_ENV = production
|
BABEL_ENV = production
|
||||||
|
|
||||||
|
@ -8,5 +8,5 @@ NODE_ENV = production
|
||||||
# 测试环境配置
|
# 测试环境配置
|
||||||
ENV = 'staging'
|
ENV = 'staging'
|
||||||
|
|
||||||
# 若依管理系统/测试环境
|
# 研筑机试管理/测试环境
|
||||||
VUE_APP_BASE_API = '/stage-api'
|
VUE_APP_BASE_API = '/stage-api'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "ruoyi",
|
"name": "ruoyi",
|
||||||
"version": "3.8.9",
|
"version": "3.8.9",
|
||||||
"description": "若依管理系统",
|
"description": "研筑机试管理",
|
||||||
"author": "若依",
|
"author": "若依",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 894 B |
|
@ -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'
|
||||||
|
})
|
||||||
|
}
|
|
@ -12,7 +12,7 @@
|
||||||
<el-col :sm="24" :lg="12" style="padding-left: 20px">
|
<el-col :sm="24" :lg="12" style="padding-left: 20px">
|
||||||
<h2>若依后台管理框架</h2>
|
<h2>若依后台管理框架</h2>
|
||||||
<p>
|
<p>
|
||||||
一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了若依管理系统,她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。
|
一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了研筑机试管理,她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<b>当前版本:</b> <span>v{{ version }}</span>
|
<b>当前版本:</b> <span>v{{ version }}</span>
|
||||||
|
|
|
@ -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="name">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.name"
|
||||||
|
placeholder="请输入学生姓名"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</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:students: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:students: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:students: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:students:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="studentsList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="学生编号" align="center" prop="studentId" width="88"/>
|
||||||
|
<el-table-column label="学生姓名" align="center" prop="name" />
|
||||||
|
<el-table-column label="学生年龄" align="center" prop="age" />
|
||||||
|
<el-table-column label="性别" align="center" prop="gender" />
|
||||||
|
<el-table-column label="专业" align="center" prop="major" />
|
||||||
|
<el-table-column label="入学日期" align="center" prop="enrollmentDate" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.enrollmentDate, '{y}-{m}-{d}') }}</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:students:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:students: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="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入学生姓名" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="学生年龄" prop="age">
|
||||||
|
<el-input v-model="form.age" placeholder="请输入学生年龄" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="性别" prop="gender">
|
||||||
|
<el-input v-model="form.gender" placeholder="请输入性别" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="专业" prop="major">
|
||||||
|
<el-input v-model="form.major" placeholder="请输入专业" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="入学日期" prop="enrollmentDate">
|
||||||
|
<el-date-picker clearable
|
||||||
|
v-model="form.enrollmentDate"
|
||||||
|
type="date"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
placeholder="请选择入学日期">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-divider content-position="center">学生成绩信息</el-divider>
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddTestStudentsScores">添加</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteTestStudentsScores">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-table :data="testStudentsScoresList" :row-class-name="rowTestStudentsScoresIndex" @selection-change="handleTestStudentsScoresSelectionChange" ref="testStudentsScores">
|
||||||
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
|
<el-table-column label="序号" align="center" prop="index" width="50"/>
|
||||||
|
<el-table-column label="课程名称" prop="courseName" width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.courseName" placeholder="请输入课程名称" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="课程分数" prop="score" width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.score" placeholder="请输入课程分数" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</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 { listStudents, getStudents, delStudents, addStudents, updateStudents } from "@/api/system/students";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Students",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 子表选中数据
|
||||||
|
checkedTestStudentsScores: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 学生表格数据
|
||||||
|
studentsList: [],
|
||||||
|
// 学生成绩表格数据
|
||||||
|
testStudentsScoresList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null,
|
||||||
|
age: null,
|
||||||
|
gender: null,
|
||||||
|
major: null,
|
||||||
|
enrollmentDate: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询学生列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listStudents(this.queryParams).then(response => {
|
||||||
|
this.studentsList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
studentId: null,
|
||||||
|
name: null,
|
||||||
|
age: null,
|
||||||
|
gender: null,
|
||||||
|
major: null,
|
||||||
|
enrollmentDate: null
|
||||||
|
};
|
||||||
|
this.testStudentsScoresList = [];
|
||||||
|
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
|
||||||
|
getStudents(studentId).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.testStudentsScoresList = response.data.testStudentsScoresList;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改学生";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.form.testStudentsScoresList = this.testStudentsScoresList;
|
||||||
|
if (this.form.studentId != null) {
|
||||||
|
updateStudents(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addStudents(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 delStudents(studentIds);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 学生成绩序号 */
|
||||||
|
rowTestStudentsScoresIndex({ row, rowIndex }) {
|
||||||
|
row.index = rowIndex + 1;
|
||||||
|
},
|
||||||
|
/** 学生成绩添加按钮操作 */
|
||||||
|
handleAddTestStudentsScores() {
|
||||||
|
let obj = {};
|
||||||
|
obj.courseName = "";
|
||||||
|
obj.score = "";
|
||||||
|
this.testStudentsScoresList.push(obj);
|
||||||
|
},
|
||||||
|
/** 学生成绩删除按钮操作 */
|
||||||
|
handleDeleteTestStudentsScores() {
|
||||||
|
if (this.checkedTestStudentsScores.length == 0) {
|
||||||
|
this.$modal.msgError("请先选择要删除的学生成绩数据");
|
||||||
|
} else {
|
||||||
|
const testStudentsScoresList = this.testStudentsScoresList;
|
||||||
|
const checkedTestStudentsScores = this.checkedTestStudentsScores;
|
||||||
|
this.testStudentsScoresList = testStudentsScoresList.filter(function(item) {
|
||||||
|
return checkedTestStudentsScores.indexOf(item.index) == -1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 复选框选中数据 */
|
||||||
|
handleTestStudentsScoresSelectionChange(selection) {
|
||||||
|
this.checkedTestStudentsScores = selection.map(item => item.index)
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('system/students/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `students_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -7,7 +7,7 @@ function resolve(dir) {
|
||||||
|
|
||||||
const CompressionPlugin = require('compression-webpack-plugin')
|
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 // 端口
|
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue