package cn.teammodel.repository;

import cn.teammodel.model.entity.school.Teacher;
import com.azure.spring.data.cosmos.repository.CosmosRepository;
import com.azure.spring.data.cosmos.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.List;

/**
 * @author winter
 * @create 2023-11-28 17:39
 */
@Repository
public interface TeacherRepository extends CosmosRepository<Teacher, String> {
    @Query("select  c.id, c.name from Teacher as c where c.code = @code and c.id in (@ids)")
    List<Teacher> findAllByCodeAndIdIn(String code, Collection<String> ids);
    //根据手机号码、名称、id 模糊查询
    @Query("select * from Teacher as c where c.code = @code and " +
            "(IS_NULL(@name) or contains(c.name,@name) ) ")
    List<Teacher> findTeachers(String code, String name);
}
