Blame view

parking-module-system/src/main/java/com/zteits/sys/dao/impl/TbAreaBlockDaoImpl.java 3.37 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
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
  package com.zteits.sys.dao.impl;
  
  import java.util.List;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  
  import org.apache.commons.collections4.CollectionUtils;
  import com.zteits.clouds.api.apibase.constants.AreaTypeEnum;
  import com.zteits.clouds.api.apibase.constants.ErrorType;
  import com.zteits.clouds.api.apibase.exception.BizException;
  import com.zteits.clouds.api.dto.sys.param.CheckBlockNameUniqueRequest;
  import com.zteits.sys.dao.TbAreaBlockDao;
  import com.zteits.sys.domain.TbAreaBlock;
  import com.zteits.sys.mapper.TbAreaBlockMapper;
  import com.zteits.sys.mapper.smapper.TbAreaBlockSmapper;
  
  /**
   * Copyright: Copyright (c) 2017  zteits
   *
   * @ClassName: com.zteits.sys.dao.impl
   * @Description:
   * @version: v1.0.0
   * @author: atao
   * @date: 2017/8/29   下午3:43
   * Modification History:
   * Date         Author          Version      Description
   * ---------------------------------------------------------*
   * 2017/8/29      atao          v1.0.0          创建
   */
  @Component
  public class TbAreaBlockDaoImpl implements TbAreaBlockDao {
  
      @Autowired
      private TbAreaBlockSmapper tbAreaBlockSmapper;
  
      @Autowired
      private TbAreaBlockMapper tbAreaBlockMapper;
  
      @Override
      public List<TbAreaBlock> queryAreaBlockByAreaType(List<Integer> areaTypes,Long orgId) {
          if(CollectionUtils.isEmpty(areaTypes)){
              throw new BizException(ErrorType.PARAMM_NULL,"区块类型");
          }
          if(null == orgId){
              throw new BizException(ErrorType.PARAMM_NULL,"组织ID");
          }
          return tbAreaBlockSmapper.queryAreaBlockByAreaType(areaTypes,orgId);
      }
  
      @Override
      public List<TbAreaBlock> queryTbAreaBlock(TbAreaBlock tbAreaBlock) {
          return tbAreaBlockSmapper.queryTbAreaBlock(tbAreaBlock);
      }
  
      @Override
      public int saveTbAreaBlock(TbAreaBlock tbAreaBlock) {
  
          return tbAreaBlockMapper.insert(tbAreaBlock);
      }
  
      @Override
      public int updateTbAreaBlock(TbAreaBlock tbAreaBlock) {
          return tbAreaBlockMapper.updateByPrimaryKeySelective(tbAreaBlock);
      }
  
      @Override
      public int deleteTbAreaBlock(Long id) {
          return tbAreaBlockMapper.deleteByPrimaryKey(id);
      }
  
      @Override
      public List<TbAreaBlock> queryAreaBlockByParentIdAndOrgId(Long parentId, Long orgId) {
          return tbAreaBlockSmapper.queryAreaBlockByParentIdAndOrgId(parentId,orgId);
      }
  
  	@Override
  	public List<TbAreaBlock> queryAreaBlockByBlockId(List<Long> plBlockIds) {
  		return tbAreaBlockSmapper.queryAreaBlockByBlockId(plBlockIds);
  	}
  
    /**
      * 通过操作员ID+组织id查询块信息.<b>
      * @param opId
      * @param orgId
      * @return
      * 2017年12月27日  wangfs.<br/>
      */
  	@Override
  	public List<TbAreaBlock> queryAreaBlockByOpIdAndOrgId(Long opId, Long orgId) {
  		return tbAreaBlockSmapper.queryAreaBlockByOpIdAndOrgId(AreaTypeEnum.BLOCK.code(), opId, orgId);
  	}
  
  	/**
  	 * 检查块名称是否唯一.<br/>
  	 * @param request
  	 * @return
  	 * 2018年1月2日  wangfs.<br/>
  	 */
  	@Override
  	public Boolean checkBlockNameUnique(CheckBlockNameUniqueRequest request) {
  		int selectCounts = 0 ;
  		selectCounts = tbAreaBlockSmapper.checkBlockNameUnique(request);
  		return selectCounts >0 ? true : false;
  	}
  
      @Override
      public List<TbAreaBlock> queryNextLowerLeverByIdForArea(Long id) {
          return tbAreaBlockSmapper.queryNextLowerLeverByIdForArea(id);
      }
  }