Ver código fonte

设备设置运维和维修人员保存接口修改

zhaishaofeng 1 ano atrás
pai
commit
9065a6d299

+ 12 - 2
imcs-bt-be/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/tenantProductUser/ImcsTenantProductresourceUserController.java

@@ -7,6 +7,7 @@ import com.github.zuihou.business.tenantProductUser.dto.ImcsTenantProductresourc
 import com.github.zuihou.business.tenantProductUser.dto.ImcsTenantProductresourceUserUpdateDTO;
 import com.github.zuihou.business.tenantProductUser.entity.ImcsTenantProductresourceUser;
 import com.github.zuihou.business.tenantProductUser.service.ImcsTenantProductresourceUserService;
+import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.security.annotation.PreAuth;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -15,6 +16,7 @@ import org.springframework.validation.annotation.Validated;
 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.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -63,8 +65,16 @@ public class ImcsTenantProductresourceUserController extends SuperController<Imc
      */
     @ApiOperation(value = "批量设置运维或维护人员", notes = "批量设置运维或维护人员")
     @PostMapping("/saveBatch")
-    public R<List<ImcsTenantProductresourceUser>> saveOrUpdateBatchProductresourceUser(@RequestBody List<ImcsTenantProductresourceUser> productresourceUserList) {
-        baseService.saveOrUpdateBatch(productresourceUserList);
+    public R<List<ImcsTenantProductresourceUser>> saveOrUpdateBatchProductresourceUser(
+            @RequestParam(name = "equId") Long equId,
+            @RequestParam(name = "userType") String userType,
+            @RequestBody List<ImcsTenantProductresourceUser> productresourceUserList) {
+        baseService.remove(
+                Wraps.<ImcsTenantProductresourceUser>lbQ()
+                        .eq(ImcsTenantProductresourceUser::getEquId, equId)
+                        .eq(ImcsTenantProductresourceUser::getUserType, userType)
+        );
+        baseService.saveBatch(productresourceUserList);
         return success(productresourceUserList);
     }