@RequestMapping(value = "/list", method = RequestMethod.GET) @ResponseBody public List<AllocateTraining> list( String searchFilter, String order, int pageNumber, int pageSize) { return allocateTrainingService.getAll( new SearchOption(searchFilter, order, pageNumber, pageSize)); }
@RequestMapping(value = "/save", method = RequestMethod.POST) @ResponseBody public long save(@RequestBody AllocateTrainingViewModel viewModelEntity) { AllocateTraining modelEntity = ModelMapper.map(viewModelEntity, AllocateTraining.class); allocateTrainingService.save(modelEntity); iFileProviderService.confirmFileProvider(modelEntity.getFileCode()); return modelEntity.getId(); }
@RequestMapping(value = "/delete/{id}/{fileCode}", method = RequestMethod.DELETE) @ResponseBody public Boolean delete(@PathVariable long id, @PathVariable String fileCode) { try { allocateTrainingService.deleteByEntityId(id); if (!fileCode.equals("noFile")) iFileProviderService.deleteByFileCode(fileCode); return true; } catch (Exception e) { return false; } }
@RequestMapping(value = "/list/searchAllocateTraining", method = RequestMethod.GET) @ResponseBody public QueryResult<AllocateTrainingViewModel> searchAllocation( int norm, String allocateNumber, int allocateTrainingSubject, String allocateDate, int publisherId, int functorId, String order, int pageNumber, int pageSize) { QueryResult<AllocateTraining> modelResult = allocateTrainingService.searchAllocation( norm, allocateNumber, allocateTrainingSubject, allocateDate, publisherId, functorId, new SearchOption("", order, pageNumber, pageSize)); return ModelMapper.mapQueryResult(modelResult, AllocateTrainingViewModel.class); }
@RequestMapping(value = "/load/{id}", method = RequestMethod.GET) @ResponseBody public AllocateTrainingViewModel load(@PathVariable long id) { return ModelMapper.map( allocateTrainingService.loadByEntityId(id), AllocateTrainingViewModel.class); }