package com.chaozhanggui.admin.system.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chaozhanggui.common.system.config.RespBody;
import com.chaozhanggui.dao.system.dao.TbPlussBankCodeSxfMapper;
import com.chaozhanggui.dao.system.dao.TbPlussSxfMccInfoMapper;
import com.chaozhanggui.dao.system.entity.TbPlussSxfMccInfo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author lyf
 */
@Service
public class SxfMccInfoService{
    @Resource
    private TbPlussBankCodeSxfMapper bankCodeSxfMapper;
    @Resource
    private TbPlussSxfMccInfoMapper sxfMccInfoMapper;

    public RespBody pageData(Integer current, Integer size,String keyWord){
        PageHelper.startPage(current,size);
        List<TbPlussSxfMccInfo> list = bankCodeSxfMapper.pageData(keyWord);
        PageInfo pageInfo = new PageInfo(list);
        return new RespBody("000000",pageInfo);
    }
    public TbPlussSxfMccInfo getByMccCode(String mccCode) {
        List<TbPlussSxfMccInfo> sxfMccInfos = sxfMccInfoMapper.selectList(mccCode);

        if (sxfMccInfos == null || sxfMccInfos.size() == 0) {
            return null;
        }

        return sxfMccInfos.get(0);
    }
}
