package com.zhongshu.card.server.core.dao.school;

import com.github.microservice.components.data.mongo.mongo.dao.MongoDao;
import com.zhongshu.card.client.type.school.CardState;
import com.zhongshu.card.server.core.dao.school.extend.CardInfoDaoExtend;
import com.zhongshu.card.server.core.domain.school.CardInfo;

import java.util.List;

/**
 * 卡片Dao
 *
 * @author TRX
 * @date 2024/3/21
 */
public interface CardInfoDao extends MongoDao<CardInfo>, CardInfoDaoExtend {

    CardInfo findTopById(String id);

    CardInfo findByCode(String code);

    CardInfo findTopByProjectOidAndCode(String projectOid, String code);

    // 查询用户所有的卡片
    List<CardInfo> findByUserIdAndOid(String userId, String oid);

    List<CardInfo> findByUserId(String userId);

    List<CardInfo> findByUserIdAndProjectOid(String userId, String projectOid);

    List<CardInfo> findByProjectOidAndUserIdInAndCardStateOrderByUpdateTimeDesc(String projectOid, List<String> userIds, CardState state);

    void deleteByUserIdAndOid(String userId, String oid);
}
