package com.jwipc.sys.client.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jwipc.sys.client.PrintTemplateClient;
import com.jwipc.sys.client.convert.PrintTemplateClientConvert;
import com.jwipc.sys.client.dto.PrintTemplateCDTO;
import com.jwipc.sys.entity.SysPrintTemp;
import com.jwipc.sys.service.ISysPrintTempService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * <p> </p>
 *
 * @author ZhangJie
 * @version 1.0
 * @since JDK 1.8
 */
@Service
@RequiredArgsConstructor
public class PrintTemplateClientImpl implements PrintTemplateClient {
    private final ISysPrintTempService printTempService;
    private final PrintTemplateClientConvert printTemplateClientConvert;

    @Override
    public PrintTemplateCDTO getPrintTemplate(String code) {
        final SysPrintTemp one = printTempService.getOne(
                new LambdaQueryWrapper<>(SysPrintTemp.class).eq(SysPrintTemp::getCode, code));

        return printTemplateClientConvert.convert1(one);
    }
}
