Blame view

parking-module-park/src/main/java/com/zteits/park/dao/impl/GuideScreenDaoImpl.java 4.58 KB
9af4a544   王彪总   新项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
  package com.zteits.park.dao.impl;
  
  import java.util.List;
  
  import com.zteits.clouds.api.apibase.constants.DataStatusEnum;
  import com.zteits.clouds.api.dto.park.param.GuideScreenListGeoRequest;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  
  import com.github.pagehelper.PageHelper;
  import com.github.pagehelper.PageInfo;
  import com.xiaoleilu.hutool.util.CollectionUtil;
  import com.zteits.clouds.api.dto.park.param.GuideScreenListByAreaCodesRequest;
  import com.zteits.park.dao.GuideScreenDao;
  import com.zteits.park.domain.GuideScreenGeo;
  import com.zteits.park.domain.GuideScreenLevelStatistics;
  import com.zteits.park.domain.TdGGuideParkRel;
  import com.zteits.park.domain.TdGGuideScreen;
  import com.zteits.park.domain.TdGGuideScreenExample;
  import com.zteits.park.mapper.TdGGuideScreenMapper;
  import com.zteits.park.mapper.smapper.TdGGuideParkRelSMapper;
  import com.zteits.park.mapper.smapper.TdGGuideScreenSMapper;
  
  /**
   * Copyright: Copyright (c) 2017  zteits
   *
   * @ClassName: com.zteits.park.dao.impl
   * @Description:
   * @version: v1.0.0
   * @author: atao
   * @date: 2017/7/3   下午4:30
   * Modification History:
   * Date         Author          Version      Description
   * ---------------------------------------------------------*
   * 2017/7/3      atao          v1.0.0          创建
   */
  @Component
  public class GuideScreenDaoImpl implements GuideScreenDao {
  
      @Autowired
      private TdGGuideScreenSMapper tdGGuideScreenSMapper;
      @Autowired
      private TdGGuideScreenMapper tdGGuideScreenMapper;
      @Autowired
      private TdGGuideParkRelSMapper tdGGuideParkRelSMapper;
  
      @Override
      public PageInfo<TdGGuideScreen> listGuideScreenByAreaCodes(GuideScreenListByAreaCodesRequest request) {
  
          PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
  
          List<TdGGuideScreen> list = tdGGuideScreenSMapper.listGuideScreenByAreaCodes(request);
          return new PageInfo<TdGGuideScreen>(list);
      }
  
      @Override
      public List<GuideScreenLevelStatistics> statisticsGuideScreenLevelByAreaCodes(List<Long> areaCodes,String cityId,
          Integer dataState,Long orgId) {
  
          List<GuideScreenLevelStatistics> result = tdGGuideScreenSMapper.statisticsGuideScreenLevelByAreaCodes(
              areaCodes, cityId,dataState,orgId);
          return result;
      }
  
      @Override
      public List<GuideScreenGeo> listGuideScreenGeo(GuideScreenListGeoRequest request) {
  
          List<GuideScreenGeo> result = tdGGuideScreenSMapper.listGuideScreenGeo(request);
          return result;
      }
  
      @Override
      public List<TdGGuideParkRel> getGuideScreenInfo(String guideNo, Integer dataState) {
          List<TdGGuideParkRel> result = tdGGuideParkRelSMapper.getGuideScreenInfo(guideNo, dataState);
          return result;
      }
  
      @Override
      public TdGGuideScreen getBaseGuideScreenInfo(String guideNo, Integer dataState) {
          TdGGuideScreenExample example = new TdGGuideScreenExample();
          TdGGuideScreenExample.Criteria sql = example.createCriteria();
          sql.andGuideNoEqualTo(guideNo);
          if(dataState!=null){
              sql.andDataStatusEqualTo(dataState);
          }
          List<TdGGuideScreen> tdGGuideScreenList = tdGGuideScreenMapper.selectByExample(example);
          if(CollectionUtil.isNotEmpty(tdGGuideScreenList)){
              return tdGGuideScreenList.get(0);
          }
          return null;
      }
  
      @Override
      public List<TdGGuideScreen> getAllGuideScreenInfo(Long orgId, List<String> guideNos) {
  
          TdGGuideScreenExample example = new TdGGuideScreenExample();
          example.createCriteria().andGuideNoIn(guideNos).andOrgIdEqualTo(orgId)
              .andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
          return tdGGuideScreenMapper.selectByExample(example);
      }
  
      @Override
  	public void deleteALLGuideScreenInfo(List<String> guideNos,Long orgId) {
  		TdGGuideScreenExample example = new TdGGuideScreenExample();
  		example.createCriteria().andGuideNoIn(guideNos).andOrgIdEqualTo(orgId);
  		tdGGuideScreenMapper.deleteByExample(example);
  	}
  
  	@Override
  	public Boolean bathInsertGuideScreens(List<TdGGuideScreen> tdGGuideScreens) {
  		return tdGGuideScreenSMapper.bathInsertGuideScreens(tdGGuideScreens) > 0;
  	}
  
  	@Override
  	public Boolean updateByExampleSelective(TdGGuideScreen tdGGuideScreen) {
  		TdGGuideScreenExample example = new TdGGuideScreenExample();
  		example.createCriteria().andGuideNoEqualTo(tdGGuideScreen.getGuideNo()).andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
  		return tdGGuideScreenMapper.updateByExampleSelective(tdGGuideScreen, example)> 0;
  	}
  
  }