package com.liang.service.impl;

import com.liang.dao.StaTempmemberDao;
import com.liang.dao.StaTravelexpensesDao;
import com.liang.entity.PrjAnnualbudgetdetail;
import com.liang.entity.PrjProject;
import com.liang.entity.StaBudgetapproval;
import com.liang.dao.StaBudgetapprovalDao;
import com.liang.service.StaBudgetapprovalService;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * (StaBudgetapproval)表服务实现类
 *
 * @author makejava
 * @since 2023-04-14 10:55:01
 */
@Service("staBudgetapprovalService")
public class StaBudgetapprovalServiceImpl implements StaBudgetapprovalService {

    @Resource
    private StaBudgetapprovalDao staBudgetapprovalDao;

    @Resource
    private StaTravelexpensesDao travelexpensesDao;
    @Resource
    private StaTempmemberDao tempmemberDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public StaBudgetapproval queryById(Integer id) {
        return this.staBudgetapprovalDao.queryById(id);
    }

    /**
     * 分页查询
     *
     * @param staBudgetapproval 筛选条件
     * @param pageRequest       分页对象
     * @return 查询结果
     */
    @Override
    public Page<StaBudgetapproval> queryByPage(StaBudgetapproval staBudgetapproval, PageRequest pageRequest) {
        long total = this.staBudgetapprovalDao.count(staBudgetapproval);
        return new PageImpl<>(this.staBudgetapprovalDao.queryAllByLimit(staBudgetapproval, pageRequest), pageRequest, total);
    }

    /**
     * 新增数据
     *
     * @param staBudgetapproval 实例对象
     * @return 实例对象
     */
    @Override
    public int insert(StaBudgetapproval staBudgetapproval) {
        return this.staBudgetapprovalDao.insert(staBudgetapproval);
    }

    @Override
    public int insertImprest(StaBudgetapproval staBudgetapproval) {
        return this.staBudgetapprovalDao.insertImprest(staBudgetapproval);
    }

    /**
     * 撤销审批状态
     *
     * @param staBudgetapproval 实例对象
     * @return 实例对象
     */
    @Override
    public int tjrevokeApprove(StaBudgetapproval staBudgetapproval) {
        return this.staBudgetapprovalDao.tjrevokeApprove(staBudgetapproval);
    }

    /**
     * 修改数据
     *
     * @param staBudgetapproval 实例对象
     * @return 实例对象
     */
    @Override
    public int update(StaBudgetapproval staBudgetapproval) {
        return this.staBudgetapprovalDao.update(staBudgetapproval);
    }

    @Override
    public int updateImprest(StaBudgetapproval staBudgetapproval) {
        return this.staBudgetapprovalDao.updateImprest(staBudgetapproval);
    }

    @Override
    public int ImprestConnect(StaBudgetapproval staBudgetapproval) {
        return this.staBudgetapprovalDao.ImprestConnect(staBudgetapproval);
    }

    @Override
    public int updateSpzt(StaBudgetapproval staBudgetapproval) {
        return this.staBudgetapprovalDao.updateSpzt(staBudgetapproval);
    }

    @Override
    public int clearReimburse(List<Integer> idList) {
        return this.staBudgetapprovalDao.clearReimburse(idList);
    }

    @Override
    public int updateReimburse(StaBudgetapproval staBudgetapproval) {
        return this.staBudgetapprovalDao.updateReimburse(staBudgetapproval);
    }

    @Override
    public int updateOthers(StaBudgetapproval staBudgetapproval) {
        return this.staBudgetapprovalDao.updateOthers(staBudgetapproval);
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.staBudgetapprovalDao.deleteById(id) > 0;
    }

    @Override
    public boolean deleteApplyById(Integer id) {
        travelexpensesDao.deleteByZb(id);
        tempmemberDao.deleteByFysq(id);
        return this.staBudgetapprovalDao.deleteById(id) > 0;
    }

    @Override
    public int batchDeleteApply(List<Integer> idList) {
        travelexpensesDao.batchDeleteByZb(idList);
        tempmemberDao.batchDeleteByFysq(idList);
        return this.staBudgetapprovalDao.batchDelete(idList);
    }

    @Override
    public List<StaBudgetapproval> getFysqList(Map map) {
        return this.staBudgetapprovalDao.getFysqList(map);
    }

    @Override
    public StaBudgetapproval getFysqById(Integer id) {
        return this.staBudgetapprovalDao.getFysqById(id);
    }

    @Override
    public List<StaBudgetapproval> getYbzFysqList(Map map) {
        return this.staBudgetapprovalDao.getYbzFysqList(map);
    }

    @Override
    public List<StaBudgetapproval> getByjsqList(Map map) {
        return this.staBudgetapprovalDao.getByjsqList(map);
    }

    @Override
    public List<StaBudgetapproval> getAllApplyList(Map map) {
        return this.staBudgetapprovalDao.getAllApplyList(map);
    }

    @Override
    public List<StaBudgetapproval> getApprovingList(Map map) {
        return this.staBudgetapprovalDao.getApprovingList(map);
    }

    @Override
    public List<String> getYearList() {
        return this.staBudgetapprovalDao.getYearList();
    }

    @Override
    public int batchNullify(List<Integer> idList) {
        return this.staBudgetapprovalDao.batchNullify(idList);
    }

    @Override
    public List<StaBudgetapproval> queryByBH(String bh) {
        return this.staBudgetapprovalDao.queryByBH(bh);
    }

    @Override
    public StaBudgetapproval getXmFyInfo(Integer nys) {
        return this.staBudgetapprovalDao.getXmFyInfo(nys);
    }

    @Override
    public StaBudgetapproval getKmFyInfo(Map map) {
        return this.staBudgetapprovalDao.getKmFyInfo(map);
    }

    @Override
    public List<StaBudgetapproval> unassociated(Map map) {
        return this.staBudgetapprovalDao.unassociated(map);
    }

    @Override
    public StaBudgetapproval getByjInfo(Integer nys) {
        return this.staBudgetapprovalDao.getByjInfo(nys);
    }

    @Override
    public String getBhById(String id) {
        return this.staBudgetapprovalDao.getBhById(id);
    }


    @Override
    public StaBudgetapproval getBayID(Integer id) {
        return this.staBudgetapprovalDao.getBayID(id);
    }

    @Override
    public List<String> getXmlx() {
        return this.staBudgetapprovalDao.getXmlx();
    }

    @Override
    public StaBudgetapproval getSqje(Map map) {
        return this.staBudgetapprovalDao.getSqje(map);
    }

    @Override
    public void updateSfbz(Integer fysq) {
        staBudgetapprovalDao.updateSfbz(fysq);
    }

    @Override
    public StaBudgetapproval getId(Integer id) {
        return staBudgetapprovalDao.getId(id);
    }

    @Override
    public StaBudgetapproval getZbjje(Integer nys, Integer fylb) {
        return staBudgetapprovalDao.getZbzje(nys, fylb);
    }

    @Override
    public StaBudgetapproval getSqjes(Integer nys) {
        return this.staBudgetapprovalDao.getSqjes(nys);
    }

    @Override
    public StaBudgetapproval getSqfyze(Map map) {
        return this.staBudgetapprovalDao.getSqfyze(map);
    }

    @Override
    public StaBudgetapproval getByjze(Map map) {
        return this.staBudgetapprovalDao.getByjze(map);
    }

    @Override
    public StaBudgetapproval getFyzz(Map map) {
        return this.staBudgetapprovalDao.getFyzz(map);
    }

    @Override
    public PrjAnnualbudgetdetail getByjzje(Map map) {
        return this.staBudgetapprovalDao.getByjzje(map);
    }

    @Override
    public StaBudgetapproval getSqe(Map map) {
        return this.staBudgetapprovalDao.getSqe(map);
    }

    @Override
    public List<StaBudgetapproval> getFylb(Map map) {
        return this.staBudgetapprovalDao.getFylb(map);
    }

    @Override
    public int updatebmbg(StaBudgetapproval staBudgetapproval) {
        return this.staBudgetapprovalDao.updatebmbg(staBudgetapproval);
    }

    ;


}
