package com.ruoyi.system.service.impl; import java.util.*; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.system.mapper.StudentInfoOldMapper; import com.ruoyi.system.domain.StudentInfoOld; import com.ruoyi.system.service.IStudentInfoOldService; /** * 学生档案历史信息Service业务层处理 * * @author ruoyi * @date 2023-07-28 */ @Service public class StudentInfoOldServiceImpl implements IStudentInfoOldService { @Autowired private StudentInfoOldMapper studentInfoOldMapper; /** * 查询学生档案历史信息 * * @param id 学生档案历史信息主键 * @return 学生档案历史信息 */ @Override public StudentInfoOld selectStudentInfoOldById(Long id) { return studentInfoOldMapper.selectStudentInfoOldById(id); } /** * 查询学生档案历史信息列表 * * @param studentInfoOld 学生档案历史信息 * @return 学生档案历史信息 */ @Override public List selectStudentInfoOldList(StudentInfoOld studentInfoOld) { if(studentInfoOld.getStudentId()==null || studentInfoOld.getStudentId()==0L){ throw new ServiceException("参数错误"); } return studentInfoOldMapper.selectStudentInfoOldList(studentInfoOld); } /** * 新增学生档案历史信息 * * @param studentInfoOld 学生档案历史信息 * @return 结果 */ @Override public int insertStudentInfoOld(StudentInfoOld studentInfoOld) { studentInfoOld.setCreateTime(DateUtils.getNowDate()); return studentInfoOldMapper.insertStudentInfoOld(studentInfoOld); } /** * 修改学生档案历史信息 * * @param studentInfoOld 学生档案历史信息 * @return 结果 */ @Override public int updateStudentInfoOld(StudentInfoOld studentInfoOld) { studentInfoOld.setUpdateTime(DateUtils.getNowDate()); return studentInfoOldMapper.updateStudentInfoOld(studentInfoOld); } /** * 批量删除学生档案历史信息 * * @param ids 需要删除的学生档案历史信息主键 * @return 结果 */ @Override public int deleteStudentInfoOldByIds(Long[] ids) { return studentInfoOldMapper.deleteStudentInfoOldByIds(ids); } /** * 删除学生档案历史信息信息 * * @param id 学生档案历史信息主键 * @return 结果 */ @Override public int deleteStudentInfoOldById(Long id) { return studentInfoOldMapper.deleteStudentInfoOldById(id); } @Override public AjaxResult selectStudentInfoOldListEcharts(StudentInfoOld studentInfoOld) { if(studentInfoOld.getStudentId()==null || studentInfoOld.getStudentId()==0L){ throw new ServiceException("参数错误"); } List StudentInfoOldList = studentInfoOldMapper.selectStudentInfoOldListEcharts(studentInfoOld); Map map = new HashMap<>(); List x = new ArrayList<>(); List y1 = new ArrayList<>(); List y2 = new ArrayList<>(); for (StudentInfoOld infoOld : StudentInfoOldList) { x.add(DateUtils.dateTime(infoOld.getUpdateTime())); y1.add(infoOld.getHeight()); y2.add(infoOld.getWeight()); } map.put("X",x); map.put("Y1",y1); map.put("Y2",y2); return AjaxResult.success("成功",map); } }