TpPEqpGatewayDaoImpl.java
3.83 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
103
104
105
package com.zteits.park.dao.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
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.dto.StaticEqpConutForGatewayDTO;
import com.zteits.clouds.api.dto.park.param.TpPEqpGatewayRequest;
import com.zteits.park.dao.TpPEqpGatewayDao;
import com.zteits.park.domain.TpPEqpGateway;
import com.zteits.park.domain.TpPEqpGatewayExample;
import com.zteits.park.mapper.TpPEqpGatewayMapper;
import com.zteits.park.mapper.smapper.TpPEqpGatewaySMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class TpPEqpGatewayDaoImpl implements TpPEqpGatewayDao {
@Autowired
private TpPEqpGatewayMapper tpPEqpGatewayMapper;
@Autowired
private TpPEqpGatewaySMapper tpPEqpGatewaySMapper;
@Override
public int deleteTpPEqpGatewayByPrimaryKey(Long id, Long opId, String opName) {
TpPEqpGateway record = new TpPEqpGateway();
record.setId(id);
record.setModifyOp(opId);
record.setModifyOpName(opName);
record.setModifyTime(new Date());
record.setDataState(DataStatusEnum.DATA_STATUS_NO_VALID.value());
return tpPEqpGatewayMapper.updateByPrimaryKeySelective(record);
}
@Override
public int saveTpPEqpGateway(TpPEqpGateway tpPEqpGateway) {
if (tpPEqpGateway.getCreateTime() == null) {
tpPEqpGateway.setCreateTime(new Date());
}
if (tpPEqpGateway.getModifyTime() == null) {
tpPEqpGateway.setModifyTime(new Date());
}
return tpPEqpGatewayMapper.insertSelective(tpPEqpGateway);
}
@Override
public int updateByExampleSelective(TpPEqpGateway record, TpPEqpGatewayExample example) {
return tpPEqpGatewayMapper.updateByExampleSelective(record, example);
}
@Override
public int updateByPrimaryKeySelective(TpPEqpGateway record) {
return tpPEqpGatewayMapper.updateByPrimaryKeySelective(record);
}
@Override
public List<TpPEqpGateway> selectByExample(TpPEqpGatewayExample example) {
return tpPEqpGatewayMapper.selectByExample(example);
}
@Override
public TpPEqpGateway queryByPrimaryKey(Long id) {
return tpPEqpGatewayMapper.selectByPrimaryKey(id);
}
@Override
public List<TpPEqpGateway> queryTpPEqpGateway(TpPEqpGatewayRequest request) {
return tpPEqpGatewaySMapper.queryTpPEqpGateway(request);
}
@Override
public int batchDeleteTpPEqpGatewayByPrimaryKey(List<Long> ids, Long opId, String opName) {
TpPEqpGateway record = new TpPEqpGateway();
record.setModifyOp(opId);
record.setModifyOpName(opName);
record.setModifyTime(new Date());
//where条件
TpPEqpGatewayExample example = new TpPEqpGatewayExample();
example.createCriteria().andIdIn(ids);
return tpPEqpGatewayMapper.updateByExampleSelective(record, example);
}
@Override
public PageInfo<TpPEqpGateway> queryTpPEqpGatewayForPage(TpPEqpGatewayRequest request) {
PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
List<TpPEqpGateway> list = tpPEqpGatewaySMapper.queryTpPEqpGateway(request);
if (CollectionUtils.isNotEmpty(list)) {
return new PageInfo<>(list);
}
return new PageInfo<>(new ArrayList<>());
}
@Override
public StaticEqpConutForGatewayDTO statisticEqpCountByCondition(TpPEqpGatewayRequest request) {
StaticEqpConutForGatewayDTO dto = tpPEqpGatewaySMapper.statisticEqpCountByCondition(request);
return dto == null ? new StaticEqpConutForGatewayDTO() : dto;
}
}