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.BaseLocationMapper;
import com.op.wms.domain.BaseLocation;
import com.op.wms.service.IBaseLocationService;

/**
 * 货位管理Service业务层处理
 * 
 * @author Open Platform
 * @date 2023-07-06
 */
@Service
public class BaseLocationServiceImpl implements IBaseLocationService {
	@Autowired
	private BaseLocationMapper baseLocationMapper;

	/**
	 * 查询货位管理
	 * 
	 * @param locationId 货位管理主键
	 * @return 货位管理
	 */
	@Override
	@DS("#header.poolName")
	public BaseLocation selectBaseLocationByLocationId(String locationId) {
		return baseLocationMapper.selectBaseLocationByLocationId(locationId);
	}

	/**
	 * 查询货位管理列表
	 * 
	 * @param baseLocation 货位管理
	 * @return 货位管理
	 */
	@Override
	@DS("#header.poolName")
	public List<BaseLocation> selectBaseLocationList(BaseLocation baseLocation) {
		return baseLocationMapper.selectBaseLocationList(baseLocation);
	}

	/**
	 * 新增货位管理
	 * 
	 * @param baseLocation 货位管理
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int insertBaseLocation(BaseLocation baseLocation) {
		baseLocation.setCreateTime(DateUtils.getNowDate());
		baseLocation.setCreateBy(SecurityUtils.getUsername());
		return baseLocationMapper.insertBaseLocation(baseLocation);
	}

	/**
	 * 修改货位管理
	 * 
	 * @param baseLocation 货位管理
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int updateBaseLocation(BaseLocation baseLocation) {
		baseLocation.setUpdateTime(DateUtils.getNowDate());
		baseLocation.setUpdateBy(SecurityUtils.getUsername());
		return baseLocationMapper.updateBaseLocation(baseLocation);
	}

	/**
	 * 批量删除货位管理
	 * 
	 * @param locationIds 需要删除的货位管理主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteBaseLocationByLocationIds(String[] locationIds) {
		return baseLocationMapper.deleteBaseLocationByLocationIds(locationIds);
	}

	/**
	 * 删除货位管理信息
	 * 
	 * @param locationId 货位管理主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteBaseLocationByLocationId(String locationId) {
		return baseLocationMapper.deleteBaseLocationByLocationId(locationId);
	}
}
