package com.liang.service.impl;

import com.liang.dao.StaMeetingFeeDao;
import com.liang.entity.StaMeetingFee;
import com.liang.service.StaMeetingFeeService;
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;

/**
 * 会议费(StaMeetingFee)表服务实现类
 */
@Service("staMeetingFeeService")
public class StaMeetingFeeServiceImpl implements StaMeetingFeeService {
    @Resource
    private StaMeetingFeeDao staMeetingFeeDao;

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

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

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

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

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

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

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

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

    @Override
    public List<StaMeetingFee> getHyfList(Integer zb) {
        return this.staMeetingFeeDao.getHyfList(zb);
    }

    @Override
    public List<StaMeetingFee> queryByKyfh(String kyfh) {
        return this.staMeetingFeeDao.queryByKyfh(kyfh);
    }

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