package com.iformall.service.impl;

import java.util.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxGroup;
import com.iformall.mapper.WxGroupMapper;
import com.iformall.service.WxGroupService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WxGroupServiceImpl implements WxGroupService {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
    WxGroupMapper wxGroupMapper;


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

    @Override
    public WxGroup getById(String id) {
        return wxGroupMapper.selectById(id);
    }

    @Override
    public void saveOrUpdate(WxGroup record) {
        if (record.getId() == null) {
            record.setId(UUID.randomUUID().toString().replaceAll("-", ""));
            wxGroupMapper.insert(record);
        } else {
            wxGroupMapper.updateById(record);
        }
    }

    @Override
    public void deleteById(String id) {
        wxGroupMapper.deleteById(id);
    }
    
    
    
    
    
    
    
    
}
