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.SysFactoryMapper;
import com.op.wms.domain.SysFactory;
import com.op.wms.service.ISysFactoryService;

/**
 * 工厂模型Service业务层处理
 * 
 * @author Open Platform
 * @date 2023-07-03
 */
@Service
public class SysFactoryServiceImpl implements ISysFactoryService {
	@Autowired
	private SysFactoryMapper sysFactoryMapper;

	/**
	 * 查询工厂模型
	 * 
	 * @param factoryId 工厂模型主键
	 * @return 工厂模型
	 */
	@Override
	@DS("#header.poolName")
	public SysFactory selectSysFactoryByFactoryId(Long factoryId) {
		return sysFactoryMapper.selectSysFactoryByFactoryId(factoryId);
	}

	/**
	 * 查询工厂模型列表
	 * 
	 * @param sysFactory 工厂模型
	 * @return 工厂模型
	 */
	@Override
	@DS("#header.poolName")
	public List<SysFactory> selectSysFactoryList(SysFactory sysFactory) {
		return sysFactoryMapper.selectSysFactoryList(sysFactory);
	}

	/**
	 * 新增工厂模型
	 * 
	 * @param sysFactory 工厂模型
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int insertSysFactory(SysFactory sysFactory) {
		sysFactory.setCreateTime(DateUtils.getNowDate());
		sysFactory.setCreateBy(SecurityUtils.getUsername());
		return sysFactoryMapper.insertSysFactory(sysFactory);
	}

	/**
	 * 修改工厂模型
	 * 
	 * @param sysFactory 工厂模型
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int updateSysFactory(SysFactory sysFactory) {
		sysFactory.setUpdateTime(DateUtils.getNowDate());
		sysFactory.setUpdateBy(SecurityUtils.getUsername());
		return sysFactoryMapper.updateSysFactory(sysFactory);
	}

	/**
	 * 批量删除工厂模型
	 * 
	 * @param factoryIds 需要删除的工厂模型主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteSysFactoryByFactoryIds(Long[] factoryIds) {
		return sysFactoryMapper.deleteSysFactoryByFactoryIds(factoryIds);
	}

	/**
	 * 删除工厂模型信息
	 * 
	 * @param factoryId 工厂模型主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteSysFactoryByFactoryId(Long factoryId) {
		return sysFactoryMapper.deleteSysFactoryByFactoryId(factoryId);
	}
}
