package com.liang.service.impl;

import com.liang.dao.StaPrintingFeeDao;
import com.liang.entity.StaBudgetapproval;
import com.liang.entity.StaPrintingFee;
import com.liang.service.StaPrintingFeeService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

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

/**
 * 打印费(StaPrintingFee)表服务实现类
 */
@Service("staPrintingFeeService")
public class StaPrintingFeeServiceImpl implements StaPrintingFeeService {
    @Resource
    private StaPrintingFeeDao staPrintingFeeDao;

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

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

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

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

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

    @Override
    public int deleteByZb(Integer zb) {
        return this.staPrintingFeeDao.deleteByZb(zb);
    }

    @Override
    public int batchDeleteByZb(List<Integer> zbList) {
        return this.staPrintingFeeDao.batchDeleteByZb(zbList);
    }

    @Override
    public int insertBatch(List<StaPrintingFee> expenseList) {
        return this.staPrintingFeeDao.insertBatch(expenseList);
    }

    @Override
    public List<StaPrintingFee> getDyfList(Integer zb) {
        return this.staPrintingFeeDao.getDyfList(zb);
    }

    @Override
    public List<StaPrintingFee> queryBySqkyfh(String sqkyfh) {
        return this.staPrintingFeeDao.queryBySqkyfh(sqkyfh);
    }

    @Override
    public List<HashMap<String, Object>> searchPrintingCost(Map map) {
        return this.staPrintingFeeDao.searchPrintingCost(map);
    }
}
