/** * */ 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 queryCustMailingAddressInfoList(TdCCustMailingAddressExample example) { return tdCCustMailingAddressMapper.selectByExample(example); } @Override public Boolean updateByExampleSelective(TdCCustMailingAddress record, TdCCustMailingAddressExample example) { return tdCCustMailingAddressMapper.updateByExampleSelective(record, example) > 0; } }