gaoluyang
2 天以前 8c65f898ed6e5b0c7a94c792c4562f6ec831dccd
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
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"));
    }
 
}