package com.iformall.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.WxWeappCodeStatus;
import com.iformall.domain.vo.WxWeappCodeStatusVo;
import com.iformall.mapper.WxAuthorizerInfoMapper;
import com.iformall.mapper.WxWeappCodeStatusMapper;
import com.iformall.service.WxWeappCodeStatusService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class WxWeappCodeStatusServiceImpl implements WxWeappCodeStatusService {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
    WxWeappCodeStatusMapper weappCodeStatusMapper;


    @Override
    public PageInfo<WxWeappCodeStatusVo> listAsPage(WxWeappCodeStatusVo record, Integer pageIndex, Integer pageSize) {
        return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> weappCodeStatusMapper.findVoList(record));
    }

    @Override
    public List<WxWeappCodeStatusVo> getList(WxWeappCodeStatusVo record) {
        return weappCodeStatusMapper.findVoList(record);
    }

    @Override
    public List<Map> getVersionList(Integer type) {
        return weappCodeStatusMapper.findUserVersions(type);
    }

    @Override
    public WxWeappCodeStatus getById(Long id) {
        return weappCodeStatusMapper.selectByPrimaryKey(id);
    }

    @Override
    public WxWeappCodeStatus getByAppId(String appId) {
        WxWeappCodeStatus weappCodeStatusQ = new WxWeappCodeStatus();
        weappCodeStatusQ.setAppId(appId);
        return weappCodeStatusMapper.selectOne(weappCodeStatusQ);
    }

    @Override
    public void saveStatus(WxWeappCodeStatus record) {
        logger.info("CODE-COMMIT: " + record.toString());
        weappCodeStatusMapper.insertSelective(record);
    }

    @Override
    public void updateStatus(WxWeappCodeStatus record) {
        logger.info("CODE-COMMIT: " + record.toString());
        weappCodeStatusMapper.updateStatus(record);
    }

    @Override
    public void deleteById(Long id) {
        weappCodeStatusMapper.deleteByPrimaryKey(id);
    }
    
    
    
    
    
    
    
    
}
