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.BaseProductGroupsTMapper;
import com.op.wms.domain.BaseProductGroupsT;
import com.op.wms.service.IBaseProductGroupsTService;

/**
 * 物料分组Service业务层处理
 * 
 * @author Open Platform
 * @date 2023-07-18
 */
@Service
public class BaseProductGroupsTServiceImpl implements IBaseProductGroupsTService {
	@Autowired
	private BaseProductGroupsTMapper baseProductGroupsTMapper;

	/**
	 * 查询物料分组
	 * 
	 * @param pgId 物料分组主键
	 * @return 物料分组
	 */
	@Override
	@DS("#header.poolName")
	public BaseProductGroupsT selectBaseProductGroupsTByPgId(String pgId) {
		return baseProductGroupsTMapper.selectBaseProductGroupsTByPgId(pgId);
	}

	/**
	 * 查询物料分组列表
	 * 
	 * @param baseProductGroupsT 物料分组
	 * @return 物料分组
	 */
	@Override
	@DS("#header.poolName")
	public List<BaseProductGroupsT> selectBaseProductGroupsTList(BaseProductGroupsT baseProductGroupsT) {
		return baseProductGroupsTMapper.selectBaseProductGroupsTList(baseProductGroupsT);
	}

	/**
	 * 新增物料分组
	 * 
	 * @param baseProductGroupsT 物料分组
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int insertBaseProductGroupsT(BaseProductGroupsT baseProductGroupsT) {
		baseProductGroupsT.setCreateTime(DateUtils.getNowDate());
		baseProductGroupsT.setCreateBy(SecurityUtils.getUsername());
		return baseProductGroupsTMapper.insertBaseProductGroupsT(baseProductGroupsT);
	}

	/**
	 * 修改物料分组
	 * 
	 * @param baseProductGroupsT 物料分组
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int updateBaseProductGroupsT(BaseProductGroupsT baseProductGroupsT) {
		baseProductGroupsT.setUpdateTime(DateUtils.getNowDate());
		baseProductGroupsT.setUpdateBy(SecurityUtils.getUsername());
		return baseProductGroupsTMapper.updateBaseProductGroupsT(baseProductGroupsT);
	}

	/**
	 * 批量删除物料分组
	 * 
	 * @param pgIds 需要删除的物料分组主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteBaseProductGroupsTByPgIds(String[] pgIds) {
		return baseProductGroupsTMapper.deleteBaseProductGroupsTByPgIds(pgIds);
	}

	/**
	 * 删除物料分组信息
	 * 
	 * @param pgId 物料分组主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteBaseProductGroupsTByPgId(String pgId) {
		return baseProductGroupsTMapper.deleteBaseProductGroupsTByPgId(pgId);
	}
}
