Я использую Spring data jpa для извлечения данных из базы данных. Я написал код для этого в интерфейсе репозитория. Но я получаю вывод jpql в следующем формате:
[[21632,"Allfrey Laboratory","110060"],[21633,"Allis Laboratory","110070"]
Но я хочу этот вывод в jsonформат как:
[{"ndept_id":21632,"sdept_name":"Allfrey Laboratory","ninst_id":60,"bis_locked":false,"sclient_dept_id":"110060","nsurvey_method_id":1,"bis_jointuse":false,"ntemp_dept_id":4,"balternate_jointuse_percentage":false,"ndiv_id":null}]
DepartmentRespository
@Repository
public interface DepartmentsRepository extends JpaRepository<Department, Integer>
{
@Query("select d.ndept_id,d.sdept_name,d.sclient_dept_id from Department d")
public List<Department> findColumns();
}
DepartmentController
@RequestMapping(value="/findcolumn", method=RequestMethod.GET)
@ResponseBody
public List <Department> findColumnData()
{
return departmentservice.getColumns();
}