jhipster生成的实体如果启用了jpaMetamodelFiltering的话,back-end 的查询则会生成条件查询,这时候前端要怎么样传递查询条件过来,研究了下.记录下.
一开始是一脸懵逼的,直到看到了这段comment
/**
* Criteria class for the {@link com.library.generated.domain.Book} entity. This class is used
* in {@link com.library.generated.web.rest.BookResource} to receive all the possible filtering options from
* the Http GET request parameters.
* For example the following could be a valid request:
* {@code /books?id.greaterThan=5&attr1.contains=something&attr2.specified=false}
* As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
* fix type specific filters.
*/
这里面就给出了示例 key为attr具体参数名加上’.‘判断条件
既然知道了格式那做法就很多了,可以在页面单独处理 也可以直接在src\main\webapp\app\shared\util\request-util.ts 中进行集中处理.
还有如果是in判断的话 就是把array 使用join(’,'),用逗号分隔转成字符传回后端
https://www.jhipster.tech/entities-filtering/#implementation
具体有哪些判断条件,在swagger-ui中可以看到也可以测试