File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
shogun-lib/src/main/java/de/terrestris/shogun/lib/repository Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 1717package de .terrestris .shogun .lib .repository ;
1818
1919import de .terrestris .shogun .lib .model .Layer ;
20+ import java .util .List ;
21+ import java .util .Optional ;
2022import org .springframework .data .jpa .repository .JpaSpecificationExecutor ;
23+ import org .springframework .data .jpa .repository .Query ;
24+ import org .springframework .data .repository .query .Param ;
2125import org .springframework .stereotype .Repository ;
2226
2327@ Repository
24- public interface LayerRepository extends BaseCrudRepository <Layer , Long >, JpaSpecificationExecutor <Layer > { }
28+ public interface LayerRepository extends BaseCrudRepository <Layer , Long >, JpaSpecificationExecutor <Layer > {
29+
30+ @ Query (
31+ value = "SELECT * FROM shogun.layers WHERE source_config ->> 'layerNames' = :layerName LIMIT 1" ,
32+ nativeQuery = true
33+ )
34+ Optional <Layer > findFirstByLayerName (@ Param ("layerName" ) String layerName );
35+
36+ @ Query (
37+ value = "SELECT * FROM shogun.layers WHERE source_config ->> 'layerNames' = :layerName" ,
38+ nativeQuery = true
39+ )
40+ List <Layer > findByLayerName (@ Param ("layerName" ) String layerName );
41+
42+ }
You can’t perform that action at this time.
0 commit comments