package com.trade.service.tradingplatform.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.trade.service.tradingplatform.mapper.TradingPlatformInsuranceMapper;
import com.trade.service.tradingplatform.domain.TradingPlatformInsurance;
import com.trade.service.tradingplatform.service.TradingPlatformInsuranceBaseService;
import org.springframework.stereotype.Service;

/**
 * 贸易平台保险信息基础服务实现类
 *
 * @author hlb
 * @since 2024-06-05 17:00:03
 */
@Service("tradingPlatformInsuranceBaseService")
public class TradingPlatformInsuranceBaseServiceImpl extends ServiceImpl<TradingPlatformInsuranceMapper, TradingPlatformInsurance> implements TradingPlatformInsuranceBaseService {

    @Override
    public TradingPlatformInsurance findByPlatformId(Long platformId) {
        return this.lambdaQuery()
                .eq(TradingPlatformInsurance::getPlatformId, platformId)
                .orderByDesc(TradingPlatformInsurance::getGmtModified)
                .last("limit 1")
                .one();
    }
}

