package com.gic.haoban.manage.service.service.fee.impl;

import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.qdto.QywxFeeListQDTO;
import com.gic.haoban.manage.service.dao.mapper.fee.TabHaobanQywxFeeMapper;
import com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFee;
import com.gic.haoban.manage.service.pojo.bo.fee.HaobanQywxFeeBO;
import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 企业微信收费(TabHaobanQywxFee)表服务实现类
 *
 * @author mozhu
 * @since 2022-08-03 16:12:31
 */
@Service
public class HaobanQywxFeeServiceImpl implements HaobanQywxFeeService {
    @Autowired
    private TabHaobanQywxFeeMapper tabHaobanQywxFeeMapper;

    /**
     * 新增数据
     */
    @Override
    public int insert(TabHaobanQywxFee tabHaobanQywxFee) {
        return this.tabHaobanQywxFeeMapper.insert(tabHaobanQywxFee);
    }

    @Override
    public Page<HaobanQywxFeeBO> listPage(QywxFeeListQDTO qywxFeeListQDTO) {
        PageHelper.startPage(qywxFeeListQDTO.getPageNum(),qywxFeeListQDTO.getPageSize());
        List<TabHaobanQywxFee> tabHaobanQywxFees = tabHaobanQywxFeeMapper.listPage(qywxFeeListQDTO);
        return PageUtil.changePageHelperToCurrentPage(new PageInfo<>(tabHaobanQywxFees), HaobanQywxFeeBO.class);
    }

    @Override
    public HaobanQywxFeeBO queryByWxEnterpriseId(String wxEnterpriseId) {
        return EntityUtil.changeEntityNew(HaobanQywxFeeBO.class,tabHaobanQywxFeeMapper.queryByWxEnterpriseId(wxEnterpriseId));
    }
}
