package com.xunhong.erp.turbo.user.app.executor.cmd;

import com.xunhong.erp.turbo.api.user.dto.cmd.EmployeeUpdateCmd;
import com.xunhong.erp.turbo.api.user.dto.vo.EmployeeVO;
import com.xunhong.erp.turbo.user.app.assembler.EmployeeAssembler;
import com.xunhong.erp.turbo.user.domain.entity.Employee;
import com.xunhong.erp.turbo.user.domain.gateway.EmployeeGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author shenyifei
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class EmployeeUpdateCmdExe {

	private final EmployeeAssembler employeeAssembler;
	private final EmployeeGateway employeeGateway;

	public EmployeeVO execute(EmployeeUpdateCmd employeeUpdateCmd) {
		Employee employee = employeeGateway.update(employeeUpdateCmd);
		return employeeAssembler.toEmployeeVO(employee);
	}
}
