Blame view

service-community/src/main/java/com/java110/community/dao/impl/CommunityLocationServiceDaoImpl.java 4.62 KB
88e030b7   王彪总   init project
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  package com.java110.community.dao.impl;
  
  import com.alibaba.fastjson.JSONObject;
  import com.java110.utils.constant.ResponseConstant;
  import com.java110.utils.exception.DAOException;
  import com.java110.utils.util.DateUtil;
  import com.java110.core.base.dao.BaseServiceDao;
  import com.java110.community.dao.ICommunityLocationServiceDao;
  import org.slf4j.Logger;
  import com.java110.core.log.LoggerFactory;
  import org.springframework.stereotype.Service;
  import org.springframework.transaction.annotation.Transactional;
  
  import java.util.List;
  import java.util.Map;
  
  /**
9750b443   王彪总   fix(config): 更新配置...
18
   * 项目位置服务 与数据库交互
88e030b7   王彪总   init project
19
20
21
22
23
24
25
26
27
   * Created by wuxw on 2017/4/5.
   */
  @Service("communityLocationServiceDaoImpl")
  //@Transactional
  public class CommunityLocationServiceDaoImpl extends BaseServiceDao implements ICommunityLocationServiceDao {
  
      private static Logger logger = LoggerFactory.getLogger(CommunityLocationServiceDaoImpl.class);
  
      /**
9750b443   王彪总   fix(config): 更新配置...
28
29
       * 项目位置信息封装
       * @param businessCommunityLocationInfo 项目位置信息 封装
88e030b7   王彪总   init project
30
31
32
33
34
35
       * @throws DAOException DAO异常
       */
      @Override
      public void saveBusinessCommunityLocationInfo(Map businessCommunityLocationInfo) throws DAOException {
          businessCommunityLocationInfo.put("month", DateUtil.getCurrentMonth());
          // 查询business_user 数据是否已经存在
9750b443   王彪总   fix(config): 更新配置...
36
          logger.debug("保存项目位置信息 入参 businessCommunityLocationInfo : {}",businessCommunityLocationInfo);
88e030b7   王彪总   init project
37
38
39
          int saveFlag = sqlSessionTemplate.insert("communityLocationServiceDaoImpl.saveBusinessCommunityLocationInfo",businessCommunityLocationInfo);
  
          if(saveFlag < 1){
9750b443   王彪总   fix(config): 更新配置...
40
              throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存项目位置数据失败:"+ JSONObject.toJSONString(businessCommunityLocationInfo));
88e030b7   王彪总   init project
41
42
43
44
45
          }
      }
  
  
      /**
9750b443   王彪总   fix(config): 更新配置...
46
       * 查询项目位置信息
88e030b7   王彪总   init project
47
       * @param info bId 信息
9750b443   王彪总   fix(config): 更新配置...
48
       * @return 项目位置信息
88e030b7   王彪总   init project
49
50
51
52
53
       * @throws DAOException DAO异常
       */
      @Override
      public List<Map> getBusinessCommunityLocationInfo(Map info) throws DAOException {
  
9750b443   王彪总   fix(config): 更新配置...
54
          logger.debug("查询项目位置信息 入参 info : {}",info);
88e030b7   王彪总   init project
55
56
57
58
59
60
61
62
63
  
          List<Map> businessCommunityLocationInfos = sqlSessionTemplate.selectList("communityLocationServiceDaoImpl.getBusinessCommunityLocationInfo",info);
  
          return businessCommunityLocationInfos;
      }
  
  
  
      /**
9750b443   王彪总   fix(config): 更新配置...
64
       * 保存项目位置信息  instance
88e030b7   王彪总   init project
65
66
67
68
69
       * @param info   bId 信息
       * @throws DAOException DAO异常
       */
      @Override
      public void saveCommunityLocationInfoInstance(Map info) throws DAOException {
9750b443   王彪总   fix(config): 更新配置...
70
          logger.debug("保存项目位置信息Instance 入参 info : {}",info);
88e030b7   王彪总   init project
71
72
73
74
  
          int saveFlag = sqlSessionTemplate.insert("communityLocationServiceDaoImpl.saveCommunityLocationInfoInstance",info);
  
          if(saveFlag < 1){
9750b443   王彪总   fix(config): 更新配置...
75
              throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存项目位置信息Instance数据失败:"+ JSONObject.toJSONString(info));
88e030b7   王彪总   init project
76
77
78
79
80
          }
      }
  
  
      /**
9750b443   王彪总   fix(config): 更新配置...
81
       * 查询项目位置信息(instance
88e030b7   王彪总   init project
82
83
84
85
86
87
       * @param info bId 信息
       * @return List<Map>
       * @throws DAOException DAO异常
       */
      @Override
      public List<Map> getCommunityLocationInfo(Map info) throws DAOException {
9750b443   王彪总   fix(config): 更新配置...
88
          logger.debug("查询项目位置信息 入参 info : {}",info);
88e030b7   王彪总   init project
89
90
91
92
93
94
95
96
  
          List<Map> businessCommunityLocationInfos = sqlSessionTemplate.selectList("communityLocationServiceDaoImpl.getCommunityLocationInfo",info);
  
          return businessCommunityLocationInfos;
      }
  
  
      /**
9750b443   王彪总   fix(config): 更新配置...
97
       * 修改项目位置信息
88e030b7   王彪总   init project
98
99
100
101
102
       * @param info 修改信息
       * @throws DAOException DAO异常
       */
      @Override
      public void updateCommunityLocationInfoInstance(Map info) throws DAOException {
9750b443   王彪总   fix(config): 更新配置...
103
          logger.debug("修改项目位置信息Instance 入参 info : {}",info);
88e030b7   王彪总   init project
104
105
106
107
  
          int saveFlag = sqlSessionTemplate.update("communityLocationServiceDaoImpl.updateCommunityLocationInfoInstance",info);
  
          if(saveFlag < 1){
9750b443   王彪总   fix(config): 更新配置...
108
              throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改项目位置信息Instance数据失败:"+ JSONObject.toJSONString(info));
88e030b7   王彪总   init project
109
110
111
112
          }
      }
  
       /**
9750b443   王彪总   fix(config): 更新配置...
113
114
115
       * 查询项目位置数量
       * @param info 项目位置信息
       * @return 项目位置数量
88e030b7   王彪总   init project
116
117
118
       */
      @Override
      public int queryCommunityLocationsCount(Map info) {
9750b443   王彪总   fix(config): 更新配置...
119
          logger.debug("查询项目位置数据 入参 info : {}",info);
88e030b7   王彪总   init project
120
121
122
123
124
125
126
127
128
129
130
  
          List<Map> businessCommunityLocationInfos = sqlSessionTemplate.selectList("communityLocationServiceDaoImpl.queryCommunityLocationsCount", info);
          if (businessCommunityLocationInfos.size() < 1) {
              return 0;
          }
  
          return Integer.parseInt(businessCommunityLocationInfos.get(0).get("count").toString());
      }
  
  
  }