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.SysMachineryMapper;
import com.op.wms.domain.SysMachinery;
import com.op.wms.service.ISysMachineryService;

/**
 * 机台管理Service业务层处理
 * 
 * @author Open Platform
 * @date 2023-07-18
 */
@Service
public class SysMachineryServiceImpl implements ISysMachineryService {
	@Autowired
	private SysMachineryMapper sysMachineryMapper;

	/**
	 * 查询机台管理
	 * 
	 * @param machineryId 机台管理主键
	 * @return 机台管理
	 */
	@Override
	@DS("#header.poolName")
	public SysMachinery selectSysMachineryByMachineryId(Long machineryId) {
		return sysMachineryMapper.selectSysMachineryByMachineryId(machineryId);
	}

	/**
	 * 查询机台管理列表
	 * 
	 * @param sysMachinery 机台管理
	 * @return 机台管理
	 */
	@Override
	@DS("#header.poolName")
	public List<SysMachinery> selectSysMachineryList(SysMachinery sysMachinery) {
		return sysMachineryMapper.selectSysMachineryList(sysMachinery);
	}

	/**
	 * 新增机台管理
	 * 
	 * @param sysMachinery 机台管理
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int insertSysMachinery(SysMachinery sysMachinery) {
		sysMachinery.setCreateTime(DateUtils.getNowDate());
		sysMachinery.setCreateBy(SecurityUtils.getUsername());
		return sysMachineryMapper.insertSysMachinery(sysMachinery);
	}

	/**
	 * 修改机台管理
	 * 
	 * @param sysMachinery 机台管理
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int updateSysMachinery(SysMachinery sysMachinery) {
		sysMachinery.setUpdateTime(DateUtils.getNowDate());
		sysMachinery.setUpdateBy(SecurityUtils.getUsername());
		return sysMachineryMapper.updateSysMachinery(sysMachinery);
	}

	/**
	 * 批量删除机台管理
	 * 
	 * @param machineryIds 需要删除的机台管理主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteSysMachineryByMachineryIds(Long[] machineryIds) {
		return sysMachineryMapper.deleteSysMachineryByMachineryIds(machineryIds);
	}

	/**
	 * 删除机台管理信息
	 * 
	 * @param machineryId 机台管理主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteSysMachineryByMachineryId(Long machineryId) {
		return sysMachineryMapper.deleteSysMachineryByMachineryId(machineryId);
	}
}
