package com.ssj.dao.sys.codeexchange;

import com.ssj.bean.sys.codeexchange.CodeExchange;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

/**
 * @author Mount Liu
 * @date 2019/5/9
 */
@Repository
public interface CodeExchangeDao extends JpaRepository<CodeExchange, String> {

    Page<CodeExchange> findAll(Specification<CodeExchange> specification, Pageable page);

    /**
     * 查询兑换码信息
     * @param code
     * @return
     */
    CodeExchange findByCode(String code);

    CodeExchange findTopByModuleAndIsValidAndIsLockAndUserIdIsNull(int module, int isValid, int isLock);
}
