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

import com.xunhong.erp.turbo.api.biz.api.AuditServiceI;
import com.xunhong.erp.turbo.api.biz.dto.cmd.AuditUpdateCmd;
import com.xunhong.erp.turbo.api.biz.dto.qry.AuditPageQry;
import com.xunhong.erp.turbo.api.biz.dto.qry.AuditShowQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.AuditVO;
import com.xunhong.erp.turbo.base.dto.PageDTO;
import com.xunhong.erp.turbo.biz.app.executor.cmd.AuditUpdateCmdExe;
import com.xunhong.erp.turbo.biz.app.executor.query.AuditPageQryExe;
import com.xunhong.erp.turbo.biz.app.executor.query.AuditShowQryExe;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

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

    private final AuditUpdateCmdExe auditUpdateCmdExe;
    private final AuditPageQryExe auditPageQryExe;
    private final AuditShowQryExe auditShowQryExe;

    @Override
    public PageDTO<AuditVO> page(AuditPageQry auditPageQry) {
        return PageDTO.of(auditPageQryExe.execute(auditPageQry));
    }

    @Override
    public AuditVO update(AuditUpdateCmd auditUpdateCmd) {
        return auditUpdateCmdExe.execute(auditUpdateCmd);
    }

    @Override
    public AuditVO show(AuditShowQry auditShowQry) {
        return auditShowQryExe.execute(auditShowQry);
    }
}

