QuestionAnswerTitleValueServiceDaoImpl.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. package com.java110.user.dao.impl;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.java110.core.base.dao.BaseServiceDao;
  4. import com.java110.dto.questionAnswerTitleValue.QuestionAnswerTitleValueDto;
  5. import com.java110.user.dao.IQuestionAnswerTitleValueServiceDao;
  6. import com.java110.utils.constant.ResponseConstant;
  7. import com.java110.utils.exception.DAOException;
  8. import org.slf4j.Logger;
  9. import org.slf4j.LoggerFactory;
  10. import org.springframework.stereotype.Service;
  11. import java.util.List;
  12. import java.util.Map;
  13. /**
  14. * 答卷选项服务 与数据库交互
  15. * Created by wuxw on 2017/4/5.
  16. */
  17. @Service("questionAnswerTitleValueServiceDaoImpl")
  18. //@Transactional
  19. public class QuestionAnswerTitleValueServiceDaoImpl extends BaseServiceDao implements IQuestionAnswerTitleValueServiceDao {
  20. private static Logger logger = LoggerFactory.getLogger(QuestionAnswerTitleValueServiceDaoImpl.class);
  21. /**
  22. * 保存答卷选项信息 到 instance
  23. *
  24. * @param info bId 信息
  25. * @throws DAOException DAO异常
  26. */
  27. @Override
  28. public void saveQuestionAnswerTitleValueInfo(Map info) throws DAOException {
  29. logger.debug("保存答卷选项信息Instance 入参 info : {}", info);
  30. int saveFlag = sqlSessionTemplate.insert("questionAnswerTitleValueServiceDaoImpl.saveQuestionAnswerTitleValueInfo", info);
  31. if (saveFlag < 1) {
  32. throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存答卷选项信息Instance数据失败:" + JSONObject.toJSONString(info));
  33. }
  34. }
  35. /**
  36. * 查询答卷选项信息(instance)
  37. *
  38. * @param info bId 信息
  39. * @return List<Map>
  40. * @throws DAOException DAO异常
  41. */
  42. @Override
  43. public List<Map> getQuestionAnswerTitleValueInfo(Map info) throws DAOException {
  44. logger.debug("查询答卷选项信息 入参 info : {}", info);
  45. List<Map> businessQuestionAnswerTitleValueInfos = sqlSessionTemplate.selectList("questionAnswerTitleValueServiceDaoImpl.getQuestionAnswerTitleValueInfo", info);
  46. return businessQuestionAnswerTitleValueInfos;
  47. }
  48. /**
  49. * 修改答卷选项信息
  50. *
  51. * @param info 修改信息
  52. * @throws DAOException DAO异常
  53. */
  54. @Override
  55. public void updateQuestionAnswerTitleValueInfo(Map info) throws DAOException {
  56. logger.debug("修改答卷选项信息Instance 入参 info : {}", info);
  57. int saveFlag = sqlSessionTemplate.update("questionAnswerTitleValueServiceDaoImpl.updateQuestionAnswerTitleValueInfo", info);
  58. if (saveFlag < 1) {
  59. throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "修改答卷选项信息Instance数据失败:" + JSONObject.toJSONString(info));
  60. }
  61. }
  62. /**
  63. * 查询答卷选项数量
  64. *
  65. * @param info 答卷选项信息
  66. * @return 答卷选项数量
  67. */
  68. @Override
  69. public int queryQuestionAnswerTitleValuesCount(Map info) {
  70. logger.debug("查询答卷选项数据 入参 info : {}", info);
  71. List<Map> businessQuestionAnswerTitleValueInfos = sqlSessionTemplate.selectList("questionAnswerTitleValueServiceDaoImpl.queryQuestionAnswerTitleValuesCount", info);
  72. if (businessQuestionAnswerTitleValueInfos.size() < 1) {
  73. return 0;
  74. }
  75. return Integer.parseInt(businessQuestionAnswerTitleValueInfos.get(0).get("count").toString());
  76. }
  77. @Override
  78. public List<Map> queryQuestionAnswerTitleValueResult(Map info) {
  79. List<Map> businessQuestionAnswerTitleValueInfos
  80. = sqlSessionTemplate.selectList("questionAnswerTitleValueServiceDaoImpl.queryQuestionAnswerTitleValueResult", info);
  81. return businessQuestionAnswerTitleValueInfos;
  82. }
  83. }