liujie
2026-09-20 25999c575dd42b4715e49d3fe57e73c2c3204ccb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.estate.expert.admin.domain.business.car;
 
import com.estate.expert.admin.domain.common.EntityBaseRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.data.repository.query.Param;
 
import java.util.List;
 
public interface CarRepository extends EntityBaseRepository<Car> {
 
    @Query("select c from Car c where (:departmentPath is null or :departmentPath = '' or c.departmentPath = :departmentPath) " +
            "and (:keyword is null or :keyword = '' or c.name like %:keyword%) " +
            "and c.deleted = false")
    List<Car> listCars(@Param("departmentPath") String departmentPath,
                       @Param("keyword") String keyword);
 
    @Query("select c from Car c where (:keyword is null or :keyword = '' " +
            "or c.model like %:keyword% " +
            "or c.name like %:keyword%) " +
            "and c.deleted = false")
    List<Car> listCars(String keyword);
 
}