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 com.op.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.wms.mapper.BaseSupplierMapper;
import com.op.wms.domain.BaseSupplier;
import com.op.wms.service.IBaseSupplierService;

/**
 * 供应商管理Service业务层处理
 * 
 * @author Open Platform
 * @date 2023-07-18
 */
@Service
public class BaseSupplierServiceImpl implements IBaseSupplierService {
	@Autowired
	private BaseSupplierMapper baseSupplierMapper;

	/**
	 * 查询供应商管理
	 * 
	 * @param supplierId 供应商管理主键
	 * @return 供应商管理
	 */
	@Override
	@DS("#header.poolName")
	public BaseSupplier selectBaseSupplierBySupplierId(String supplierId) {
		return baseSupplierMapper.selectBaseSupplierBySupplierId(supplierId);
	}

	/**
	 * 查询供应商管理列表
	 * 
	 * @param baseSupplier 供应商管理
	 * @return 供应商管理
	 */
	@Override
	@DS("#header.poolName")
	public List<BaseSupplier> selectBaseSupplierList(BaseSupplier baseSupplier) {
		return baseSupplierMapper.selectBaseSupplierList(baseSupplier);
	}

	/**
	 * 新增供应商管理
	 * 
	 * @param baseSupplier 供应商管理
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int insertBaseSupplier(BaseSupplier baseSupplier) {
		baseSupplier.setCreateTime(DateUtils.getNowDate());
		baseSupplier.setCreateBy(SecurityUtils.getUsername());
		return baseSupplierMapper.insertBaseSupplier(baseSupplier);
	}

	/**
	 * 修改供应商管理
	 * 
	 * @param baseSupplier 供应商管理
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int updateBaseSupplier(BaseSupplier baseSupplier) {
		baseSupplier.setUpdateTime(DateUtils.getNowDate());
		baseSupplier.setUpdateBy(SecurityUtils.getUsername());
		return baseSupplierMapper.updateBaseSupplier(baseSupplier);
	}

	/**
	 * 批量删除供应商管理
	 * 
	 * @param supplierIds 需要删除的供应商管理主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteBaseSupplierBySupplierIds(String[] supplierIds) {
		return baseSupplierMapper.deleteBaseSupplierBySupplierIds(supplierIds);
	}

	/**
	 * 删除供应商管理信息
	 * 
	 * @param supplierId 供应商管理主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteBaseSupplierBySupplierId(String supplierId) {
		return baseSupplierMapper.deleteBaseSupplierBySupplierId(supplierId);
	}
}
