1
+ package test .org .springdoc .api .app37 ;
2
+
3
+ /**
4
+ * @author bnasslahsen
5
+ */
6
+
7
+ import java .time .LocalDate ;
8
+ import java .util .List ;
9
+
10
+ import ch .qos .logback .core .rolling .helper .DateTokenConverter ;
11
+ import io .swagger .v3 .oas .annotations .Parameter ;
12
+
13
+ import org .springframework .data .jpa .repository .JpaRepository ;
14
+ import org .springframework .data .repository .query .Param ;
15
+ import org .springframework .data .rest .core .annotation .RepositoryRestResource ;
16
+ import org .springframework .format .annotation .DateTimeFormat ;
17
+
18
+ /**
19
+ * 商品信息
20
+ *
21
+ * @author zctmdc
22
+ */
23
+ @ RepositoryRestResource (path = "product" )
24
+ public interface ProductRepository extends JpaRepository <ProductEntity , Long > {
25
+
26
+ /**
27
+ * 根据商品名称查询商品信息
28
+ *
29
+ * @param name 商品名称
30
+ * @return 商品信息列表
31
+ */
32
+ List <ProductEntity > findByName (@ Parameter (name = "name2" , required = true ) String name );
33
+
34
+ /**
35
+ * 根据商品名称查询最新的商品信息
36
+ *
37
+ * @param name 商品名称
38
+ * @return 商品信息
39
+ */
40
+ ProductEntity findTopByNameOrderByDateDesc (@ Parameter (name = "name2" , required = true ) String name );
41
+
42
+ /**
43
+ * 根据商品名称模糊查询商品信息并按时间降序排序
44
+ *
45
+ * @param name 商品名称
46
+ * @return 商品信息列表
47
+ */
48
+ List <ProductEntity > findByNameContainingIgnoreCaseOrderByDateDesc (
49
+ @ Parameter (name = "name2" , required = true ) String name );
50
+
51
+ /**
52
+ * 根据商品名称模糊查询商品信息并按时间降序排序
53
+ *
54
+ * @param name 商品名称
55
+ * @return 商品信息列表
56
+ */
57
+ List <ProductEntity > findByNameContainingIgnoreCase (
58
+ @ Parameter (name = "name2" , required = true ) String name );
59
+
60
+ /**
61
+ * 根据商品名称模糊查询指定日期前的商品信息
62
+ *
63
+ * @param end 指定日期结束
64
+ * @return 商品信息列表
65
+ */
66
+ List <ProductEntity > findByDateBefore (
67
+ @ Parameter (name = "end2" , required = true ) @ DateTimeFormat (pattern = DateTokenConverter .DEFAULT_DATE_PATTERN ) @ Param ("end" ) LocalDate end );
68
+
69
+ /**
70
+ * 根据商品名称模糊查询指定日期前的商品信息
71
+ *
72
+ * @param name 商品名称
73
+ * @param end 指定日期结束
74
+ * @return 商品信息列表
75
+ */
76
+ List <ProductEntity > findByNameContainingIgnoreCaseAndDateBefore (
77
+ @ Parameter (name = "name2" , required = true ) String name ,
78
+ @ Parameter (name = "end2" , required = true ) @ DateTimeFormat (pattern = DateTokenConverter .DEFAULT_DATE_PATTERN ) @ Param ("end" ) LocalDate end );
79
+
80
+ }
0 commit comments