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

import com.huyi.service.base.entity.ZcFinanceContract;
import com.huyi.service.base.mapper.ZcFinanceContractMapper;
import com.huyi.service.base.service.IZcFinanceContractService;
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: ZcFinanceContractServiceImpl<br>
 * Description: IZcFinanceContractService实现 <br>
 * Company: keao
 *
 * @author xuefy
 * @version v1.0.0    2021-08-16  xuefy    由Generator自动创建
 */
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class ZcFinanceContractServiceImpl extends ServiceImpl<ZcFinanceContractMapper, ZcFinanceContract> implements IZcFinanceContractService {

    @Autowired
    private ZcFinanceContractMapper zcFinanceContractMapper;

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

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

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void createZcFinanceContract(ZcFinanceContract zcFinanceContract) {
        this.save(zcFinanceContract);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateZcFinanceContract(ZcFinanceContract zcFinanceContract) {
        this.saveOrUpdate(zcFinanceContract);
    }

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