package com.iformall.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxCLog;
import com.iformall.mapper.WxCLogMapper;
import com.iformall.service.WxCLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iformall.common.IdWorker;

@Service
public class WxCLogServiceImpl implements WxCLogService {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
    WxCLogMapper wxCLogMapper;


    @Override
    public PageInfo<WxCLog> listAsPage(WxCLog record, Integer pageIndex, Integer pageSize) {
        return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCLogMapper.findList(record));
    }

    @Override
    public WxCLog getById(Long id) {
        return wxCLogMapper.selectById(id);
    }

    @Override
    public void saveOrUpdate(WxCLog record) {
        if (record.getId() == null) {
            //record.setId(UUID.randomUUID().toString().replaceAll("-", ""));
            final IdWorker idWorker = IdWorker.get();
        	record.setId(idWorker.nextId());
            wxCLogMapper.insert(record);
        } else {
            wxCLogMapper.updateById(record);
        }
    }

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