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

import com.xunhong.erp.turbo.api.infra.dto.cmd.DictionaryUpdateCmd;
import com.xunhong.erp.turbo.api.infra.dto.vo.DictionaryVO;
import com.xunhong.erp.turbo.infra.app.assembler.DictionaryAssembler;
import com.xunhong.erp.turbo.infra.domain.entity.Dictionary;
import com.xunhong.erp.turbo.infra.domain.gateway.DictionaryGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

	private final DictionaryAssembler dictionaryAssembler;
	private final DictionaryGateway dictionaryGateway;

	public DictionaryVO execute(DictionaryUpdateCmd dictionaryUpdateCmd) {
		Dictionary dictionary = dictionaryGateway.update(dictionaryUpdateCmd);
		return dictionaryAssembler.toDictionaryVO(dictionary);
	}
}
