package cn.iocoder.yudao.module.crm.dal.mysql.customer;
|
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerAddressDO;
|
import org.apache.ibatis.annotations.Mapper;
|
|
import java.util.List;
|
|
/**
|
* CRM 客户收货地址 Mapper
|
*
|
* @author 超级管理员
|
*/
|
@Mapper
|
public interface CrmCustomerAddressMapper extends BaseMapperX<CrmCustomerAddressDO> {
|
|
default List<CrmCustomerAddressDO> selectListByCustomerId(Long customerId) {
|
return selectList(new LambdaQueryWrapperX<CrmCustomerAddressDO>()
|
.eq(CrmCustomerAddressDO::getCustomerId, customerId)
|
.orderByDesc(CrmCustomerAddressDO::getDefaultFlag)
|
.orderByAsc(CrmCustomerAddressDO::getId));
|
}
|
|
default CrmCustomerAddressDO selectDefaultByCustomerId(Long customerId) {
|
return selectOne(new LambdaQueryWrapperX<CrmCustomerAddressDO>()
|
.eq(CrmCustomerAddressDO::getCustomerId, customerId)
|
.eq(CrmCustomerAddressDO::getDefaultFlag, true)
|
.last("LIMIT 1"));
|
}
|
|
}
|