StudentServiceImpl.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package com.qmth.exam.reserve.service.impl;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4. import com.qmth.boot.core.exception.StatusException;
  5. import com.qmth.exam.reserve.bean.student.StudentInfo;
  6. import com.qmth.exam.reserve.bean.student.WechatBindReq;
  7. import com.qmth.exam.reserve.dao.StudentDao;
  8. import com.qmth.exam.reserve.entity.StudentEntity;
  9. import com.qmth.exam.reserve.service.StudentService;
  10. import org.slf4j.Logger;
  11. import org.slf4j.LoggerFactory;
  12. import org.springframework.stereotype.Service;
  13. @Service
  14. public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> implements StudentService {
  15. private static final Logger log = LoggerFactory.getLogger(StudentServiceImpl.class);
  16. @Override
  17. public StudentEntity findStudentByStudentCode(Long orgId, String studentCode) {
  18. QueryWrapper<StudentEntity> wrapper = new QueryWrapper<>();
  19. if (orgId != null) {
  20. wrapper.lambda().eq(StudentEntity::getOrgId, orgId);
  21. }
  22. wrapper.lambda().eq(StudentEntity::getStudentCode, studentCode);
  23. return baseMapper.selectOne(wrapper);
  24. }
  25. @Override
  26. public StudentInfo findInfoByStudentId(Long studentId) {
  27. StudentEntity entity = baseMapper.selectById(studentId);
  28. if (entity == null) {
  29. throw new StatusException("学生不存在");
  30. }
  31. StudentInfo info = new StudentInfo();
  32. info.setOrgId(entity.getOrgId());
  33. info.setId(entity.getId());
  34. info.setName(entity.getName());
  35. info.setStudentCode(entity.getStudentCode());
  36. info.setIdentityNumber(entity.getIdentityNumber());
  37. info.setPhotoPath(entity.getPhotoPath());
  38. info.setGender(entity.getGender());
  39. info.setApplyNumber(entity.getApplyNumber());
  40. info.setApplyTaskId(entity.getApplyTaskId());
  41. info.setCategoryId(entity.getCategoryId());
  42. info.setOpenId(entity.getOpenId());
  43. info.setUid(entity.getUid());
  44. return info;
  45. }
  46. @Override
  47. public void bindingWechat(WechatBindReq req) {
  48. }
  49. @Override
  50. public void unbindWechatByStudentId(Long studentId) {
  51. }
  52. }