package com.yd.dal.service.customer.impl;

import com.yd.dal.entity.customer.AclCustomerMembership;
import com.yd.dal.mapper.customer.AclCustomerMembershipMapper;
import com.yd.dal.service.customer.AclCustomerMembershipDALService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("aclCustomerMembershipDALService")
public class AclCustomerMembershipDALServiceImpl implements AclCustomerMembershipDALService {
    @Resource
    private AclCustomerMembershipMapper aclCustomerMembershipMapper;

    @Override
    public AclCustomerMembership findByOrderId(Long orderId) {
        AclCustomerMembership aclCustomerMembership = new AclCustomerMembership();
        aclCustomerMembership.setOrderId(orderId);
        List<AclCustomerMembership> list = aclCustomerMembershipMapper.selectByCustomerMembership(aclCustomerMembership);
        if (list.isEmpty()){
            return aclCustomerMembership;
        }else {
            return list.get(0);
        }
    }
}
