package com.bonus.material.lease.mapper;


import com.bonus.common.biz.domain.lease.*;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.domain.BmProject;
import com.bonus.material.lease.domain.LeaseApplyDetails;
import com.bonus.material.lease.domain.LeasePublishDetails;
import com.bonus.material.lease.domain.vo.LeaseDeptInfo;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.domain.vo.MaTypeVoLevelTwo;
import com.bonus.material.task.domain.TmTaskAgreement;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @description  业务办理--领用任务
* @author hay
* @date   2025/2/17 13:18
*/
public interface LeaseTaskMapper {

    /**
     * 新增领用任务
     *
     * @param leaseApplyInfo 领用任务
     * @return 结果
     */
    int insertLeaseApplyInfo(LeaseApplyInfo leaseApplyInfo);

    /**
     * 插入详情数据
     *
     * @param leaseApplyDetails 领用任务详情
     * @return 结果
     */
    int insertLeaseApplyDetailsList(List<LeaseApplyDetails> leaseApplyDetails);

    /**
     * 领用记录列表查询
     *
     * @param leaseApplyInfo 领用任务
     * @return 领用任务集合
     */
    List<LeaseApplyInfo> selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo);

    /**
     * 查询领用任务详细列表
     *
     * @param leaseApplyDetails 领用任务详细
     * @return 领用任务详细集合
     */
    List<LeaseApplyDetails> selectLeaseApplyDetailsList(LeaseApplyDetails leaseApplyDetails);

    /**
     * 修改领用任务
     *
     * @param leaseApplyInfo 领用任务
     * @return 结果
     */
    int updateLeaseApplyInfo(LeaseApplyInfo leaseApplyInfo);

    /**
     * 查询领用任务
     *
     * @param leaseApplyInfo
     * @return 领用任务
     */
    LeaseApplyInfo selectLeaseApplyInfoById(LeaseApplyInfo leaseApplyInfo);

    /**
     * 查询规格型号对应数据
     *
     * @param bean
     * @return 结果
     */
    List<Type> getTypeDataList(Type bean);

    List<LeaseApplyInfo> selectAuditLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo);

    Long getDeptIdByUserId(Long userId);

    LeaseDeptInfo getDeptIdByParentId(Long deptId);


    /**
     * 查询三级物资类型
     * @return
     */
    List<Type> selectMaTypeThreeLists();

    /**
     * 根据level层级和typeID 查询父级ID
     */
    List<MaTypeVoLevelTwo> selectParentId();

    void updateLeaseTaskStatus(@Param("taskId") Long taskId, @Param("taskStatus") int taskStatus);

    LeaseApplyInfo getApplyInfo(Long taskId);

    List<LeaseApplyDetails> getApplyDetails(Long taskId);

    /**
     * 领用申请发布查询
     * @param leaseApplyInfo
     * @return
     */
    List<LeasePublishInfo> getPublishList(LeaseApplyInfo leaseApplyInfo);

    /**
     * 领用申请发布详情查询
     * @param leaseApplyInfo
     * @return
     */
    List<LeaseApplyDetails> selectPublishDetails(LeaseApplyInfo leaseApplyInfo);

    /**
     * 根据taskId查询领用申请详情
     * @param parentId
     * @return
     */
    List<LeaseApplyDetails> selectLeaseApplyDetailsById(Long parentId);

    /**
     * 领用申请发布详情保存
     * @param applyDetails
     * @return
     */
    int addPublish(LeaseApplyDetails applyDetails);

    /**
     * 领用申请发布详情修改 -- 增加发布数量
     * @param applyDetails
     * @return
     */
    int updatePublish(LeaseApplyDetails applyDetails);

    /**
     * 领用申请发布详情修改 -- 减少发布数量
     * @param applyDetails
     * @return
     */
    int updatePublishSub(LeaseApplyDetails applyDetails);

    /**
     * 领用申请发布详情删除
     * @param applyDetails
     * @return
     */
    int deletePublishDetails(LeaseApplyDetails applyDetails);

    /**
     * 根据当前年月查询最大序号
     * @param year
     * @param month
     * @return
     */
    int getMonthMaxOrderByDate(@Param("year") String year, @Param("month") String month);

    /**
     * 根据taskId查询状态
     * @param taskId
     * @return
     */
    Integer selectStatusByTaskId(Long taskId);

    /**
     * 工单接入
     *
     * @param
     * @return 结果
     */
    int insertWorkOrder(WorkApplyInfo workApplyInfo);

    /**
     * 工单接入information_people表
     *
     * @param
     * @return 结果
     */
    int insertWorkPeople(WorkPeopleInfo workPeopleInfo);

    List<WorkPeopleInfo> selectWorkPeopleInfoList(@Param("flowId") int flowId);

    List<WorkPeopleInfo> selectUserListByRoleAndDept(WorkPeopleInfo param);

    void updateWorkPeopleInfo(WorkPeopleInfo peopleInfo);

    WorkPeopleInfo getWorkPeopleInfo(WorkPeopleInfo peopleInfo);

    /**
     * 根据code查询领用申请详情
     * @return
     */
    LeasePublishDetails selectPublishDetailsByCode();

    TmTaskAgreement getAgreementInfo(LeaseApplyInfo leaseApplyInfo);

    /**
     * 根据工程id查询i8工程id
     * @param leaseApplyInfo
     * @return
     */
    BmProject selectById(LeaseApplyInfo leaseApplyInfo);

    String getAncestors(Long userId);

    String getProjectNameById(Long projectId);

    /**
     * 根据新类型查询旧类型
     * @param leaseApplyDetails
     * @return
     */
    LeaseApplyDetails selectTypeByNewType(LeaseApplyDetails leaseApplyDetails);

    /**
     * 领用申请发布详情查询
     * @param detail
     * @return
     */
    LeaseApplyDetails selectPendingOutNum(LeaseApplyDetails detail);

    /**
     * 更改设备状态为在库
     * @param maCodeVo
     * @return
     */
    int updateMaStatus(MaCodeVo maCodeVo);

    /**
     * 修改库存
     * @param bean1
     * @return
     */
    int updateInventory(LeaseApplyDetails bean1);

    /**
     * 根据typeId删除领用申请详情
     * @param leaseApplyDetails
     * @return
     */
    int delApplyDetailsByTypeId(LeaseApplyDetails leaseApplyDetails);

    /**
     * 根据parentId查询领用申请详情数量
     * @param parentId
     * @return
     */
    int selectLeaseApplyDetailsCountByParentId(Long parentId);

    /**
     * 删除领用申请详情
     * @param parentId
     * @return
     */
    int deleteLeaseApplyInfo(Long parentId);

    /**
     * 删除领用申请详情
     * @param leaseApplyDetails
     * @return
     */
    int delLeaseDetails(LeaseApplyDetails leaseApplyDetails);

    /**
     * 领用申请详情修改 -- 减少领用数量
     * @param leaseApplyDetails
     * @return
     */
    int updateLeaseOutNum(LeaseApplyDetails leaseApplyDetails);

    /**
     * 领用申请详情修改 -- 减少领用数量
     * @param leaseApplyDetails
     * @return
     */
    int deleteLeaseOutDetails(LeaseApplyDetails leaseApplyDetails);

    /**
     * 领用申请详情修改 -- 减少领用数量
     * @param leaseApplyDetails
     * @return
     */
    int deleteSltInfo(LeaseApplyDetails leaseApplyDetails);

    /**
     * 领用申请详情修改 -- 减少领用数量
     * @param leaseApplyDetails
     * @return
     */
    int updateLeaseOutNumNew(LeaseApplyDetails leaseApplyDetails);

    /**
     * 领用申请详情修改 -- 减少领用数量
     * @param bean
     * @return
     */
    int insertBackRecordByMaId(LeaseApplyDetails bean);

    WorkApplyInfo getInformationById(WorkApplyInfo workApplyInfo);
}
