package cn.iocoder.yudao.module.jx.service.impl;

import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolBooking;
import cn.iocoder.yudao.module.jx.payment.mapper.DriveSchoolBookingMapper;
import cn.iocoder.yudao.module.jx.service.DriveSchoolBookingService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.thoughtworks.xstream.core.SecurityUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * 预约Service业务层处理
 *
 * @author ruoyi
 * @date 2024-04-25
 */
@Service
public class DriveSchoolBookingServiceImpl implements DriveSchoolBookingService
{
    @Resource
    private DriveSchoolBookingMapper driveSchoolBookingMapper;

    /**
     * 查询预约
     *
     * @param id 预约主键
     * @return 预约
     */
    @Override
    public DriveSchoolBooking selectDriveSchoolBookingById(Long id)
    {
        return driveSchoolBookingMapper.selectDriveSchoolBookingById(id);
    }

    /**
     * 查询预约列表
     *
     * @param driveSchoolBooking 预约
     * @return 预约
     */
    @Override
    public IPage<DriveSchoolBooking> selectDriveSchoolBookingList(DriveSchoolBooking driveSchoolBooking, Page<DriveSchoolBooking> page)
    {
        return driveSchoolBookingMapper.selectDriveSchoolBookingList(driveSchoolBooking,page);
    }

    @Override
    public List<DriveSchoolBooking> listByUser(DriveSchoolBooking driveSchoolBooking) {
        driveSchoolBooking.setUserId(SecurityFrameworkUtils.getLoginUserId());
        return driveSchoolBookingMapper.listByUser(driveSchoolBooking);
    }

    /**
     * 新增预约
     *
     * @param driveSchoolBooking 预约
     * @return 结果
     */
    @Override
    public int insertDriveSchoolBooking(DriveSchoolBooking driveSchoolBooking)
    {
        return driveSchoolBookingMapper.insertDriveSchoolBooking(driveSchoolBooking);
    }

    /**
     * 修改预约
     *
     * @param driveSchoolBooking 预约
     * @return 结果
     */
    @Override
    public int updateDriveSchoolBooking(DriveSchoolBooking driveSchoolBooking)
    {
        return driveSchoolBookingMapper.updateDriveSchoolBooking(driveSchoolBooking);
    }

    /**
     * 批量删除预约
     *
     * @param ids 需要删除的预约主键
     * @return 结果
     */
    @Override
    public int deleteDriveSchoolBookingByIds(Long[] ids)
    {
        return driveSchoolBookingMapper.deleteDriveSchoolBookingByIds(ids);
    }

    /**
     * 删除预约信息
     *
     * @param id 预约主键
     * @return 结果
     */
    @Override
    public int deleteDriveSchoolBookingById(Long id)
    {
        return driveSchoolBookingMapper.deleteDriveSchoolBookingById(id);
    }
}
