Pārlūkot izejas kodu

修改小程序提交床位申请接口

liu 1 gadu atpakaļ
vecāks
revīzija
ef12e69bb0

+ 11 - 0
src/main/java/com/template/controller/WelcomeBedController.java

@@ -1,6 +1,9 @@
 package com.template.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.template.api.WelcomeBedControllerAPI;
 import com.template.common.utils.ExcelUtils;
 import com.template.common.utils.paramUtils;
@@ -607,6 +610,14 @@ public class WelcomeBedController implements WelcomeBedControllerAPI {
 
     @Override
     public CommonResult submit(WelcomeBed welcomeBed) {
+        String studentCard = welcomeBed.getStudentCard();
+//        先判断是否已经提交
+        LambdaQueryWrapper<WelcomeBed> wrapper=new LambdaQueryWrapper<>();
+        wrapper.eq(WelcomeBed::getStudentCard,studentCard);
+        WelcomeBed one = welcomeBedService.getOne(wrapper);
+        if (ObjectUtils.isNotEmpty(one)) {
+            return CommonResult.fail("已提交,请勿重复提交");
+        }
         welcomeBedService.updateById(welcomeBed);
         return CommonResult.ok();
     }