package com.fjhx.service.supplier.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.utils.WrapperUtil;
import com.fjhx.entity.supplier.SupplierBank;
import com.fjhx.params.supplier.SupplierBankVo;
import com.fjhx.mapper.supplier.SupplierBankMapper;
import com.fjhx.service.supplier.SupplierBankService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * 供应商收款账户 服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2022-08-08
 */
@Service
public class SupplierBankServiceImpl extends ServiceImpl<SupplierBankMapper, SupplierBank> implements SupplierBankService {

    @Override
    public Page<SupplierBank> getPage(Map<String, String> condition) {

        QueryWrapper<SupplierBank> wrapper = Wrappers.query();

        WrapperUtil.init(condition, wrapper)
                .createTimeDesc();

        Page<SupplierBank> page = page(condition, wrapper);
        return page;
    }

    @Override
    public void add(SupplierBankVo supplierBankVo) {
        save(supplierBankVo);
    }

    @Override
    public void edit(SupplierBankVo supplierBankVo) {
        updateById(supplierBankVo);
    }

    @Override
    public void delete(SupplierBankVo supplierBankVo) {
        removeById(supplierBankVo.getId());
    }

}
