ParkFreeBerthDaoImpl.java
3.75 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
93
94
95
96
97
98
99
100
101
102
package com.zteits.park.dao.impl;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.clouds.common.cache.park.ParkFreeBerthsCacheUtil;
import com.xiaoleilu.hutool.util.CollectionUtil;
import com.zteits.clouds.api.apibase.constants.DataStatusEnum;
import com.zteits.clouds.api.dto.govclouds.param.UserAreaInfo;
import com.zteits.park.dao.ParkFreeBerthDao;
import com.zteits.park.domain.BerthInfoDO;
import com.zteits.park.domain.ParkFreeBerth;
import com.zteits.park.domain.ParkFreeBerthExample;
import com.zteits.park.domain.ParkFreeBerthsCountStatisticByCountryDO;
import com.zteits.park.domain.ZeroBerthParkingLotDO;
import com.zteits.park.mapper.ParkFreeBerthMapper;
import com.zteits.park.mapper.smapper.ParkFreeBerthSMapper;
/**
* Copyright: Copyright (c) 2017 zteits
*
* @ClassName: ParkFreeBerthDaoImpl.java
* @Description:
* @version: v1.0.0
* @author: langlw
* @date: 2017年6月1日 下午4:09:17
* Modification History:
* Date Author Version Description
* ---------------------------------------------------------*
* 2017年6月1日 langlw v1.0.0 创建
*/
@Component
public class ParkFreeBerthDaoImpl implements ParkFreeBerthDao {
@Autowired
private ParkFreeBerthMapper parkFreeBerthMapper;
@Autowired
private ParkFreeBerthSMapper parkFreeBerthSMapper;
@Override
public Boolean deleteParkFreeBerth(List<String> plNos,Long opId) {
ParkFreeBerthExample example = new ParkFreeBerthExample();
example.createCriteria().andPlNoIn(plNos)
.andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
ParkFreeBerth record = new ParkFreeBerth();
record.setDataStatus(DataStatusEnum.DATA_STATUS_NO_VALID.value());
record.setModifyTime(new Date());
parkFreeBerthMapper.updateByExampleSelective(record, example);
//删除缓存
plNos.forEach(plNo->ParkFreeBerthsCacheUtil.deleteParkFreeBerths(plNo));
return true;
}
@Override
public List<ParkFreeBerthsCountStatisticByCountryDO> StatisticParkFreeBerthsCountByCountry(Long cityId,Integer state) {
return parkFreeBerthSMapper.StatisticParkFreeBerthsCountByCountry(cityId,state);
}
@Override
public List<ParkFreeBerth> queryFreeBerthByPlno(List<String> plnos) {
ParkFreeBerthExample example = new ParkFreeBerthExample();
ParkFreeBerthExample.Criteria criteria = example.createCriteria();
criteria.andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
if(CollectionUtil.isNotEmpty(plnos)){
criteria.andPlNoIn(plnos);
}
return parkFreeBerthMapper.selectByExample(example );
}
@Override
public long queryAllFreeBerthNum(List<String> plnos) {
if (CollectionUtil.isEmpty(plnos)) {
return 0;
}
return parkFreeBerthSMapper.queryAllFreeBerthNum(plnos);
}
@Override
public BerthInfoDO getParkingBerthInfo(List<UserAreaInfo> userAreaInfoList) {
return parkFreeBerthSMapper.getParkingBerthInfo(userAreaInfoList);
}
@Override
public List<ZeroBerthParkingLotDO> getZeroBerthParkinglotList(List<UserAreaInfo> userAreaInfoList) {
return parkFreeBerthSMapper.getZeroBerthParkinglotList(userAreaInfoList);
}
@Override
public Integer updateParkVipFreeBerth(ParkFreeBerth parkFreeBerth) {
ParkFreeBerth parkFreeBerthU = new ParkFreeBerth();
parkFreeBerthU.setId(parkFreeBerth.getId());
parkFreeBerthU.setVipFreeBerth(parkFreeBerth.getVipFreeBerth());
parkFreeBerthU.setTmpFreeBerth(parkFreeBerth.getTmpFreeBerth());
return parkFreeBerthMapper.updateByPrimaryKeySelective(parkFreeBerthU);
}
}