Blame view

parking-module-park/src/main/java/com/zteits/park/dao/impl/ParkingLotExtendDaoImpl.java 3.8 KB
604bda05   王彪总   1
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 org.apache.commons.collections4.CollectionUtils;
  import com.github.pagehelper.PageHelper;
  import com.github.pagehelper.PageInfo;
  import com.zteits.clouds.api.apibase.constants.DataStatusEnum;
  import com.zteits.clouds.api.dto.park.param.ParkingLotExtendQueryRequest;
  import com.zteits.clouds.api.dto.park.param.ParkingLotExtendRequest;
  import com.zteits.park.dao.ParkingLotExtendDao;
  import com.zteits.park.domain.ParkingLotExtend;
  import com.zteits.park.domain.ParkingLotExtendExample;
  import com.zteits.park.mapper.ParkingLotExtendMapper;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  
  import java.util.ArrayList;
  import java.util.Date;
  import java.util.List;
  
  @Component
  public class ParkingLotExtendDaoImpl implements  ParkingLotExtendDao {
      @Autowired
      private ParkingLotExtendMapper parkingLotExtendMapper;
      @Override
      public int deleteParkingLotExtendByPrimaryKey(Long id, String opId, String opName) {
          ParkingLotExtend record = new ParkingLotExtend();
          record.setId(id);
          record.setDataStatus(DataStatusEnum.DATA_STATUS_NO_VALID.value());
          record.setModifyOp(opId);
          record.setModifyTime(new Date());
          return parkingLotExtendMapper.updateByPrimaryKeySelective(record);
      }
  
      @Override
      public int saveParkingLotExtend(ParkingLotExtend parkingLotExtend) {
          if(parkingLotExtend.getCreateTime()==null){
              parkingLotExtend.setCreateTime(new Date());
          }
          return parkingLotExtendMapper.insertSelective(parkingLotExtend);
      }
  
      @Override
      public int updateByExampleSelective(ParkingLotExtend record, ParkingLotExtendExample example) {
          return parkingLotExtendMapper.updateByExampleSelective(record,example);
      }
  
      @Override
      public int updateByPrimaryKeySelective(ParkingLotExtend record) {
          return parkingLotExtendMapper.updateByPrimaryKeySelective(record);
      }
  
      @Override
      public List<ParkingLotExtend> selectByExample(ParkingLotExtendExample example) {
          return parkingLotExtendMapper.selectByExample(example);
      }
  
      @Override
      public ParkingLotExtend queryByPrimaryKey(Long id) {
          return parkingLotExtendMapper.selectByPrimaryKey(id);
      }
  
      @Override
      public List<ParkingLotExtend> queryParkingLotExtend(ParkingLotExtendQueryRequest request) {
          ParkingLotExtendExample example = new ParkingLotExtendExample();
          example.createCriteria().andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value())
                  .andPlNoIn(request.getPlNos());
          List<ParkingLotExtend> list = parkingLotExtendMapper.selectByExample(example);
          return list;
      }
  
      @Override
      public int batchDeleteParkingLotExtendByPrimaryKey(List<Long> ids, String opId, String opName) {
          ParkingLotExtend record = new ParkingLotExtend();
          //where条件
          ParkingLotExtendExample example = new ParkingLotExtendExample();
          example.createCriteria().andIdIn(ids);
          return parkingLotExtendMapper.updateByExampleSelective(record,example);
      }
  
      @Override
      public PageInfo<ParkingLotExtend> queryParkingLotExtendForPage(ParkingLotExtendQueryRequest request) {
          PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
          ParkingLotExtendExample example = new ParkingLotExtendExample();
          example.createCriteria().andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value())
                  .andPlNoIn(request.getPlNos());
          List<ParkingLotExtend> list = parkingLotExtendMapper.selectByExample(example);
          if (CollectionUtils.isNotEmpty(list)) {
              return new PageInfo<ParkingLotExtend>(list);
          }
          return new PageInfo<ParkingLotExtend>(new ArrayList<ParkingLotExtend>());
      }
  }