@RequestMapping(value = "/save", method = RequestMethod.POST) @ResponseBody public Long save(@RequestBody EnumerationViewModel viewModelEntity) { Enumeration modelEntity = ModelMapper.map(viewModelEntity, Enumeration.class); modelEntity.setUpdatedDate(new Date()); modelEntity.setCreatedDate(new Date()); return enumerationService.saveAndCloneEnumerationDetail(modelEntity); }
@RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE) @ResponseBody public Boolean delete(@PathVariable Long id) { try { enumerationService.deleteByEntityId(id); return true; } catch (Exception e) { return false; } }
@RequestMapping(value = "/list/searchEnumeration", method = RequestMethod.GET) @ResponseBody public QueryResult<EnumerationViewModel> searchEnumeration( long instructionId, int storeHouseId, String enumerateDate, String enumerateNumber, String countedDate, String where, String order, int pageNumber, int pageSize) { SearchOption s = new SearchOption(where, order, pageNumber, pageSize); QueryResult<Enumeration> q = enumerationService.searchEnumeration( instructionId, storeHouseId, enumerateDate, enumerateNumber, countedDate, s); return ModelMapper.mapQueryResult(q, EnumerationViewModel.class); }
@RequestMapping(value = "/load/{id}", method = RequestMethod.GET) @ResponseBody public EnumerationViewModel load(@PathVariable Long id) { return ModelMapper.map(enumerationService.loadByEntityId(id), EnumerationViewModel.class); }