package com.iformall.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxWeappExtSet;
import com.iformall.mapper.WxWeappExtSetMapper;
import com.iformall.service.WxWeappExtSetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iformall.common.IdWorker;

@Service
public class WxWeappExtSetServiceImpl implements WxWeappExtSetService {
	
	@Autowired
    WxWeappExtSetMapper wxWeappExtSetMapper;


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

    @Override
    public WxWeappExtSet getById(Long id) {
        return wxWeappExtSetMapper.selectByPrimaryKey(id);
    }

    @Override
    public WxWeappExtSet getByObj(WxWeappExtSet record) {
        return wxWeappExtSetMapper.selectOne(record);
    }

    @Override
    public void saveOrUpdate(WxWeappExtSet record) {
        if (record.getId() == null) {
            //record.setId(UUID.randomUUID().toString().replaceAll("-", ""));
            final IdWorker idWorker = IdWorker.get();
        	record.setId(idWorker.nextId());
            wxWeappExtSetMapper.insertSelective(record);
        } else {
            wxWeappExtSetMapper.updateByPrimaryKeySelective(record);
        }
    }

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