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.WxWeappAuditStatus;
import com.iformall.domain.vo.WxWeappAuditStatusVo;
import com.iformall.mapper.WxWeappAuditStatusMapper;
import com.iformall.service.WxWeappAuditStatusService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

@Service
public class WxWeappAuditStatusServiceImpl implements WxWeappAuditStatusService {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
    WxWeappAuditStatusMapper weappAuditStatusMapper;


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

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

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

    @Override
    public WxWeappAuditStatus getById(Long id) {
        return weappAuditStatusMapper.selectByPrimaryKey(id);
    }

    @Override
    public WxWeappAuditStatus getByAppId(String appId) {
        WxWeappAuditStatus statusQ = new WxWeappAuditStatus();
        statusQ.setAppId(appId);
        return weappAuditStatusMapper.selectOne(statusQ);
    }

    @Override
    public void saveStatus(WxWeappAuditStatus record) {
        logger.info("AUDIT: " + record.toString());
        weappAuditStatusMapper.insertSelective(record);
    }

    @Override
    public void updateStatus(WxWeappAuditStatus record) {
        logger.info("AUDIT: " + record.toString());
        weappAuditStatusMapper.updateByPrimaryKeySelective(record);
    }

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