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.SysCustomerMapper;
import com.op.wms.domain.SysCustomer;
import com.op.wms.service.ISysCustomerService;

/**
 * 客户管理Service业务层处理
 * 
 * @author Open Platform
 * @date 2023-07-18
 */
@Service
public class SysCustomerServiceImpl implements ISysCustomerService {
	@Autowired
	private SysCustomerMapper sysCustomerMapper;

	/**
	 * 查询客户管理
	 * 
	 * @param clientId 客户管理主键
	 * @return 客户管理
	 */
	@Override
	@DS("#header.poolName")
	public SysCustomer selectSysCustomerByClientId(Long clientId) {
		return sysCustomerMapper.selectSysCustomerByClientId(clientId);
	}

	/**
	 * 查询客户管理列表
	 * 
	 * @param sysCustomer 客户管理
	 * @return 客户管理
	 */
	@Override
	@DS("#header.poolName")
	public List<SysCustomer> selectSysCustomerList(SysCustomer sysCustomer) {
		return sysCustomerMapper.selectSysCustomerList(sysCustomer);
	}

	/**
	 * 新增客户管理
	 * 
	 * @param sysCustomer 客户管理
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int insertSysCustomer(SysCustomer sysCustomer) {
		sysCustomer.setCreateTime(DateUtils.getNowDate());
		sysCustomer.setCreateBy(SecurityUtils.getUsername());
		return sysCustomerMapper.insertSysCustomer(sysCustomer);
	}

	/**
	 * 修改客户管理
	 * 
	 * @param sysCustomer 客户管理
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int updateSysCustomer(SysCustomer sysCustomer) {
		sysCustomer.setUpdateTime(DateUtils.getNowDate());
		sysCustomer.setUpdateBy(SecurityUtils.getUsername());
		return sysCustomerMapper.updateSysCustomer(sysCustomer);
	}

	/**
	 * 批量删除客户管理
	 * 
	 * @param clientIds 需要删除的客户管理主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteSysCustomerByClientIds(Long[] clientIds) {
		return sysCustomerMapper.deleteSysCustomerByClientIds(clientIds);
	}

	/**
	 * 删除客户管理信息
	 * 
	 * @param clientId 客户管理主键
	 * @return 结果
	 */
	@Override
	@DS("#header.poolName")
	public int deleteSysCustomerByClientId(Long clientId) {
		return sysCustomerMapper.deleteSysCustomerByClientId(clientId);
	}
}
