2020-07-03 12:09:22 +02:00
|
|
|
package eu.dnetlib.organizations.repository;
|
|
|
|
|
|
|
|
import java.time.OffsetDateTime;
|
|
|
|
|
|
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
|
|
import org.springframework.data.jpa.repository.Modifying;
|
|
|
|
import org.springframework.data.jpa.repository.Query;
|
|
|
|
|
|
|
|
import eu.dnetlib.organizations.model.Organization;
|
|
|
|
|
|
|
|
public interface OrganizationRepository extends JpaRepository<Organization, String> {
|
|
|
|
|
|
|
|
@Modifying
|
|
|
|
@Query("update Organization set created_by = ?2, creation_date = ?3 where id = ?1")
|
|
|
|
void updateCreationDate(String id, String user, OffsetDateTime now);
|
|
|
|
|
|
|
|
@Modifying
|
|
|
|
@Query("update Organization set modified_by = ?2, modification_date = ?3 where id = ?1")
|
|
|
|
void updateModificationDate(String id, String user, OffsetDateTime now);
|
|
|
|
|
2020-10-07 17:04:29 +02:00
|
|
|
@Modifying
|
|
|
|
@Query("update Organization set status = ?2 where id = ?1")
|
|
|
|
void updateStatus(String id, String status);
|
|
|
|
|
2022-10-11 12:36:02 +02:00
|
|
|
// to override the generation strategy of the ID
|
2021-04-19 16:00:29 +02:00
|
|
|
@Modifying
|
|
|
|
@Query(value = "insert into organizations(id) values (?1)", nativeQuery = true)
|
2022-10-11 12:36:02 +02:00
|
|
|
void prepareOrgWithId(String id);
|
2021-04-19 16:00:29 +02:00
|
|
|
|
2021-07-30 14:12:09 +02:00
|
|
|
double countByStatus(String string);
|
|
|
|
|
2020-07-03 12:09:22 +02:00
|
|
|
}
|