|
|
|
@ -7,7 +7,6 @@ import com.ccic.safeliab.vo.InsQuestionVO; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
@ -37,14 +36,7 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean deleteQuestionById(Long id) { |
|
|
|
|
List<Long> ids = new ArrayList<>(); |
|
|
|
|
ids.add(id); |
|
|
|
|
return deleteLogic(ids); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean deleteQuestionListByIds(List<Long> ids) { |
|
|
|
|
public boolean delQuestion(List<Long> ids) { |
|
|
|
|
return deleteLogic(ids); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -69,45 +61,36 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public QuestionCategories getDetail(String id){ |
|
|
|
|
return baseMapper.getDetail(Long.valueOf(id)); |
|
|
|
|
public QuestionCategories getQuestionDetail(String id){ |
|
|
|
|
return baseMapper.getQuestionDetail(Long.valueOf(id)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 将 VO 转换为实体类 |
|
|
|
|
* @param vo 试题 VO |
|
|
|
|
* @return 试题实体类 |
|
|
|
|
* 将VO转换为实体类 |
|
|
|
|
*/ |
|
|
|
|
private QuestionCategories convertToEntity(InsQuestionVO vo) { |
|
|
|
|
QuestionCategories entity = new QuestionCategories(); |
|
|
|
|
|
|
|
|
|
// 赋值从父类继承的属性
|
|
|
|
|
entity.setId(vo.getId()); |
|
|
|
|
entity.setQuestionTypes(vo.getQuestionTypes()); |
|
|
|
|
entity.setIndustryId(vo.getIndustryId()); |
|
|
|
|
entity.setServiceTypeId(vo.getServiceTypeId()); |
|
|
|
|
entity.setQuestionContent(vo.getQuestionContent()); |
|
|
|
|
entity.setAnswer(vo.getAnswer()); |
|
|
|
|
|
|
|
|
|
// 处理答题选项,拼接成字符串
|
|
|
|
|
InsQuestionVO.AnswerOptions answerOptions = vo.getAnswerOptions(); |
|
|
|
|
if (answerOptions != null) { |
|
|
|
|
StringBuilder optionsBuilder = new StringBuilder(); |
|
|
|
|
if (answerOptions.A != null) { |
|
|
|
|
optionsBuilder.append("A:").append(answerOptions.A).append(","); |
|
|
|
|
} |
|
|
|
|
if (answerOptions.B != null) { |
|
|
|
|
optionsBuilder.append("B:").append(answerOptions.B).append(","); |
|
|
|
|
} |
|
|
|
|
if (answerOptions.C != null) { |
|
|
|
|
optionsBuilder.append("C:").append(answerOptions.C).append(","); |
|
|
|
|
} |
|
|
|
|
if (answerOptions.D != null) { |
|
|
|
|
optionsBuilder.append("D:").append(answerOptions.D); |
|
|
|
|
} |
|
|
|
|
String options = optionsBuilder.toString(); |
|
|
|
|
entity.setOptions(options); |
|
|
|
|
StringBuilder optionsBuilder = new StringBuilder(); |
|
|
|
|
if (vo.getOptionA()!= null) { |
|
|
|
|
optionsBuilder.append("A:").append(vo.getOptionA()).append(","); |
|
|
|
|
} |
|
|
|
|
if (vo.getOptionB() != null) { |
|
|
|
|
optionsBuilder.append("B:").append(vo.getOptionB()).append(","); |
|
|
|
|
} |
|
|
|
|
if (vo.getOptionC() != null) { |
|
|
|
|
optionsBuilder.append("C:").append(vo.getOptionC()).append(","); |
|
|
|
|
} |
|
|
|
|
if (vo.getOptionD() != null) { |
|
|
|
|
optionsBuilder.append("D:").append(vo.getOptionD()); |
|
|
|
|
} |
|
|
|
|
String options = optionsBuilder.toString(); |
|
|
|
|
entity.setOptions(options); |
|
|
|
|
return entity; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|