Blame view

parking-module-pay/src/main/java/com/zteits/pay/dao/impl/ChargerTicketConfigDaoImpl.java 2.77 KB
55f68655   王彪总   新项目
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
  package com.zteits.pay.dao.impl;
  
  import org.apache.commons.collections4.CollectionUtils;
  import org.apache.commons.lang3.StringUtils;
  import com.zteits.clouds.api.apibase.constants.DataStatusEnum;
  import com.zteits.pay.dao.ChargerTicketConfigDao;
  import com.zteits.pay.domain.ChargerTicketBaseConfig;
  import com.zteits.pay.domain.ChargerTicketBaseConfigExample;
  import com.zteits.pay.domain.ChargerTicketConfig;
  import com.zteits.pay.domain.ChargerTicketConfigExample;
  import com.zteits.pay.mapper.ChargerTicketBaseConfigMapper;
  import com.zteits.pay.mapper.ChargerTicketConfigMapper;
  import com.zteits.pay.mapper.smapper.ChargerTicketConfigSMapper;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  
  import java.util.List;
  
  @Component
  public class ChargerTicketConfigDaoImpl implements ChargerTicketConfigDao {
  
      @Autowired
      private ChargerTicketConfigMapper chargerTicketConfigMapper;
      @Autowired
      private ChargerTicketBaseConfigMapper chargerTicketBaseConfigMapper;
      @Autowired
      private ChargerTicketConfigSMapper chargerTicketConfigSMapper;
  
      @Override
      public int bathSaveChargerTicketConfigs(List<ChargerTicketConfig> configs) {
          return chargerTicketConfigSMapper.bathInsertSelective(configs);
      }
  
      @Override
      public List<ChargerTicketConfig> queryChargerTicketConfigsByCondition(ChargerTicketConfig config) {
          ChargerTicketConfigExample example = new ChargerTicketConfigExample();
          ChargerTicketConfigExample.Criteria sql = example.createCriteria();
          sql.andDataStateEqualTo(DataStatusEnum.DATA_STATUS_VALID.value())
                  .andOrgIdEqualTo(config.getOrgId()).andTicketTypeEqualTo(config.getTicketType())
                  .andTicketCategoryEqualTo(config.getTicketCategory());
          if (!StringUtils.isBlank(config.getTicketNo())) {
              sql.andTicketNoEqualTo(config.getTicketNo());
          }
          return chargerTicketConfigMapper.selectByExample(example);
      }
  
      @Override
      public List<ChargerTicketBaseConfig> queryChargerTicketBaseConfigsByCondition(List<String> widgetNos,
                                                                                    Integer ticketType, Integer ticketCategory, Long orgId) {
          ChargerTicketBaseConfigExample example = new ChargerTicketBaseConfigExample();
          ChargerTicketBaseConfigExample.Criteria sql = example.createCriteria();
          sql.andDataStateEqualTo(DataStatusEnum.DATA_STATUS_VALID.value())
                  .andOrgIdEqualTo(orgId).andTicketTypeEqualTo(ticketType)
                  .andTicketCategoryEqualTo(ticketCategory);
          if (CollectionUtils.isNotEmpty(widgetNos)) {
              sql.andWidgetNoIn(widgetNos);
          }
          return chargerTicketBaseConfigMapper.selectByExample(example);
      }
  }