package com.jeeplus.psimanage.purchase.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.psimanage.oss.domain.PsiWorkAttachment;
import com.jeeplus.psimanage.purchase.domain.PsiMaterialBasic;
import com.jeeplus.psimanage.purchase.service.dto.PsiMaterialInfoDto;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author: 王强
 * @create: 2022-12-02 16:57
 **/
public interface PsiMaterialBasicMapper extends BaseMapper<PsiMaterialBasic> {

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

    List<PsiWorkAttachment> findFileList(@Param("id") String id);

    List<String> findChildIds(String department);

    IPage<PsiMaterialInfoDto> findList(Page<PsiMaterialInfoDto> page, @Param(Constants.WRAPPER) QueryWrapper<PsiMaterialInfoDto> queryWrapper);

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

    String getHandledName(String handledBy);

    /**
     * 根据采购编号查相关数据
     * @param purchaseNo
     * @return
     */
    PsiMaterialBasic getInfoByPurchaseNo(String purchaseNo);

    @InterceptorIgnore(tenantLine = "true")
    PsiMaterialInfoDto getUserNameByUserId(String handledBy);
}
