TbAreaDaoImpl.java
2.57 KB
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.sys.dao.impl;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
import com.zteits.clouds.api.apibase.constants.ErrorType;
import com.zteits.clouds.api.apibase.exception.BizException;
import com.zteits.sys.dao.TbAreaDao;
import com.zteits.sys.domain.TbArea;
import com.zteits.sys.mapper.TbAreaMapper;
import com.zteits.sys.mapper.smapper.TbAreaSMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class TbAreaDaoImpl implements TbAreaDao {
@Autowired
private TbAreaMapper tbAreaMapper;
@Autowired
private TbAreaSMapper tbAreaSMapper;
@Override
public List<TbArea> queryTbArea(TbArea tbArea) {
List<TbArea> areas = tbAreaSMapper.queryTbArea(tbArea);
return areas;
}
@Override
public List<TbArea> queryNextLowerLeverById(Long id) {
List<TbArea> nextLowerLeverArea = tbAreaSMapper.queryNextLowerLeverById(id);
return nextLowerLeverArea;
}
@Override
public List<TbArea> queryProvince() {
return tbAreaSMapper.queryProvince();
}
@Override
public List<TbArea> queryTbAreaByAreaType(List<Integer> areaTypes) {
if (CollectionUtils.isEmpty(areaTypes)) {
throw new BizException(ErrorType.PARAMM_NULL, "区域类型");
}
return tbAreaSMapper.queryTbAreaByAreaType(areaTypes);
}
@Override
public List<TbArea> queryTbAreaByParentId(Long parentId) {
return tbAreaSMapper.queryTbAreaByParentId(parentId);
}
@Override
public TbArea queryTbAreaByTbArea(TbArea tbArea) {
return tbAreaSMapper.queryTbAreaByTbArea(tbArea);
}
/**
* 通过区域类型+父类Ids 查询省份或者地市或者区县.<br/>
* @param parentIds
* @param areaType
* @return
* 2017年12月27日 wangfs.<br/>
*/
@Override
public List<TbArea> queryAreaByParentIdAndAreaType(List<Long> parentIds, Integer areaType) {
List<TbArea> list = new ArrayList<>();
if(!CollectionUtils.isEmpty(parentIds)){
list =tbAreaSMapper.queryAreaByParentIdAndAreaType(parentIds, areaType);
}
return list;
}
@Override
public List<TbArea> queryTbAreaByIdList(List<Long> ids) {
return tbAreaSMapper.queryTbAreaByIdList(ids);
}
@Override
public List<TbArea> queryAreaByIdsAndAreaType(List<Long> ids, Integer areaType) {
return tbAreaSMapper.queryAreaByIdsAndAreaType(ids, areaType);
}
@Override
public TbArea queryTbAreaByAreaId(Long areaId) {
return tbAreaMapper.selectByPrimaryKey(areaId);
}
}