Blame view

parking-module-park/src/main/java/com/zteits/park/dao/impl/TpPChargingPileDaoImpl.java 2.89 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
  package com.zteits.park.dao.impl;
  
  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.chargingpile.QueryTpPChargingPileForPageReq;
  import com.zteits.park.dao.TpPChargingPileDao;
  import com.zteits.park.domain.TpPChargingPile;
  import com.zteits.park.domain.TpPChargingPileExample;
  import com.zteits.park.mapper.TpPChargingPileMapper;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  import org.springframework.util.StringUtils;
  
  import java.util.List;
  
  /**
   * Copyright: Copyright (c) 2017  zteits
   *
   * @ClassName: TpPChargingPileDaoImpl.java
   * @Description:
   * @version: v1.0.0
   * @author: wangfs
   * @date: 2019-11-28 15:39
   * Modification History:
   * Date             Author          Version            Description
   * ---------------------------------------------------------*
   * 2019-11-28     wangfs              v1.0.0               创建
   */
  @Component
  public class TpPChargingPileDaoImpl implements TpPChargingPileDao {
  
      @Autowired
      private TpPChargingPileMapper tpPChargingPileMapper;
  
      /**
       * 分页查询充电桩基本信息
       * @Auther: wangfs
       * @param
       * @return
       */
      @Override
      public PageInfo<TpPChargingPile> queryTpPChargingPileForPage(QueryTpPChargingPileForPageReq req) {
          //1.设置分页
          PageHelper.startPage(req.getBaseRequest().getPageNum(),req.getBaseRequest().getPageSize());
          //2.查询数据
          TpPChargingPileExample example = new TpPChargingPileExample();
          TpPChargingPileExample.Criteria sql = example.createCriteria();//
          sql.andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
          sql.andOrgIdEqualTo(req.getOrgId());
          if(!StringUtils.isEmpty(req.getChargingPileNo())){
              sql.andChargingPileNoLike(req.getChargingPileNo());
          }
          if(!StringUtils.isEmpty(req.getPlNo())){
              sql.andPlNoEqualTo(req.getPlNo());
          }
  
          if(!StringUtils.isEmpty(req.getChargingPileName())){
              sql.andChargingPileNameLike(req.getChargingPileName());
          }
  
          if(!StringUtils.isEmpty(req.getChargingType())){
              sql.andChargingTypeEqualTo(req.getChargingType());
          }
  
          if(!StringUtils.isEmpty(req.getChargingStatus())){
              sql.andChargingStatusEqualTo(req.getChargingStatus());
          }
  
          List<TpPChargingPile> tpPChargingPiles = tpPChargingPileMapper.selectByExample(example);
          return new PageInfo<TpPChargingPile> (tpPChargingPiles);
      }
  
      @Override
      public int saveTpPChargingPile(TpPChargingPile record) {
          return tpPChargingPileMapper.insert(record);
      }
  
      @Override
      public int updateTpPChargingPileById(TpPChargingPile record) {
          return tpPChargingPileMapper.updateByPrimaryKeySelective(record);
      }
  }