package com.jeeplus.business.borrow.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeeplus.business.borrow.domain.BorrowMoney;
import com.jeeplus.business.borrow.domain.Refund;
import com.jeeplus.business.borrow.domain.RefundHis;
import com.jeeplus.business.borrow.service.dto.BorrowDTO;
import com.jeeplus.sys.domain.WorkAttachmentInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface BorrowMapper extends BaseMapper<BorrowMoney> {

    IPage<BorrowDTO> findPageList(@Param(Constants.WRAPPER) QueryWrapper<BorrowDTO> queryWrapper, Page<BorrowDTO> page);
    @InterceptorIgnore(tenantLine = "true")
    BorrowDTO findById(@Param("id") String id);

    void updateStatusById(@Param("id") String id, @Param("status") String status);

    void updateRefundById(@Param("id")String id, @Param("status")String status);
    @InterceptorIgnore(tenantLine = "true")
    void updateInfoById(@Param("borrowMoney") BorrowMoney borrowMoney);
    @InterceptorIgnore(tenantLine = "true")
    void updateRefundInfoById(@Param("refundInfo") Refund refundInfo);
    @InterceptorIgnore(tenantLine = "true")
    IPage<BorrowMoney> listByUserId(@Param(Constants.WRAPPER)QueryWrapper<BorrowMoney> queryWrapper, Page<BorrowDTO> page);

    List<Refund> findByBorId(@Param("id") String id);

    RefundHis findHisById(@Param("id")String id);

    RefundHis getByRefundId(@Param("id")String id);

    BorrowDTO getByReId(@Param("id")String id);

    List<WorkAttachmentInfo> findList(@Param("id") String id);

    Integer findIsExit(@Param("id") String id, @Param("name")String name);

    List<WorkAttachmentInfo> findFiles(@Param("id") String id);
}
