package com.zcloud.primeport.service;

import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.primeport.api.MkmjPassageServiceI;
import com.zcloud.primeport.command.MkmjPassageAddExe;
import com.zcloud.primeport.command.MkmjPassageRemoveExe;
import com.zcloud.primeport.command.MkmjPassageUpdateExe;
import com.zcloud.primeport.command.query.MkmjPassageQueryExe;
import com.zcloud.primeport.domain.gateway.MkmjPassageGateway;
import com.zcloud.primeport.dto.MkmjPassageAddCmd;
import com.zcloud.primeport.dto.MkmjPassagePageQry;
import com.zcloud.primeport.dto.MkmjPassageUpdateCmd;
import com.zcloud.primeport.dto.clientobject.MkmjPassageCO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
public class MkmjPassageServiceImpl implements MkmjPassageServiceI {
    private final MkmjPassageAddExe mkmjPassageAddExe;
    private final MkmjPassageUpdateExe mkmjPassageUpdateExe;
    private final MkmjPassageRemoveExe mkmjPassageRemoveExe;
    private final MkmjPassageQueryExe mkmjPassageQueryExe;
    private final MkmjPassageGateway mkmjPassageGateway;

    @Override
    public PageResponse<MkmjPassageCO> listPage(MkmjPassagePageQry qry) {
        return mkmjPassageQueryExe.execute(qry);
    }

    @Override
    public SingleResponse add(MkmjPassageAddCmd cmd) {
        mkmjPassageAddExe.execute(cmd);
        return SingleResponse.buildSuccess();
    }

    @Override
    public void edit(MkmjPassageUpdateCmd mkmjPassageUpdateCmd) {
        mkmjPassageUpdateExe.execute(mkmjPassageUpdateCmd);
    }

    @Override
    public void remove(Long id) {
        mkmjPassageRemoveExe.execute(id);
    }

    @Override
    public void removeBatch(Long[] ids) {
        mkmjPassageRemoveExe.execute(ids);
    }

    @Override
    public MkmjPassageCO getInfoById(Long id) {
        return mkmjPassageQueryExe.getInfoById(id);
    }

    @Override
    public Boolean checkName(String passageName, Long mkmjId, Long id) {
        return mkmjPassageGateway.checkName(passageName, mkmjId, id);
    }
}

