服务类:这里我对这个类做了注解,@componentscan注解中也提到了这个包
@Service
public class EHSCheckedVehiclesGetter implements Callable<List<VehicleEHSDTO>> {
private VehicleEHSRepository vrepo;
private String buid;
public EHSCheckedVehiclesGetter() {
}
public EHSCheckedVehiclesGetter(VehicleEHSRepository vrepo, String buid) {
Assert.notNull(vrepo, "VehicleEHSInfoRepository cannot be null");
Assert.notNull(buid, "Business Unit Id cannot be null");
this.vrepo = vrepo;
this.buid = buid;
}
@Override
public List<VehicleEHSDTO> call() throws Exception {
List<PVehicleEHSChecklistStatus> pVehicleEHSInfos = vrepo.findByBuid(buid);
List<VehicleEHSDTO> vehicleEHSInfoDTOs = VehicleUtils.convert(pVehicleEHSInfos);
return vehicleEHSInfoDTOs;
}
Repository 类:这是存储库的接口,我在 @EnableJpaRepositories 注释中将此包作为基本包
public interface VehicleEHSRepository extends JpaRepository<PVehicleEHSChecklistStatus, PVehicleEHSChecklistStatusId>,
MISRevisionRepository<PVehicleEHSChecklistStatus, PVehicleEHSChecklistStatusId, Integer> {
@Query("from PVehicleEHSChecklistStatus where id.businessUnitId = ?1")
List<PVehicleEHSChecklistStatus> findByBuid(String buid);
@Query("from PVehicleEHSChecklistStatus where id.vehicleId = ?1")
List<PVehicleEHSChecklistStatus> findByVehicleId(String vehicleId);
这是否与除此之外的其他内容有关,因为我正在尝试更新项目中的技术堆栈。
函数式编程
相关分类