Blame view

parking-module-park/src/main/java/com/zteits/park/dao/impl/ParkIllegalAreaRelDaoImpl.java 3.31 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
  package com.zteits.park.dao.impl;
  
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
  import com.zteits.clouds.api.apibase.constants.DataStatusEnum;
  import com.zteits.clouds.api.dto.park.param.ParkIllegalAreaRelQueryReq;
  import com.zteits.park.dao.ParkIllegalAreaRelDao;
  import com.zteits.park.domain.ParkIllegalAreaRel;
  import com.zteits.park.domain.ParkIllegalAreaRelExample;
  import com.zteits.park.mapper.ParkIllegalAreaRelMapper;
  import com.zteits.park.mapper.smapper.ParkIllegalAreaRelSMapper;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  
  /**
   * Copyright: Copyright (c) 2019  zteits
   *
   * @ClassName: com.zteits.park.dao.impl
   * @Description:
   * @version: v1.0.0
   * @author: atao
   * @date: 2019-04-02   11:07
   * Modification History:
   * Date         Author          Version      Description
   * ---------------------------------------------------------*
   * 2019-04-02      atao          v1.0.0          创建
   */
  @Component
  public class ParkIllegalAreaRelDaoImpl implements ParkIllegalAreaRelDao {
  
      @Autowired
      private ParkIllegalAreaRelSMapper parkIllegalAreaRelSMapper;
  
      @Autowired
      private ParkIllegalAreaRelMapper parkIllegalAreaRelMapper;
  
      @Override
      public Map<Long, String> ParkIllegalAreaRelByIllegalBaseIds(List<Long> illegalBaseIds) {
  
          Map<Long, String> result = new HashMap<>();
  
          List<Map<String, Object>> list = parkIllegalAreaRelSMapper.ParkIllegalAreaRelByIllegalBaseIds(illegalBaseIds);
  
          if (list != null && !list.isEmpty()) {
              for (Map<String, Object> map1 : list) {
                  Long key = null;
                  String value = null;
                  for (Map.Entry<String, Object> entry : map1.entrySet()) {
                      if ("id".equals(entry.getKey())) {
                          key = (Long)entry.getValue();
                      } else if ("plName".equals(entry.getKey())) {
                          value = (String)entry.getValue();
                      }
                  }
                  result.put(key, value);
              }
          }
  
          return result;
      }
  
      @Override
      public int saveParkIllegalAreaRel(ParkIllegalAreaRel parkIllegalAreaRel) {
  
          parkIllegalAreaRel.setDataState(DataStatusEnum.DATA_STATUS_VALID.value());
          return parkIllegalAreaRelMapper.insertSelective(parkIllegalAreaRel);
      }
  
      @Override
      public int deleteParkIllegalAreaRelByParkIllegalBaseId(Long parkIllegalBaseId) {
  
          ParkIllegalAreaRelExample example = new ParkIllegalAreaRelExample();
          example.createCriteria().andDataStateEqualTo(DataStatusEnum.DATA_STATUS_VALID.value())
              .andParkIllegalBaseIdEqualTo(parkIllegalBaseId);
  
          ParkIllegalAreaRel rel = new ParkIllegalAreaRel();
          rel.setDataState(DataStatusEnum.DATA_STATUS_NO_VALID.value());
          return parkIllegalAreaRelMapper.updateByExampleSelective(rel, example);
      }
  
      @Override
      public List<ParkIllegalAreaRel> queryParkIllegalAreaRel(ParkIllegalAreaRelQueryReq request) {
  
          ParkIllegalAreaRelExample example = new ParkIllegalAreaRelExample();
          example.createCriteria().andDataStateEqualTo(DataStatusEnum.DATA_STATUS_VALID.value())
              .andParkIllegalBaseIdEqualTo(request.getParkIllegalBaseId());
  
          return parkIllegalAreaRelMapper.selectByExample(example);
      }
  }