123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- package com.ruoyi.system.service.impl;
- import java.util.List;
- import com.ruoyi.common.core.domain.entity.SysUser;
- import com.ruoyi.common.exception.ServiceException;
- import com.ruoyi.common.utils.ClassUtils;
- import com.ruoyi.common.utils.DateUtils;
- import com.ruoyi.common.utils.SecurityUtils;
- import com.ruoyi.system.domain.StudentInfo;
- import com.ruoyi.system.mapper.StudentInfoMapper;
- import lombok.SneakyThrows;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import com.ruoyi.system.mapper.StudentMindOldMapper;
- import com.ruoyi.system.domain.StudentMindOld;
- import com.ruoyi.system.service.IStudentMindOldService;
- /**
- * 学生心理健康历史信息Service业务层处理
- *
- * @author ruoyi
- * @date 2023-08-03
- */
- @Service
- public class StudentMindOldServiceImpl implements IStudentMindOldService
- {
- @Autowired
- private StudentMindOldMapper studentMindOldMapper;
- @Autowired
- private StudentInfoMapper studentInfoMapper;
- /**
- * 查询学生心理健康历史信息
- *
- * @param mindId 学生心理健康历史信息主键
- * @return 学生心理健康历史信息
- */
- @Override
- public StudentMindOld selectStudentMindOldByMindId(Long mindId)
- {
- return studentMindOldMapper.selectStudentMindOldByMindId(mindId);
- }
- /**
- * 查询学生心理健康历史信息列表
- *
- * @param studentMindOld 学生心理健康历史信息
- * @return 学生心理健康历史信息
- */
- @Override
- public List<StudentMindOld> selectStudentMindOldList(StudentMindOld studentMindOld)
- {
- return studentMindOldMapper.selectStudentMindOldList(studentMindOld);
- }
- /**
- * 新增学生心理健康历史信息
- *
- * @param studentMindOld 学生心理健康历史信息
- * @return 结果
- */
- @SneakyThrows
- @Override
- public int insertStudentMindOld(StudentMindOld studentMindOld)
- {
- SysUser user = SecurityUtils.getLoginUser().getUser();
- StudentInfo student = studentInfoMapper.selectStudentInfoByStudentId(studentMindOld.getStudentId());
- if(student==null){
- throw new ServiceException("请先填写学生档案信息");
- }
- student.setMind(studentMindOld.getMind());
- student.setPsychologicalDescription(studentMindOld.getPsychologicalDescription());
- student.setUpdateTime(DateUtils.getNowDate());
- studentInfoMapper.updateStudentInfo(student);
- ClassUtils.copyProperties(student, studentMindOld);
- studentMindOld.setCreateTime(DateUtils.getNowDate());
- studentMindOld.setUpdateTime(DateUtils.getNowDate());
- studentMindOld.setCreateBy(user.getUserName());
- return studentMindOldMapper.insertStudentMindOld(studentMindOld);
- }
- /**
- * 修改学生心理健康历史信息
- *
- * @param studentMindOld 学生心理健康历史信息
- * @return 结果
- */
- @Override
- public int updateStudentMindOld(StudentMindOld studentMindOld)
- {
- studentMindOld.setUpdateTime(DateUtils.getNowDate());
- return studentMindOldMapper.updateStudentMindOld(studentMindOld);
- }
- /**
- * 批量删除学生心理健康历史信息
- *
- * @param mindIds 需要删除的学生心理健康历史信息主键
- * @return 结果
- */
- @Override
- public int deleteStudentMindOldByMindIds(Long[] mindIds)
- {
- return studentMindOldMapper.deleteStudentMindOldByMindIds(mindIds);
- }
- /**
- * 删除学生心理健康历史信息信息
- *
- * @param mindId 学生心理健康历史信息主键
- * @return 结果
- */
- @Override
- public int deleteStudentMindOldByMindId(Long mindId)
- {
- return studentMindOldMapper.deleteStudentMindOldByMindId(mindId);
- }
- }
|