package org.ta.pddserver.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.ta.pddserver.entity.LottoConfigEntity;
import org.ta.pddserver.lotto.LottoLabelInfo;
import org.ta.pddserver.mapper.LottoConfigMapper;
import org.ta.pddserver.service.LottoConfigService;

@Service
public class LottoConfigImpl extends ServiceImpl<LottoConfigMapper, LottoConfigEntity> implements LottoConfigService {

    public LottoLabelInfo getLottoLabelInfoByPostCode(String postCode){
        LottoConfigEntity lottoConfigEntity = this.baseMapper.findByTag2(postCode);
        if (lottoConfigEntity == null){
            return null;
        }
        LottoLabelInfo info = new LottoLabelInfo();
        info.setPortCode(lottoConfigEntity.getTag4());
        info.setArea1(lottoConfigEntity.getTag3() + " - " + lottoConfigEntity.getTag5());
        info.setArea2("X " + lottoConfigEntity.getTag7() +  " " + lottoConfigEntity.getTag9());
        info.setArea3(lottoConfigEntity.getTag11());
        info.setArea4(lottoConfigEntity.getTag13());
        return info;


    }

}