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

import com.xunhong.erp.turbo.api.biz.api.SupplierServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.SupplierCreateCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.SupplierDestroyCmd;
import com.xunhong.erp.turbo.api.biz.dto.cmd.SupplierUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.SupplierCheckQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.SupplierListQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.SupplierPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.SupplierShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.SupplierVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import com.xunhong.erp.turbo.biz.app.executor.cmd.SupplierCreateCmdExe;
import com.xunhong.erp.turbo.biz.app.executor.cmd.SupplierDestroyCmdExe;
import com.xunhong.erp.turbo.biz.app.executor.cmd.SupplierUpdateCmdExe;
import com.xunhong.erp.turbo.biz.app.executor.query.SupplierCheckQryExe;
import com.xunhong.erp.turbo.biz.app.executor.query.SupplierListQryExe;
import com.xunhong.erp.turbo.biz.app.executor.query.SupplierPageQryExe;
import com.xunhong.erp.turbo.biz.app.executor.query.SupplierShowQryExe;
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 = SupplierServiceI.class, version = "1.0.0")
@RequiredArgsConstructor
public class SupplierServiceImpl implements SupplierServiceI {

	private final SupplierCreateCmdExe supplierCreateCmdExe;
	private final SupplierUpdateCmdExe supplierUpdateCmdExe;
	private final SupplierPageQryExe supplierPageQryExe;
	private final SupplierListQryExe supplierListQryExe;
	private final SupplierShowQryExe supplierShowQryExe;
	private final SupplierDestroyCmdExe supplierDestroyCmdExe;
	private final SupplierCheckQryExe supplierCheckQryExe;

	@Override
	public SupplierVO create(SupplierCreateCmd supplierCreateCmd) {
		return supplierCreateCmdExe.execute(supplierCreateCmd);
	}

	@Override
	public PageDTO<SupplierVO> page(SupplierPageQry supplierPageQry) {
		return PageDTO.of(supplierPageQryExe.execute(supplierPageQry));
	}

	@Override
	public List<SupplierVO> list(SupplierListQry supplierListQry) {
		return supplierListQryExe.execute(supplierListQry);
	}

	@Override
	public SupplierVO update(SupplierUpdateCmd supplierUpdateCmd) {
		return supplierUpdateCmdExe.execute(supplierUpdateCmd);
	}

	@Override
	public SupplierVO show(SupplierShowQry supplierShowQry) {
		return supplierShowQryExe.execute(supplierShowQry);
	}

	@Override
	public void destroy(SupplierDestroyCmd supplierDestroyCmd) {
		supplierDestroyCmdExe.execute(supplierDestroyCmd);
	}

	@Override
	public SupplierVO checkSupplier(SupplierCheckQry supplierCheckQry) {
		return supplierCheckQryExe.execute(supplierCheckQry);
	}
}

