package com.ff.common.service.impl;

import java.util.List;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.common.mapper.CurrencyMapper;
import com.ff.common.domain.Currency;
import com.ff.common.service.ICurrencyService;

/**
 * 币种Service业务层处理
 *
 * @author shi
 * @date 2025-02-10
 */
@Service
public class CurrencyServiceImpl implements ICurrencyService
{
    @Autowired
    private CurrencyMapper currencyMapper;

    /**
     * 查询币种
     *
     * @param id 币种主键
     * @return 币种
     */
    @Override
    public Currency selectCurrencyById(Long id)
    {
        return currencyMapper.selectCurrencyById(id);
    }

    /**
     * 查询币种列表
     *
     * @param currency 币种
     * @return 币种
     */
    @Override
    public List<Currency> selectCurrencyList(Currency currency)
    {
        return currencyMapper.selectCurrencyList(currency);
    }

    /**
     * 新增币种
     *
     * @param currency 币种
     * @return 结果
     */
    @Override
    public int insertCurrency(Currency currency)
    {
        currency.setCreateTime(DateUtils.getNowDate());
        return currencyMapper.insertCurrency(currency);
    }

    /**
     * 修改币种
     *
     * @param currency 币种
     * @return 结果
     */
    @Override
    public int updateCurrency(Currency currency)
    {
        currency.setUpdateTime(DateUtils.getNowDate());
        return currencyMapper.updateCurrency(currency);
    }

    /**
     * 批量删除币种
     *
     * @param ids 需要删除的币种主键
     * @return 结果
     */
    @Override
    public int deleteCurrencyByIds(Long[] ids)
    {
        return currencyMapper.deleteCurrencyByIds(ids);
    }

    /**
     * 删除币种信息
     *
     * @param id 币种主键
     * @return 结果
     */
    @Override
    public int deleteCurrencyById(Long id)
    {
        return currencyMapper.deleteCurrencyById(id);
    }
}
