コード例 #1
0
 /** PUT /accountings -> Updates an existing accounting. */
 @RequestMapping(
     value = "/accountings",
     method = RequestMethod.PUT,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Accounting> updateAccounting(@RequestBody Accounting accounting)
     throws URISyntaxException {
   log.debug("REST request to update Accounting : {}", accounting);
   if (accounting.getId() == null) {
     return createAccounting(accounting);
   }
   Accounting result = accountingRepository.save(accounting);
   return ResponseEntity.ok()
       .headers(HeaderUtil.createEntityUpdateAlert("accounting", accounting.getId().toString()))
       .body(result);
 }
コード例 #2
0
 /** POST /accountings -> Create a new accounting. */
 @RequestMapping(
     value = "/accountings",
     method = RequestMethod.POST,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public ResponseEntity<Accounting> createAccounting(@RequestBody Accounting accounting)
     throws URISyntaxException {
   log.debug("REST request to save Accounting : {}", accounting);
   if (accounting.getId() != null) {
     return ResponseEntity.badRequest()
         .header("Failure", "A new accounting cannot already have an ID")
         .body(null);
   }
   Accounting result = accountingRepository.save(accounting);
   return ResponseEntity.created(new URI("/api/accountings/" + result.getId()))
       .headers(HeaderUtil.createEntityCreationAlert("accounting", result.getId().toString()))
       .body(result);
 }