package com.sckw.system.repository.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sckw.system.dao.AppVersionsDao;
import com.sckw.system.model.AppVersions;
import com.sckw.system.repository.AppVersionsService;
import org.springframework.stereotype.Service;

/**
 * 系统版本管理表Service实现类
 * @author chenxiaofei
 * @date 2026-01-07
 */
@Service
public class AppVersionsServiceImpl extends ServiceImpl<AppVersionsDao, AppVersions> implements AppVersionsService {

    @Override
    public AppVersions getLatestVersion(Integer platform) {
        return this.getOne(Wrappers.<AppVersions>lambdaQuery()
                .eq(AppVersions::getPlatform, platform)
                .orderByDesc(AppVersions::getCreatedAt)
                .last("limit 1"));
    }

}

