智慧保安后台管理-外网
tangzy
2021-08-16 1686e242b0c63d64db8551fe9d08cd57bd77fb8b
src/main/java/org/springblade/modules/record/controller/RecordController.java
@@ -33,6 +33,7 @@
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Map;
/**
 *  控制器
@@ -88,10 +89,39 @@
   @ApiOperationSupport(order = 4)
   @ApiOperation(value = "新增", notes = "传入record")
   public R save(@Valid @RequestBody Record record) {
      String cardid = record.getCardid();
      Map map = recordService.selectIn(cardid);
      if (map!=null){
         String id = map.get("id").toString();
         recordService.removeByIds(Func.toLongList(id));
      }
      record.setStorage("0");
      return R.status(recordService.save(record));
   }
   /**
    * 暂存
    */
   @PostMapping("/rocordsave")
   @ApiOperationSupport(order = 4)
   @ApiOperation(value = "新增", notes = "传入record")
   public R rocordsave(@Valid @RequestBody Record record) {
      String cardid = record.getCardid();
      Map map = recordService.selectIn(cardid);
      if (map!=null){
         record.setStorage("0");
         recordService.updateById(record);
      }
      else {
         record.setStorage("0");
         record.setType("2");
         record.setPtype("2");
         recordService.save(record);
      }
      return R.success("暂存成功");
   }
   /**
    * 修改
    */
   @PostMapping("/update")