package com.bonus.material.part.mapper;

import com.bonus.common.biz.domain.lease.LeaseOutSign;
import com.bonus.material.ma.domain.PartType;
import com.bonus.material.part.domain.MaPartTypeKeeper;
import com.bonus.material.part.domain.PartLeaseDetails;
import com.bonus.material.part.domain.PartLeaseInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author : 阮世耀
 * @version : 1.0
 * @PackagePath: com.bonus.material.lease.mapper
 * @CreateTime: 2024-12-27  13:20
 * @Description: 配件领用dao层
 */
@Mapper
public interface PartLeaseMapper {

    /**
     * 查询配件领用信息
     * @param id 任务id
     */
    PartLeaseInfo selectPartLeaseInfoById(Long id);

    /**
     * 查询配件领用信息列表
     * @param partLeaseInfo 任务id
     */
    List<PartLeaseInfo> selectPartLeaseInfoList(PartLeaseInfo partLeaseInfo);

    /**
     * 新增配件领用信息
     * @param partLeaseInfo 任务id
     */
    int insertPartLeaseInfo(PartLeaseInfo partLeaseInfo);

    /**
     * 删除配件领用
     * @param ids 任务id
     */
    int removePartLeaseInfoByIds(Long[] ids);

    /**
     * 修改配件领用信息
     * @param partLeaseInfo 任务id
     */
    int updatePartLeaseInfo(PartLeaseInfo partLeaseInfo);

    /**
     * 查询配件领用详情
     * @param partLeaseDetails 任务id
     */
    List<PartLeaseDetails> selectPartLeaseDetailsList(PartLeaseDetails partLeaseDetails);

    /**
     * 新增配件领用详情 -- 批量
     * @param partLeaseDetailsList 领用明细
     */
    int batchPartLeaseDetails(List<PartLeaseDetails> partLeaseDetailsList);

    /**
     * 新增配件领用详情 -- 单条
     * @param leaseDetails 领用明细
     */
    int insertPartLeaseDetails(PartLeaseDetails leaseDetails);

    /**
     * 删除配件领用详情
     * @param ids 任务id
     */
    int removePartLeaseDetailsByIds(Long[] ids);

    /**
     * 查询配件领用树结构列表
     * @param partType
     * @return
     */
    List<PartType> selectPartTreeList(PartType partType);

    /**
     * 根据当前年月获取当前任务的最大序号
     * @param currentYear
     * @param currentMonth
     * @return
     */
    int getMonthMaxOrderByDate(@Param(value = "year") String currentYear,@Param(value = "month") String currentMonth);

    /**
     * 修改领用详情
     * @param partLeaseDetails
     * @return
     */
    int updatePartLeaseDetails(PartLeaseDetails partLeaseDetails);

    /**
     * 根据等级查询领用详情
     * @param partType
     * @return
     */
    PartType selectPartTreeListByLevel(PartType partType);

    /**
     * 修改库存数量
     * @param partLeaseDetails
     * @return
     */
    int updateMaTypeStockNum(PartLeaseDetails partLeaseDetails);

    /**
     * 修改个人库存数量
     * @param partLeaseDetails
     * @return
     */
    int updatePersonStockNum(PartLeaseDetails partLeaseDetails);

    /**
     * 查询个人库存数量
     * @param partLeaseDetails
     * @return
     */
    List<PartLeaseDetails> selectPerson(PartLeaseDetails partLeaseDetails);

    /**
     * 新增个人库存数量
     * @param partLeaseDetails
     * @return
     */
    int insertPersonStockNum(PartLeaseDetails partLeaseDetails);

    /**
     * 修改领用任务状态
     * @param taskId
     * @param status
     * @return
     */
    int updateTaskStatus(@Param("taskId") String taskId,@Param("status") Integer status);

    /**
     * 新增配件库管员配置
     * @param typeKeepers
     * @return
     */
    int insertTypeKeeper(MaPartTypeKeeper typeKeepers);

    /**
     * 删除配件库管员配置
     * @param typeKeeper
     * @return
     */
    int deleteTypeKeeper(MaPartTypeKeeper typeKeeper);

    /**
     * 查询配件库管员配置
     * @param typeKeepers
     * @return
     */
    List<MaPartTypeKeeper> selectTypeKeeperByTypeId(MaPartTypeKeeper typeKeepers);

    /**
     * 查询配件库管关系
     * @param partType
     * @return
     */
    List<PartType> selectUserList(PartType partType);

    /**
     * 获取库存签名id集合
     * @param partLeaseDetails
     * @return
     */
    String selectSignList(PartLeaseDetails partLeaseDetails);

    /**
     * 根据id获取库管签名
     * @param signIdList
     * @return
     */
    List<LeaseOutSign> selectSignListInfo(@Param("list") List<String> signIdList);
}
