StudentInfoOldServiceImpl.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. package com.ruoyi.system.service.impl;
  2. import java.util.*;
  3. import com.ruoyi.common.core.domain.AjaxResult;
  4. import com.ruoyi.common.exception.ServiceException;
  5. import com.ruoyi.common.utils.DateUtils;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Service;
  8. import com.ruoyi.system.mapper.StudentInfoOldMapper;
  9. import com.ruoyi.system.domain.StudentInfoOld;
  10. import com.ruoyi.system.service.IStudentInfoOldService;
  11. /**
  12. * 学生档案历史信息Service业务层处理
  13. *
  14. * @author ruoyi
  15. * @date 2023-07-28
  16. */
  17. @Service
  18. public class StudentInfoOldServiceImpl implements IStudentInfoOldService
  19. {
  20. @Autowired
  21. private StudentInfoOldMapper studentInfoOldMapper;
  22. /**
  23. * 查询学生档案历史信息
  24. *
  25. * @param id 学生档案历史信息主键
  26. * @return 学生档案历史信息
  27. */
  28. @Override
  29. public StudentInfoOld selectStudentInfoOldById(Long id)
  30. {
  31. return studentInfoOldMapper.selectStudentInfoOldById(id);
  32. }
  33. /**
  34. * 查询学生档案历史信息列表
  35. *
  36. * @param studentInfoOld 学生档案历史信息
  37. * @return 学生档案历史信息
  38. */
  39. @Override
  40. public List<StudentInfoOld> selectStudentInfoOldList(StudentInfoOld studentInfoOld)
  41. {
  42. if(studentInfoOld.getStudentId()==null || studentInfoOld.getStudentId()==0L){
  43. throw new ServiceException("参数错误");
  44. }
  45. return studentInfoOldMapper.selectStudentInfoOldList(studentInfoOld);
  46. }
  47. /**
  48. * 新增学生档案历史信息
  49. *
  50. * @param studentInfoOld 学生档案历史信息
  51. * @return 结果
  52. */
  53. @Override
  54. public int insertStudentInfoOld(StudentInfoOld studentInfoOld)
  55. {
  56. studentInfoOld.setCreateTime(DateUtils.getNowDate());
  57. return studentInfoOldMapper.insertStudentInfoOld(studentInfoOld);
  58. }
  59. /**
  60. * 修改学生档案历史信息
  61. *
  62. * @param studentInfoOld 学生档案历史信息
  63. * @return 结果
  64. */
  65. @Override
  66. public int updateStudentInfoOld(StudentInfoOld studentInfoOld)
  67. {
  68. studentInfoOld.setUpdateTime(DateUtils.getNowDate());
  69. return studentInfoOldMapper.updateStudentInfoOld(studentInfoOld);
  70. }
  71. /**
  72. * 批量删除学生档案历史信息
  73. *
  74. * @param ids 需要删除的学生档案历史信息主键
  75. * @return 结果
  76. */
  77. @Override
  78. public int deleteStudentInfoOldByIds(Long[] ids)
  79. {
  80. return studentInfoOldMapper.deleteStudentInfoOldByIds(ids);
  81. }
  82. /**
  83. * 删除学生档案历史信息信息
  84. *
  85. * @param id 学生档案历史信息主键
  86. * @return 结果
  87. */
  88. @Override
  89. public int deleteStudentInfoOldById(Long id)
  90. {
  91. return studentInfoOldMapper.deleteStudentInfoOldById(id);
  92. }
  93. @Override
  94. public AjaxResult selectStudentInfoOldListEcharts(StudentInfoOld studentInfoOld) {
  95. if(studentInfoOld.getStudentId()==null || studentInfoOld.getStudentId()==0L){
  96. throw new ServiceException("参数错误");
  97. }
  98. List<StudentInfoOld> StudentInfoOldList = studentInfoOldMapper.selectStudentInfoOldListEcharts(studentInfoOld);
  99. Map<String,Object> map = new HashMap<>();
  100. List<Object> x = new ArrayList<>();
  101. List<Object> y1 = new ArrayList<>();
  102. List<Object> y2 = new ArrayList<>();
  103. for (StudentInfoOld infoOld : StudentInfoOldList) {
  104. x.add(DateUtils.dateTime(infoOld.getUpdateTime()));
  105. y1.add(infoOld.getHeight());
  106. y2.add(infoOld.getWeight());
  107. }
  108. map.put("X",x);
  109. map.put("Y1",y1);
  110. map.put("Y2",y2);
  111. return AjaxResult.success("成功",map);
  112. }
  113. }