Bladeren bron

'新增设备报修记录表-删除接口'

james 1 jaar geleden
bovenliggende
commit
12a0b63824

+ 12 - 4
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/CrmDeviceRepairController.java

@@ -9,12 +9,9 @@ import com.usky.iot.service.vo.CrmDeviceRepairScoreVO;
 import com.usky.iot.service.vo.CrmDeviceRepairVO;
 import com.usky.iot.service.vo.PhoneVerifyVO;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.*;
 
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RestController;
 
 /**
  * <p>
@@ -51,6 +48,17 @@ public class CrmDeviceRepairController {
         return ApiResult.success(crmDeviceRepairService.page(crmDeviceRepairVO));
     }
 
+    /**
+     *
+     * @param id
+     * @return
+     */
+    @DeleteMapping("/{id}")
+    ApiResult<Void> remove(@PathVariable("id") Integer id){
+        crmDeviceRepairService.remove(id);
+        return ApiResult.success();
+    }
+
     /**
      * 填报
      * @param crmDeviceRepair

+ 2 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/CrmDeviceRepairService.java

@@ -22,6 +22,8 @@ public interface CrmDeviceRepairService extends CrudService<CrmDeviceRepair> {
 
     CommonPage<CrmDeviceRepair> page(CrmDeviceRepairVO crmDeviceRepairVO);
 
+    void remove(Integer id);
+
     void fill(CrmDeviceRepair crmDeviceRepair);
 
     void score(CrmDeviceRepairScoreVO scoreVO);

+ 8 - 4
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/CrmDeviceRepairServiceImpl.java

@@ -33,10 +33,7 @@ import org.springframework.stereotype.Service;
 
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 
 /**
  * <p>
@@ -127,6 +124,13 @@ public class CrmDeviceRepairServiceImpl extends AbstractCrudService<CrmDeviceRep
 
     }
 
+    @Override
+    public void remove(Integer id){
+        CrmDeviceRepair one = this.getById(id);
+        Optional.ofNullable(one).orElseThrow(() -> new BusinessException("报修记录不存在"));
+        this.removeById(id);
+    }
+
     @Override
     public void fill(CrmDeviceRepair crmDeviceRepair1){
         crmDeviceRepair1.setRepairStatus(2);