package com.crm.manager.dao.repository;

import com.crm.rely.backend.core.pojo.table.CustomGroupDemoTable;
import com.crm.rely.backend.core.pojo.table.CustomGroupTable;
import com.crm.rely.backend.dao.repository.BaseRepository;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.stereotype.Repository;

import javax.persistence.LockModeType;
import java.util.List;

/**
 * Created by max on 2020/7/8.
 */
@Repository
public interface CustomGroupRepository extends BaseRepository<CustomGroupTable> {

    boolean existsByCode(String code);

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    CustomGroupTable findFirstById(Long id);

    List<CustomGroupTable> getAllByPlatform(String platform);
    List<CustomGroupTable> getAllByPlatformAndTypeIn(String platform,List<Long> types);

    void deleteByIdIn(List<Long> ids);
}
