DictV1ServiceDaoImpl.java 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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.dev.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.dev.dao.IDictV1ServiceDao;
  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 2022-07-06 20:03:58 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("dictV1ServiceDaoImpl")
  38. public class DictV1ServiceDaoImpl extends BaseServiceDao implements IDictV1ServiceDao {
  39. private static Logger logger = LoggerFactory.getLogger(DictV1ServiceDaoImpl.class);
  40. /**
  41. * 保存字典表信息 到 instance
  42. * @param info bId 信息
  43. * @throws DAOException DAO异常
  44. */
  45. @Override
  46. public int saveDictInfo(Map info) throws DAOException {
  47. logger.debug("保存 saveDictInfo 入参 info : {}",info);
  48. int saveFlag = sqlSessionTemplate.insert("dictV1ServiceDaoImpl.saveDictInfo",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> getDictInfo(Map info) throws DAOException {
  59. logger.debug("查询 getDictInfo 入参 info : {}",info);
  60. List<Map> businessDictInfos = sqlSessionTemplate.selectList("dictV1ServiceDaoImpl.getDictInfo",info);
  61. return businessDictInfos;
  62. }
  63. /**
  64. * 修改字典表信息
  65. * @param info 修改信息
  66. * @throws DAOException DAO异常
  67. */
  68. @Override
  69. public int updateDictInfo(Map info) throws DAOException {
  70. logger.debug("修改 updateDictInfo 入参 info : {}",info);
  71. int saveFlag = sqlSessionTemplate.update("dictV1ServiceDaoImpl.updateDictInfo",info);
  72. return saveFlag;
  73. }
  74. /**
  75. * 修改字典表信息
  76. * @param info 修改信息
  77. * @throws DAOException DAO异常
  78. */
  79. @Override
  80. public int deleteDictInfo(Map info) throws DAOException {
  81. logger.debug("修改 deleteDictInfo 入参 info : {}",info);
  82. int saveFlag = sqlSessionTemplate.update("dictV1ServiceDaoImpl.deleteDictInfo",info);
  83. return saveFlag;
  84. }
  85. /**
  86. * 查询字典表数量
  87. * @param info 字典表信息
  88. * @return 字典表数量
  89. */
  90. @Override
  91. public int queryDictsCount(Map info) {
  92. logger.debug("查询 queryDictsCount 入参 info : {}",info);
  93. List<Map> businessDictInfos = sqlSessionTemplate.selectList("dictV1ServiceDaoImpl.queryDictsCount", info);
  94. if (businessDictInfos.size() < 1) {
  95. return 0;
  96. }
  97. return Integer.parseInt(businessDictInfos.get(0).get("count").toString());
  98. }
  99. /**
  100. * 查询字典表数量
  101. * @param info 字典表信息
  102. * @return 字典表数量
  103. */
  104. @Override
  105. public int queryDictsAndSpecCount(Map info) {
  106. logger.debug("查询 queryDictsCount 入参 info : {}",info);
  107. List<Map> businessDictInfos = sqlSessionTemplate.selectList("dictV1ServiceDaoImpl.queryDictsAndSpecCount", info);
  108. if (businessDictInfos.size() < 1) {
  109. return 0;
  110. }
  111. return Integer.parseInt(businessDictInfos.get(0).get("count").toString());
  112. }
  113. /**
  114. * 查询字典表信息(instance)
  115. * @param info bId 信息
  116. * @return List<Map>
  117. * @throws DAOException DAO异常
  118. */
  119. @Override
  120. public List<Map> getDictAndSpecInfo(Map info) throws DAOException {
  121. logger.debug("查询 getDictInfo 入参 info : {}",info);
  122. List<Map> businessDictInfos = sqlSessionTemplate.selectList("dictV1ServiceDaoImpl.getDictAndSpecInfo",info);
  123. return businessDictInfos;
  124. }
  125. }