package com.brframework.webapppatch.dao;

import com.brframework.commondb.core.CommonRepository;
import com.brframework.webapppatch.entity.PatchVersion;
import org.springframework.stereotype.Repository;

/**
 * 热更新版本
 * @author xu
 * @date 2019/11/14 10:27
 */
@Repository
public interface PatchVersionDao extends CommonRepository<Long, PatchVersion> {

    /**
     * 查询version最大的一条记录
     * @param os
     * @param branch
     * @return
     */
    PatchVersion findTop1ByOsAndBranchOrderByVersionDesc(String os, String branch);

    /**
     * 查询某一种状态下version最大的一条记录
     * @param os
     * @param branch
     * @param updateStatus
     * @return
     */
    PatchVersion findTop1ByOsAndBranchAndUpdateStatusOrderByVersionDesc(String os, String branch, Integer updateStatus);

    /**
     * 通过分支删除版本
     * @param branch
     * @return
     */
    int deleteByBranch(String branch);
}
