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

import cn.iocoder.yudao.module.jx.domain.DriveSchoolSeparate;
import cn.iocoder.yudao.module.jx.mapper.DriveSchoolSeparateMapper;
import cn.iocoder.yudao.module.jx.payment.service.DriveSchoolPayService;
import cn.iocoder.yudao.module.jx.service.IDriveSchoolSeparateService;
import cn.iocoder.yudao.module.jx.utils.DateUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 驾校分账Service业务层处理
 *
 * @author ruoyi
 * @date 2024-05-28
 */
@Service
public class DriveSchoolSeparateServiceImpl implements IDriveSchoolSeparateService
{
    @Autowired
    private DriveSchoolSeparateMapper driveSchoolSeparateMapper;

    @Autowired
    private DriveSchoolPayService driveSchoolPayService;

    /**
     * 查询驾校分账
     *
     * @param id 驾校分账主键
     * @return 驾校分账
     */
    @Override
    public DriveSchoolSeparate selectDriveSchoolSeparateById(Long id)
    {
        return driveSchoolSeparateMapper.selectDriveSchoolSeparateById(id);
    }

    /**
     * 查询驾校分账列表
     *
     * @param driveSchoolSeparate 驾校分账
     * @return 驾校分账
     */
    @Override
    public IPage<DriveSchoolSeparate> selectDriveSchoolSeparateList(DriveSchoolSeparate driveSchoolSeparate, Page<DriveSchoolSeparate> page)
    {
        return driveSchoolSeparateMapper.selectDriveSchoolSeparateList(driveSchoolSeparate,page);
    }

    @Override
    public Map<Object,Object> getAllMoney(DriveSchoolSeparate driveSchoolSeparate)
    {
        HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
        double allMoney = driveSchoolPayService.getAllMoney();
        objectObjectHashMap.put("allMoney",allMoney);
        return objectObjectHashMap;
    }

    /**
     * 新增驾校分账
     *
     * @param driveSchoolSeparate 驾校分账
     * @return 结果
     */
    @Override
    public int insertDriveSchoolSeparate(DriveSchoolSeparate driveSchoolSeparate)
    {
        return driveSchoolSeparateMapper.insertDriveSchoolSeparate(driveSchoolSeparate);
    }

    /**
     * 修改驾校分账
     *
     * @param driveSchoolSeparate 驾校分账
     * @return 结果
     */
    @Override
    public int updateDriveSchoolSeparate(DriveSchoolSeparate driveSchoolSeparate)
    {
        //driveSchoolSeparate.setUpdateTime(DateUtils.getNowDate());
        return driveSchoolSeparateMapper.updateDriveSchoolSeparate(driveSchoolSeparate);
    }

    /**
     * 批量删除驾校分账
     *
     * @param ids 需要删除的驾校分账主键
     * @return 结果
     */
    @Override
    public int deleteDriveSchoolSeparateByIds(Long[] ids)
    {
        return driveSchoolSeparateMapper.deleteDriveSchoolSeparateByIds(ids);
    }

    /**
     * 删除驾校分账信息
     *
     * @param id 驾校分账主键
     * @return 结果
     */
    @Override
    public int deleteDriveSchoolSeparateById(Long id)
    {
        return driveSchoolSeparateMapper.deleteDriveSchoolSeparateById(id);
    }
}
