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.BaseTeamTMapper;
import com.op.wms.domain.BaseTeamT;
import com.op.wms.service.IBaseTeamTService;

/**
 * 班组Service业务层处理
 * 
 * @author Open Platform
 * @date 2023-07-05
 */
@Service
public class BaseTeamTServiceImpl implements IBaseTeamTService {
	@Autowired
	private BaseTeamTMapper baseTeamTMapper;

	/**
	 * 查询班组
	 * 
	 * @param teamId 班组主键
	 * @return 班组
	 */
	@Override
	@DS("#header.poolName")
	public BaseTeamT selectBaseTeamTByTeamId(String teamId) {
		return baseTeamTMapper.selectBaseTeamTByTeamId(teamId);
	}

	/**
	 * 查询班组列表
	 * 
	 * @param baseTeamT 班组
	 * @return 班组
	 */
	@Override
	@DS("#header.poolName")
	public List<BaseTeamT> selectBaseTeamTList(BaseTeamT baseTeamT) {
		return baseTeamTMapper.selectBaseTeamTList(baseTeamT);
	}

	/**
	 * 新增班组
	 * 
	 * @param baseTeamT 班组
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int insertBaseTeamT(BaseTeamT baseTeamT) {
		baseTeamT.setCreateDate(DateUtils.getNowDate());
		baseTeamT.setCreateBy(SecurityUtils.getUsername());
		return baseTeamTMapper.insertBaseTeamT(baseTeamT);
	}

	/**
	 * 修改班组
	 * 
	 * @param baseTeamT 班组
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int updateBaseTeamT(BaseTeamT baseTeamT) {
		baseTeamT.setLastUpdateDate(DateUtils.getNowDate());
		baseTeamT.setLastUpdateBy(SecurityUtils.getUsername());
		return baseTeamTMapper.updateBaseTeamT(baseTeamT);
	}

	/**
	 * 批量删除班组
	 * 
	 * @param teamIds 需要删除的班组主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteBaseTeamTByTeamIds(String[] teamIds) {
		return baseTeamTMapper.deleteBaseTeamTByTeamIds(teamIds);
	}

	/**
	 * 删除班组信息
	 * 
	 * @param teamId 班组主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteBaseTeamTByTeamId(String teamId) {
		return baseTeamTMapper.deleteBaseTeamTByTeamId(teamId);
	}
}
