XcCarChargeAuditDaoImpl.java
4.03 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
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.QueryXcCarChargeAuditPageRequest;
import com.zteits.park.dao.XcCarChargeAuditDao;
import com.zteits.park.domain.XcCarChargeAudit;
import com.zteits.park.domain.XcCarChargeAuditExample;
import com.zteits.park.mapper.XcCarChargeAuditMapper;
import com.zteits.park.mapper.smapper.XcCarChargeAuditSMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
/**
* 车辆收费审核Dao实现类
*/
@Component
public class XcCarChargeAuditDaoImpl implements XcCarChargeAuditDao {
@Autowired
private XcCarChargeAuditMapper xcCarChargeAuditMapper;
@Autowired
private XcCarChargeAuditSMapper xcCarChargeAuditSMapper;
@Override
public int updateByPrimaryKeySelective(XcCarChargeAudit record) {
return xcCarChargeAuditMapper.updateByPrimaryKeySelective(record);
}
@Override
public List<XcCarChargeAudit> selectByExample(XcCarChargeAuditExample example) {
return xcCarChargeAuditMapper.selectByExample(example);
}
@Override
public XcCarChargeAudit selectByPrimaryKey(Long id) {
return xcCarChargeAuditMapper.selectByPrimaryKey(id);
}
@Override
public long countByExample(XcCarChargeAuditExample example) {
return xcCarChargeAuditMapper.countByExample(example);
}
@Override
public int updateByExampleSelective(XcCarChargeAudit record, XcCarChargeAuditExample example) {
return xcCarChargeAuditMapper.updateByExampleSelective(record, example);
}
@Override
public int saveXcCarChargeAudit(XcCarChargeAudit xcCarChargeAudit) {
if (xcCarChargeAudit.getCreateTime() == null) {
xcCarChargeAudit.setCreateTime(new Date());
}
xcCarChargeAudit.setDataState(DataStatusEnum.DATA_STATUS_VALID.value());
return xcCarChargeAuditMapper.insertSelective(xcCarChargeAudit);
}
@Override
public int updateAuditStatusBatch(List<Long> ids, Byte auditStatus, String auditor) {
XcCarChargeAudit updateAudit = new XcCarChargeAudit();
updateAudit.setAuditStatus(auditStatus);
updateAudit.setAuditTime(new Date());
updateAudit.setAuditor(auditor);
XcCarChargeAuditExample updateExample = new XcCarChargeAuditExample();
updateExample.createCriteria().andIdIn(ids).andDataStateEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
return xcCarChargeAuditMapper.updateByExampleSelective(updateAudit, updateExample);
}
@Override
public int deleteByPrimaryKey(Long id, String opId, String opName) {
XcCarChargeAudit updateAudit = new XcCarChargeAudit();
updateAudit.setDataState(DataStatusEnum.DATA_STATUS_NO_VALID.value()); // 设置为无效状态,实现逻辑删除
XcCarChargeAuditExample updateExample = new XcCarChargeAuditExample();
updateExample.createCriteria().andIdEqualTo(id).andDataStateEqualTo(DataStatusEnum.DATA_STATUS_VALID.value());
return xcCarChargeAuditMapper.updateByExampleSelective(updateAudit, updateExample);
}
@Override
public PageInfo<XcCarChargeAudit> queryXcCarChargeAuditForPage(QueryXcCarChargeAuditPageRequest request) {
PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
List<XcCarChargeAudit> xcCarChargeAudits = xcCarChargeAuditSMapper.queryXcCarChargeAuditForPage(request);
return new PageInfo<>(xcCarChargeAudits);
}
@Override
public XcCarChargeAudit queryLastXcCarChargeAuditByCarNumber(String carNumber) {
QueryXcCarChargeAuditPageRequest request = new QueryXcCarChargeAuditPageRequest();
request.setCarNumber(carNumber);
List<XcCarChargeAudit> audits = xcCarChargeAuditSMapper.queryXcCarChargeAuditForPage(request);
return audits.isEmpty() ? null : audits.get(0);
}
}