TdCCustMailingAddressDaoImpl.java
2.53 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
/**
*
*/
package com.zteits.pay.dao.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.zteits.pay.dao.TdCCustMailingAddressDao;
import com.zteits.pay.domain.TdCCustMailingAddress;
import com.zteits.pay.domain.TdCCustMailingAddressExample;
import com.zteits.pay.mapper.TdCCustMailingAddressMapper;
/**
* @author hxz
*
*/
@Component
public class TdCCustMailingAddressDaoImpl implements TdCCustMailingAddressDao {
@Autowired
private TdCCustMailingAddressMapper tdCCustMailingAddressMapper;
@Override
@Transactional
public Long insertCustomerMailingAddressInfo(TdCCustMailingAddress record) {
if (record.getIsDefault().equals("1")) {
TdCCustMailingAddressExample example = new TdCCustMailingAddressExample ();
example.createCriteria().andCustIdEqualTo(record.getCustId());
TdCCustMailingAddress updateRecord = new TdCCustMailingAddress ();
updateRecord.setIsDefault("0");
updateRecord.setCustId(record.getCustId());
tdCCustMailingAddressMapper.updateByExampleSelective(updateRecord, example);
}
return new Long((long)tdCCustMailingAddressMapper.insertSelective(record));
}
@Override
public Boolean deleteCustomerMailingAddressByID(Long id) {
return tdCCustMailingAddressMapper.deleteByPrimaryKey(id) > 0;
}
@Override
@Transactional
public Boolean updateByPrimaryKeySelective(TdCCustMailingAddress record) {
if (record.getIsDefault().equals("1")) {
TdCCustMailingAddressExample example = new TdCCustMailingAddressExample ();
example.createCriteria().andCustIdEqualTo(record.getCustId());
TdCCustMailingAddress updateRecord = new TdCCustMailingAddress ();
updateRecord.setIsDefault("0");
updateRecord.setCustId(record.getCustId());
tdCCustMailingAddressMapper.updateByExampleSelective(updateRecord, example);
}
return tdCCustMailingAddressMapper.updateByPrimaryKeySelective(record) > 0;
}
@Override
public TdCCustMailingAddress queryCustomerMailingAddressById(Long id) {
return tdCCustMailingAddressMapper.selectByPrimaryKey(id);
}
@Override
public List<TdCCustMailingAddress> queryCustMailingAddressInfoList(TdCCustMailingAddressExample example) {
return tdCCustMailingAddressMapper.selectByExample(example);
}
@Override
public Boolean updateByExampleSelective(TdCCustMailingAddress record, TdCCustMailingAddressExample example) {
return tdCCustMailingAddressMapper.updateByExampleSelective(record, example) > 0;
}
}