package com.op.wms.service.impl;

import java.util.List;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.wms.mapper.BaseEquipmentProductMapper;
import com.op.wms.domain.BaseEquipmentProduct;
import com.op.wms.service.IBaseEquipmentProductService;

/**
 * 设备绑定产品Service业务层处理
 * 
 * @author Open Platform
 * @date 2023-07-20
 */
@Service
public class BaseEquipmentProductServiceImpl implements IBaseEquipmentProductService {
	@Autowired
	private BaseEquipmentProductMapper baseEquipmentProductMapper;

	/**
	 * 查询设备绑定产品
	 * 
	 * @param equipmentId 设备绑定产品主键
	 * @return 设备绑定产品
	 */
	@Override
	@DS("#header.poolName")
	public BaseEquipmentProduct selectBaseEquipmentProductByEquipmentId(Long equipmentId) {
		return baseEquipmentProductMapper.selectBaseEquipmentProductByEquipmentId(equipmentId);
	}

	/**
	 * 查询设备绑定产品列表
	 * 
	 * @param baseEquipmentProduct 设备绑定产品
	 * @return 设备绑定产品
	 */
	@Override
	@DS("#header.poolName")
	public List<BaseEquipmentProduct> selectBaseEquipmentProductList(BaseEquipmentProduct baseEquipmentProduct) {
		return baseEquipmentProductMapper.selectBaseEquipmentProductList(baseEquipmentProduct);
	}

	/**
	 * 新增设备绑定产品
	 * 
	 * @param baseEquipmentProduct 设备绑定产品
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int insertBaseEquipmentProduct(BaseEquipmentProduct baseEquipmentProduct) {
		baseEquipmentProduct.setCreateTime(DateUtils.getNowDate());
		return baseEquipmentProductMapper.insertBaseEquipmentProduct(baseEquipmentProduct);
	}

	/**
	 * 修改设备绑定产品
	 * 
	 * @param baseEquipmentProduct 设备绑定产品
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int updateBaseEquipmentProduct(BaseEquipmentProduct baseEquipmentProduct) {
		baseEquipmentProduct.setUpdateTime(DateUtils.getNowDate());
		return baseEquipmentProductMapper.updateBaseEquipmentProduct(baseEquipmentProduct);
	}

	/**
	 * 批量删除设备绑定产品
	 * 
	 * @param equipmentIds 需要删除的设备绑定产品主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteBaseEquipmentProductByEquipmentIds(Long[] equipmentIds) {
		return baseEquipmentProductMapper.deleteBaseEquipmentProductByEquipmentIds(equipmentIds);
	}

	/**
	 * 删除设备绑定产品信息
	 * 
	 * @param equipmentId 设备绑定产品主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteBaseEquipmentProductByEquipmentId(Long equipmentId) {
		return baseEquipmentProductMapper.deleteBaseEquipmentProductByEquipmentId(equipmentId);
	}
}
