package sgc.portal.sample.component.service;

import sgc.portal.base.util.EasyHashMap;
import sgc.portal.base.util.QRUtil;
import sgc.portal.sample.component.model.Sample;
import sgc.portal.sample.component.model.Spec;
import sgc.portal.sample.component.persistence.ComSampleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class ComSampleService {

    @Autowired
    private ComSampleMapper comSampleMapper;

    public List<Sample> select() {
        return comSampleMapper.select();
    }

    public List<Spec> selectBigSpec() {
        return comSampleMapper.selectBigSpec();
    }

    public List<Spec> selectMidSpec() {
        return comSampleMapper.selectMidSpec();
    }

    public List<Spec> selectSmlSpec() {
        return comSampleMapper.selectSmlSpec();
    }

    public List<EasyHashMap<String,String>> selectAllCommCd() {
        return comSampleMapper.selectAllCommCd();
    }

    public String qrCodeSample(String text){

        int width = 150;
        int height = 150;

        return QRUtil.makeQRBase64String(text , width , height);
    }

    public String pdf417CodeSample(String text){

        int width = 350;
        int height = 100;

        return QRUtil.makePDF417Base64String(text , width , height);
    }

}
