package com.xunhong.erp.turbo.biz.app.service;

import com.xunhong.erp.turbo.api.biz.api.CompanyServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.CompanyUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.CompanyListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.CompanyPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.CompanyShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.CompanyVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import com.xunhong.erp.turbo.biz.app.executor.cmd.CompanyCreateCmdExe;
import com.xunhong.erp.turbo.biz.app.executor.cmd.CompanyDestroyCmdExe;
import com.xunhong.erp.turbo.biz.app.executor.cmd.CompanyUpdateCmdExe;
import com.xunhong.erp.turbo.biz.app.executor.query.CompanyListQryExe;
import com.xunhong.erp.turbo.biz.app.executor.query.CompanyPageQryExe;
import com.xunhong.erp.turbo.biz.app.executor.query.CompanyShowQryExe;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shenyifei
 */
@Slf4j
@Service
@DubboService(interfaceClass = CompanyServiceI.class, version = "1.0.0")
@RequiredArgsConstructor
public class CompanyServiceImpl implements CompanyServiceI {

	private final CompanyCreateCmdExe companyCreateCmdExe;
	private final CompanyUpdateCmdExe companyUpdateCmdExe;
	private final CompanyPageQryExe companyPageQryExe;
	private final CompanyListQryExe companyListQryExe;
	private final CompanyShowQryExe companyShowQryExe;
	private final CompanyDestroyCmdExe companyDestroyCmdExe;

	@Override
	public CompanyVO create(CompanyCreateCmd companyCreateCmd) {
		return companyCreateCmdExe.execute(companyCreateCmd);
	}

	@Override
	public PageDTO<CompanyVO> page(CompanyPageQry companyPageQry) {
		return PageDTO.of(companyPageQryExe.execute(companyPageQry));
	}

	@Override
	public List<CompanyVO> list(CompanyListQry companyListQry) {
		return companyListQryExe.execute(companyListQry);
	}

	@Override
	public CompanyVO update(CompanyUpdateCmd companyUpdateCmd) {
		return companyUpdateCmdExe.execute(companyUpdateCmd);
	}

	@Override
	public CompanyVO show(CompanyShowQry companyShowQry) {
		return companyShowQryExe.execute(companyShowQry);
	}

	@Override
	public void destroy(CompanyDestroyCmd companyDestroyCmd) {
		companyDestroyCmdExe.execute(companyDestroyCmd);
	}
}

