Ejemplo n.º 1
0
  @RequestMapping(value = "/save", method = RequestMethod.POST)
  @ResponseBody
  public int save(@RequestBody Training train) {
    if (train.getPower().getId() <= 0) train.setPower(null);

    if (train.getSupplier().getId() <= 0) train.setSupplier(null);

    if (train.getId() > 0) trainingService.update(train);
    else trainingService.add(train);

    return 0;
  }
Ejemplo n.º 2
0
 @RequestMapping("/load/{Id}")
 @ResponseBody
 public Training load(@PathVariable int Id) {
   return trainingService.loadByEntityId(Id);
 }
Ejemplo n.º 3
0
 @RequestMapping(value = "/delete/{Id}", method = RequestMethod.DELETE)
 @ResponseBody
 public boolean delete(@PathVariable int Id) {
   trainingService.deleteByEntityId(Id);
   return true;
 }
Ejemplo n.º 4
0
 @RequestMapping(value = "/list/grid/{contractId}", method = RequestMethod.GET)
 @ResponseBody
 public QueryResult<Training> listGrid(
     @PathVariable int contractId, String where, String order, int pageNumber, int pageSize) {
   return trainingService.getAll(contractId, new SearchOption("", order, pageNumber, pageSize));
 }