| | |
| | | package org.springblade.modules.subjectChoices.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.modules.answerRecord.entity.AnswerRecordEntity; |
| | | import org.springblade.modules.answerRecord.service.IAnswerRecordService; |
| | | import org.springblade.modules.subjectChoices.dto.SubjectChoicesDTO; |
| | | import org.springblade.modules.subjectChoices.entity.SubjectChoicesEntity; |
| | | import org.springblade.modules.subjectChoices.mapper.SubjectChoicesMapper; |
| | | import org.springblade.modules.subjectChoices.service.ISubjectChoicesService; |
| | | import org.springblade.modules.subjectChoices.vo.SubjectChoicesVO; |
| | | import org.springblade.modules.subjectOption.vo.SubjectOptionVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | @Override |
| | | public IPage<SubjectChoicesVO> selectSubjectChoicesPage(IPage<SubjectChoicesVO> page, SubjectChoicesVO subjectChoices) { |
| | | return page.setRecords(baseMapper.selectSubjectChoicesPage(page, subjectChoices)); |
| | | List<SubjectChoicesVO> subjectChoicesVOS = baseMapper.selectSubjectChoicesPage(page, subjectChoices); |
| | | IAnswerRecordService bean = SpringUtils.getBean(IAnswerRecordService.class); |
| | | for (SubjectChoicesVO subjectChoicesVO : subjectChoicesVOS) { |
| | | List<SubjectOptionVO> subjectOptionList = subjectChoicesVO.getSubjectOptionList(); |
| | | for (SubjectOptionVO subjectOptionVO : subjectOptionList) { |
| | | AnswerRecordEntity one = bean.getOne(Wrappers.<AnswerRecordEntity>lambdaQuery(). |
| | | eq(AnswerRecordEntity::getAnswerOption, subjectOptionVO.getId()) |
| | | .eq(AnswerRecordEntity::getPropertyId,subjectChoices.getPropertyId())); |
| | | if (one == null) { |
| | | continue; |
| | | } |
| | | if (one.getSubjectChoicesType().equals(3)) { |
| | | subjectOptionVO.setNumbers(one.getAnswer()); |
| | | } else { |
| | | subjectChoicesVO.setChooseId(one.getAnswerOption()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return page.setRecords(subjectChoicesVOS); |
| | | } |
| | | |
| | | /** |