package com.eactive.eai.rms.onl.loader.layout;

import com.eactive.eai.rms.data.entity.onl.layout.LayoutService;
import com.eactive.eai.rms.onl.loader.layout.deploy.LayoutDeploy;
import com.eactive.eai.rms.onl.loader.layout.mapper.LayoutDeployMapper;
import com.eactive.eai.rms.onl.loader.service.DeployService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service("layoutDeployService")
@Transactional
public class LayoutDeployService extends DeployService {

    @Autowired
    private LayoutService layoutService;

    @Autowired
    private LayoutDeployMapper layoutDeployMapper;

    public LayoutDeploy selectDeploy(String loutName) {
        return layoutService.findById(loutName).map(layoutDeployMapper::toVo).orElse(null);
    }

    public void saveDeploy(LayoutDeploy layoutDeploy) {
        deleteAndSave(layoutDeploy, layoutDeployMapper, layoutService);
    }

}
