|
@@ -8,9 +8,8 @@ import com.diagbot.entity.ModuleInfo;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.service.impl.ModuleInfoServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
-import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.vo.ModuleVO;
|
|
|
-import com.diagbot.vo.QuestionIdsVO;
|
|
|
+import com.diagbot.vo.QuestionVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -39,7 +38,8 @@ public class ModuleFacade extends ModuleInfoServiceImpl {
|
|
|
List<ModuleInfoDTO> data = new ArrayList<>();
|
|
|
QueryWrapper queryWrapper = new QueryWrapper();
|
|
|
queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
- List<ModuleInfo> list = this.list(queryWrapper);
|
|
|
+ queryWrapper.orderByAsc("id");
|
|
|
+ List<ModuleInfo> list = this.list(queryWrapper);
|
|
|
data = BeanUtil.listCopyTo(list, ModuleInfoDTO.class);
|
|
|
for (ModuleInfoDTO bean : data) {
|
|
|
QueryWrapper wrapper = new QueryWrapper();
|
|
@@ -49,19 +49,15 @@ public class ModuleFacade extends ModuleInfoServiceImpl {
|
|
|
List<ModuleDetail> moduleDetailList = moduleDetailFacade.list(wrapper);
|
|
|
List<ModuleDetailDTO> moduleDetailDTOList = BeanUtil.listCopyTo(moduleDetailList, ModuleDetailDTO.class);
|
|
|
bean.setModuleDetailDTOList(moduleDetailDTOList);
|
|
|
- StringBuffer sb = new StringBuffer();
|
|
|
for (ModuleDetailDTO detailDTO : moduleDetailDTOList) {
|
|
|
- if (detailDTO.getQuestionId() != null) {
|
|
|
- sb.append(detailDTO.getQuestionId()).append(",");
|
|
|
+ if (null != detailDTO.getQuestionId()) {
|
|
|
+ QuestionVO questionVO = new QuestionVO();
|
|
|
+ questionVO.setId(detailDTO.getQuestionId());
|
|
|
+ questionVO.setSexType(moduleVO.getSexType());
|
|
|
+ questionVO.setAge(moduleVO.getAge());
|
|
|
+ detailDTO.setQuestionDTO(questionFacade.getById(questionVO));
|
|
|
}
|
|
|
}
|
|
|
- if (ListUtil.isNotEmpty(moduleDetailDTOList)) {
|
|
|
- QuestionIdsVO questionIdsVO = new QuestionIdsVO();
|
|
|
- questionIdsVO.setIds(sb.toString().substring(0, sb.toString().length()-1));
|
|
|
- questionIdsVO.setSexType(moduleVO.getSexType());
|
|
|
- questionIdsVO.setAge(moduleVO.getAge());
|
|
|
- bean.setQuestionList(questionFacade.getByIds(questionIdsVO));
|
|
|
- }
|
|
|
}
|
|
|
return data;
|
|
|
}
|