package com.huyi.service.base.service.impl;

import com.huyi.service.base.entity.PubVerifyCode;
import com.huyi.service.base.mapper.PubVerifyCodeMapper;
import com.huyi.service.base.service.IPubVerifyCodeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.beans.factory.annotation.Autowired;
import com.keao.tianhu.starter.mybatis.plus.entity.QueryRequest;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;



import java.util.List;

/**
 * ClassName: PubVerifyCodeServiceImpl<br>
 * Description: IPubVerifyCodeService实现 <br>
 * Company: keao
 *
 * @author cuixq
 * @version v1.0.0    2021-08-19  cuixq    由Generator自动创建
 */
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class PubVerifyCodeServiceImpl extends ServiceImpl<PubVerifyCodeMapper, PubVerifyCode> implements IPubVerifyCodeService {

    @Autowired
    private PubVerifyCodeMapper pubVerifyCodeMapper;

    @Override
    public IPage<PubVerifyCode> findPubVerifyCodes(QueryRequest request, LambdaQueryWrapper<PubVerifyCode> wrapper) {
        Page<PubVerifyCode> page = new Page<>(request.getPageNum(), request.getPageSize());
        return this.page(page, wrapper);
    }

    @Override
    public List<PubVerifyCode> findPubVerifyCodes(LambdaQueryWrapper<PubVerifyCode> wrapper) {
		return this.list(wrapper);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void createPubVerifyCode(PubVerifyCode pubVerifyCode) {
        this.save(pubVerifyCode);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updatePubVerifyCode(PubVerifyCode pubVerifyCode) {
        this.saveOrUpdate(pubVerifyCode);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deletePubVerifyCode(LambdaQueryWrapper<PubVerifyCode> wrapper) {
	    this.remove(wrapper);
	}
}
