package com.rrtx.services.db.service.impl;

import com.rrtx.services.db.entity.OrderInfo;
import com.rrtx.services.db.mapper.OrderInfoMapper;
import com.rrtx.services.db.service.IOrderInfoService;
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.rrtx.fap.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: OrderInfoServiceImpl<br>
 * Description: IOrderInfoService实现 <br>
 * Company: rrtx
 *
 * @author zhangzz
 * @version v1.0.0    2021-02-02  zhangzz    由Generator自动创建
 */
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo> implements IOrderInfoService {

    @Autowired
    private OrderInfoMapper orderInfoMapper;

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

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

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void createOrderInfo(OrderInfo orderInfo) {
        this.save(orderInfo);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateOrderInfo(OrderInfo orderInfo) {
        this.saveOrUpdate(orderInfo);
    }

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