package com.younike.system.service.impl;

import java.util.List;
import java.time.LocalDateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.younike.system.mapper.OrderAddressMapper;
import com.younike.system.domain.OrderAddress;
import com.younike.system.service.IOrderAddressService;

/**
 * 订单服务地址Service业务层处理
 * 
 * @author elev
 * @date 2022-01-07
 */
@Service
public class OrderAddressServiceImpl implements IOrderAddressService {
    @Autowired
    private OrderAddressMapper orderAddressMapper;

    /**
     * 查询订单服务地址
     * 
     * @param orderId 订单服务地址主键
     * @return 订单服务地址
     */
    @Override
    public OrderAddress selectOrderAddressByOrderId(Long orderId) {
        return orderAddressMapper.selectOrderAddressByOrderId(orderId);
    }

    /**
     * 查询订单服务地址列表
     * 
     * @param orderAddress 订单服务地址
     * @return 订单服务地址
     */
    @Override
    public List<OrderAddress> selectOrderAddressList(OrderAddress orderAddress) {
        return orderAddressMapper.selectOrderAddressList(orderAddress);
    }

    /**
     * 新增订单服务地址
     * 
     * @param orderAddress 订单服务地址
     * @return 结果
     */
    @Override
    public int insertOrderAddress(OrderAddress orderAddress) {
        orderAddress.setCreateTime(LocalDateTime.now());
        return orderAddressMapper.insertOrderAddress(orderAddress);
    }

    /**
     * 修改订单服务地址
     * 
     * @param orderAddress 订单服务地址
     * @return 结果
     */
    @Override
    public int updateOrderAddress(OrderAddress orderAddress) {
        orderAddress.setUpdateTime(LocalDateTime.now());
        return orderAddressMapper.updateOrderAddress(orderAddress);
    }

    /**
     * 批量删除订单服务地址
     * 
     * @param orderIds 需要删除的订单服务地址主键
     * @return 结果
     */
    @Override
    public int deleteOrderAddressByOrderIds(Long[] orderIds) {
        return orderAddressMapper.deleteOrderAddressByOrderIds(orderIds);
    }

    /**
     * 删除订单服务地址信息
     * 
     * @param orderId 订单服务地址主键
     * @return 结果
     */
    @Override
    public int deleteOrderAddressByOrderId(Long orderId)
    {
        return orderAddressMapper.deleteOrderAddressByOrderId(orderId);
    }
}
