package com.iformall.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.PosCouponOrderVerify;
import com.iformall.mapper.PosCouponOrderVerifyMapper;
import com.iformall.service.PosCouponOrderVerifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iformall.common.IdWorker;

import java.util.List;

@Service
public class PosCouponOrderVerifyServiceImpl implements PosCouponOrderVerifyService {
	
	@Autowired
    PosCouponOrderVerifyMapper posCouponOrderVerifyMapper;


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

    @Override
    public List<PosCouponOrderVerify> getList(PosCouponOrderVerify record) {
        return posCouponOrderVerifyMapper.findList(record);
    }

    @Override
    public PosCouponOrderVerify getById(Long id) {
        return posCouponOrderVerifyMapper.selectById(id);
    }

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

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