QuestionAnswerTitleRelV1ServiceDaoImpl.java 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Copyright 2017-2020 吴学文 and java110 team.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.java110.user.dao.impl;
  17. import com.alibaba.fastjson.JSONObject;
  18. import com.java110.utils.constant.ResponseConstant;
  19. import com.java110.utils.exception.DAOException;
  20. import com.java110.utils.util.DateUtil;
  21. import com.java110.core.base.dao.BaseServiceDao;
  22. import com.java110.user.dao.IQuestionAnswerTitleRelV1ServiceDao;
  23. import org.slf4j.Logger;
  24. import org.slf4j.LoggerFactory;
  25. import org.springframework.stereotype.Service;
  26. import org.springframework.transaction.annotation.Transactional;
  27. import java.util.List;
  28. import java.util.Map;
  29. /**
  30. * 类表述:
  31. * add by 吴学文 at 2023-07-07 16:27:01 mail: 928255095@qq.com
  32. * open source address: https://gitee.com/wuxw7/MicroCommunity
  33. * 官网:http://www.homecommunity.cn
  34. * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
  35. * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
  36. */
  37. @Service("questionAnswerTitleRelV1ServiceDaoImpl")
  38. public class QuestionAnswerTitleRelV1ServiceDaoImpl extends BaseServiceDao implements IQuestionAnswerTitleRelV1ServiceDao {
  39. private static Logger logger = LoggerFactory.getLogger(QuestionAnswerTitleRelV1ServiceDaoImpl.class);
  40. /**
  41. * 保存问卷题目关系信息 到 instance
  42. * @param info bId 信息
  43. * @throws DAOException DAO异常
  44. */
  45. @Override
  46. public int saveQuestionAnswerTitleRelInfo(Map info) throws DAOException {
  47. logger.debug("保存 saveQuestionAnswerTitleRelInfo 入参 info : {}",info);
  48. int saveFlag = sqlSessionTemplate.insert("questionAnswerTitleRelV1ServiceDaoImpl.saveQuestionAnswerTitleRelInfo",info);
  49. return saveFlag;
  50. }
  51. /**
  52. * 查询问卷题目关系信息(instance)
  53. * @param info bId 信息
  54. * @return List<Map>
  55. * @throws DAOException DAO异常
  56. */
  57. @Override
  58. public List<Map> getQuestionAnswerTitleRelInfo(Map info) throws DAOException {
  59. logger.debug("查询 getQuestionAnswerTitleRelInfo 入参 info : {}",info);
  60. List<Map> businessQuestionAnswerTitleRelInfos = sqlSessionTemplate.selectList("questionAnswerTitleRelV1ServiceDaoImpl.getQuestionAnswerTitleRelInfo",info);
  61. return businessQuestionAnswerTitleRelInfos;
  62. }
  63. /**
  64. * 修改问卷题目关系信息
  65. * @param info 修改信息
  66. * @throws DAOException DAO异常
  67. */
  68. @Override
  69. public int updateQuestionAnswerTitleRelInfo(Map info) throws DAOException {
  70. logger.debug("修改 updateQuestionAnswerTitleRelInfo 入参 info : {}",info);
  71. int saveFlag = sqlSessionTemplate.update("questionAnswerTitleRelV1ServiceDaoImpl.updateQuestionAnswerTitleRelInfo",info);
  72. return saveFlag;
  73. }
  74. /**
  75. * 查询问卷题目关系数量
  76. * @param info 问卷题目关系信息
  77. * @return 问卷题目关系数量
  78. */
  79. @Override
  80. public int queryQuestionAnswerTitleRelsCount(Map info) {
  81. logger.debug("查询 queryQuestionAnswerTitleRelsCount 入参 info : {}",info);
  82. List<Map> businessQuestionAnswerTitleRelInfos = sqlSessionTemplate.selectList("questionAnswerTitleRelV1ServiceDaoImpl.queryQuestionAnswerTitleRelsCount", info);
  83. if (businessQuestionAnswerTitleRelInfos.size() < 1) {
  84. return 0;
  85. }
  86. return Integer.parseInt(businessQuestionAnswerTitleRelInfos.get(0).get("count").toString());
  87. }
  88. }