package com.liang.dao;

import com.liang.entity.PrjAnnualbudgetdetail;
import com.liang.entity.PrjProject;
import com.liang.entity.StaBudgetapproval;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;

/**
 * (StaBudgetapproval)表数据库访问层
 *
 * @author makejava
 * @since 2023-04-14 10:54:59
 */
public interface StaBudgetapprovalDao {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    StaBudgetapproval queryById(Integer id);

    /**
     * 查询指定行数据
     *
     * @param staBudgetapproval 查询条件
     * @param pageable         分页对象
     * @return 对象列表
     */
    List<StaBudgetapproval> queryAllByLimit(StaBudgetapproval staBudgetapproval, @Param("pageable") Pageable pageable);

    /**
     * 统计总行数
     *
     * @param staBudgetapproval 查询条件
     * @return 总行数
     */
    long count(StaBudgetapproval staBudgetapproval);
    /**
     * 新增数据（基本信息）
     *
     * @param staBudgetapproval  实例对象
     * @return 影响行数
     */
    int tjrevokeApprove(StaBudgetapproval staBudgetapproval);

    /**
     * 新增数据
     *
     * @param staBudgetapproval 实例对象
     * @return 影响行数
     */
    int insert(StaBudgetapproval staBudgetapproval);
    int insertImprest(StaBudgetapproval staBudgetapproval);

    /**
     * 批量新增数据（MyBatis原生foreach方法）
     *
     * @param entities List<StaBudgetapproval> 实例对象列表
     * @return 影响行数
     */
    int insertBatch(@Param("entities") List<StaBudgetapproval> entities);


    /**
     * 批量新增或按主键更新数据（MyBatis原生foreach方法）
     *
     * @param entities List<StaBudgetapproval> 实例对象列表
     * @return 影响行数
     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常，请自行校验入参
     */
    int insertOrUpdateBatch(@Param("entities") List<StaBudgetapproval> entities);

    /**
     * 修改基础数据
     *
     * @param staBudgetapproval 实例对象
     * @return 影响行数
     */
    int update(StaBudgetapproval staBudgetapproval);

    int updatebmbg(StaBudgetapproval staBudgetapproval);
    int updateImprest(StaBudgetapproval staBudgetapproval);
    int ImprestConnect(StaBudgetapproval staBudgetapproval);

    /**
     * 修改审批状态
     *
     * @param staBudgetapproval 实例对象
     * @return 实例对象
     */
    int updateSpzt(StaBudgetapproval staBudgetapproval);

    /**
     * 更新是否报账
     * @param idList
     * @return
     */
    int clearReimburse(List<Integer> idList);

    /**
     * 更新报账数据
     *
     * @param staBudgetapproval 实例对象
     * @return 实例对象 updateReimburse
     */
    int updateReimburse(StaBudgetapproval staBudgetapproval);

    /**
    /**
     * 修改其它数据
     *
     * @param staBudgetapproval 实例对象
     * @return 实例对象
     */
    int updateOthers(StaBudgetapproval staBudgetapproval);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 影响行数
     */
    int deleteById(Integer id);

    /**
     * 批量删除费用申请
     * @param idList
     * @return
     */
    int batchDelete(List<Integer> idList);

    /**
     * 获取费用申请列表
     * @return
     */
    List<StaBudgetapproval> getFysqList(Map map);

    /**
     * 获取费用申请
     * @param id
     * @return
     */
    StaBudgetapproval getFysqById(Integer id);

    /**
     * 获取已报账费用申请列表
     * @return
     */
    List<StaBudgetapproval> getYbzFysqList(Map map);

    /**
     * 获取备用金申请列表
     * @return
     */
    List<StaBudgetapproval> getByjsqList(Map map);

    /**
     * 获取全部申请列表（审批完成）
     * @return
     */
    List<StaBudgetapproval> getAllApplyList(Map map);

    /**
     * 获取审批中的申请列表
     * @return
     */
    List<StaBudgetapproval> getApprovingList(Map map);
    /**
     * 获取年份列表
     * @return
     */
    List<String> getYearList();

    /**
     * 批量作废费用申请
     * @param idList
     * @return
     */
    int batchNullify(List<Integer> idList);

    /**
     *
     * @param bh
     * @return
     */
    List<StaBudgetapproval> queryByBH(String bh);

    /**
     * 项目总体费用信息
     * @param nys
     * @return
     */
    StaBudgetapproval getXmFyInfo(Integer nys);

    /**
     * 项目分项费用信息
     * @param map
     * @return
     */
    StaBudgetapproval getKmFyInfo(Map map);

    /**
     * 未关联项目备用金
     * @return
     */
    List<StaBudgetapproval>unassociated(Map map);

    /**
     * 项目备用金信息
     * @param nys
     * @return
     */
    StaBudgetapproval getByjInfo(Integer nys);

    String getBhById(String id);

    /**
     * 获取审批结束且科研编号为null的费用申请
     * @return
     */
    List<StaBudgetapproval> listSPJS();

    int updateBatchBh(@Param("entities")List<StaBudgetapproval> staBudgetapprovals);


    StaBudgetapproval getBayID(Integer ID);

    /**
     * 获取项目类型列表
     * @return
     */
    List<String> getXmlx();

    StaBudgetapproval getSqje(Map map);

    void updateSfbz(Integer fysq);

    StaBudgetapproval getId(Integer id);

    StaBudgetapproval getZbzje(@Param("nys") Integer nys,@Param("fylb") Integer fylb);


    StaBudgetapproval getSqjes(Integer nys);


    /**
     * 获取小项费用申请总金额 （不包含备用金）
     */
    StaBudgetapproval getSqfyze(Map map);

    /**
     * 获取小项费用申请 备用总额
     */

    StaBudgetapproval getByjze (Map map);


    StaBudgetapproval getFyzz (Map map);

    // 获取备用金
    PrjAnnualbudgetdetail getByjzje(Map map);

    /**
     * 获取申请额
     */
    StaBudgetapproval getSqe (Map map);

    List<StaBudgetapproval> getFylb(Map map);

}

