@Repository
public interface HouseRepository extends JpaRepository<House, Integer> {
@Query("select new mosecom.dto.WellProjection"
+ "(h.id as id, h.houseName as houseName, h.moved as moved) "
+ "from House h order by h.id")
List<HouseProjection> findHouseList();
}
@Repository
public interface WellsDocRepository extends JpaRepository<WellsDoc, Integer> {}
// тут всё предельно дефолтно, как видите :)
@Service
public class HouseServiceImpl implements HouseService {
@Autowired
private HouseRepository houseRepository;
@Autowired
private MovedTypeRepository movedTypeRepository;
@Value("${upload.path}")
private String uploadPath;
@Override
public List<HouseProjection> getHouseList() {
return houseRepository.findHouseList();
}
@Override
public House getHouse(int id) {
return houseRepository.getOne(id);
}
@Override
public List<MovedType> getAllMovedTypes() { return movedTypeRepository.findAll(); }
@Override
@Transactional
public House save(HouseFullProjection dto, MultipartFile[] files) throws IllegalStateException, IOException {
// (...)
}
про options прикольная идея, но для этого какая-то библиотечка понадобится?