package com.foreverwin.mesnac.common.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.common.mapper.ExportTemplateMapper;
import com.foreverwin.mesnac.common.model.ExportTemplate;
import com.foreverwin.mesnac.common.service.ExportTemplateService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)
public class ExportTemplateServiceImpl extends ServiceImpl<ExportTemplateMapper, ExportTemplate> implements ExportTemplateService {

    @Override
    public List<ExportTemplate> selectListBySiteCodeLanguage(String site, String code, String language) {
        LambdaQueryWrapper<ExportTemplate> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.eq(ExportTemplate::getSite, site);
        queryWrapper.eq(ExportTemplate::getTemplateCode, code);
        queryWrapper.eq(ExportTemplate::getLanguage, language);
        queryWrapper.orderByAsc(ExportTemplate::getColumnSequence);
        //----------------------------------------------------------------------------------------------------------------------
        return super.list(queryWrapper);
    }
}