package com.ruoyi.ss.apiPrice.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ss.apiPrice.domain.ApiPrice;
import com.ruoyi.ss.apiPrice.domain.ApiPriceQuery;
import com.ruoyi.ss.apiPrice.domain.ApiPriceVO;
import com.ruoyi.ss.apiPrice.mapper.ApiPriceMapper;
import com.ruoyi.ss.apiPrice.service.ApiPriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * API收费标准Service业务层处理
 *
 * @author ruoyi
 * @date 2024-08-08
 */
@Service
public class ApiPriceServiceImpl implements ApiPriceService
{
    @Autowired
    private ApiPriceMapper apiPriceMapper;

    /**
     * 查询API收费标准
     *
     * @param id API收费标准主键
     * @return API收费标准
     */
    @Override
    public ApiPriceVO selectApiPriceById(Long id)
    {
        return apiPriceMapper.selectApiPriceById(id);
    }

    /**
     * 查询API收费标准列表
     *
     * @param apiPrice API收费标准
     * @return API收费标准
     */
    @Override
    public List<ApiPriceVO> selectApiPriceList(ApiPriceQuery apiPrice)
    {
        return apiPriceMapper.selectApiPriceList(apiPrice);
    }

    /**
     * 新增API收费标准
     *
     * @param apiPrice API收费标准
     * @return 结果
     */
    @Override
    public int insertApiPrice(ApiPrice apiPrice)
    {
        apiPrice.setCreateTime(DateUtils.getNowDate());
        return apiPriceMapper.insertApiPrice(apiPrice);
    }

    /**
     * 修改API收费标准
     *
     * @param apiPrice API收费标准
     * @return 结果
     */
    @Override
    public int updateApiPrice(ApiPrice apiPrice)
    {
        apiPrice.setUpdateTime(DateUtils.getNowDate());
        return apiPriceMapper.updateApiPrice(apiPrice);
    }

    /**
     * 批量删除API收费标准
     *
     * @param ids 需要删除的API收费标准主键
     * @return 结果
     */
    @Override
    public int deleteApiPriceByIds(Long[] ids)
    {
        return apiPriceMapper.deleteApiPriceByIds(ids);
    }

    /**
     * 删除API收费标准信息
     *
     * @param id API收费标准主键
     * @return 结果
     */
    @Override
    public int deleteApiPriceById(Long id)
    {
        return apiPriceMapper.deleteApiPriceById(id);
    }

    @Override
    public int logicDel(List<Long> ids) {
        return apiPriceMapper.logicDel(ids);
    }

    @Override
    public ApiPriceVO selectOne(ApiPriceQuery query) {
        return apiPriceMapper.selectOne(query);
    }
}
