Browse Source

单位评级规则

wangchangsheng 1 year ago
parent
commit
b4057daa8e

+ 39 - 4
ims-service/ims-eval/src/main/java/com/ims/eval/controller/OrganizationRatingRuleController.java

@@ -2,16 +2,16 @@ package com.ims.eval.controller;
 
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ims.eval.config.CustomException;
 import com.ims.eval.entity.OrganizationEvaluationRule;
 import com.ims.eval.entity.OrganizationRatingRule;
 import com.ims.eval.entity.dto.result.R;
 import com.ims.eval.service.IOrganizationRatingRuleService;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.*;
 
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import java.util.Arrays;
 
 /**
  * <p>
@@ -52,6 +52,41 @@ public class OrganizationRatingRuleController {
 	}
 
 
+	@PostMapping(value = "/save")
+	@ApiOperation(value = "新增(修改)", notes = "新增(修改)")
+	public R addAll(@RequestBody OrganizationRatingRule organizationRatingRule) {
+
+		try {
+			boolean b = organizationRatingRuleService.saveOrUpdate(organizationRatingRule);
+			if (b) {
+				return R.ok().data(b);
+			} else {
+				return R.error().data("保存失败!");
+			}
+		} catch (CustomException e) {
+			return R.customError(e.getMessage()).data("失败!");
+		}
+	}
+
+
+
+	/**
+	 * 批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@PostMapping(value = "/remove/{ids}")
+	@ApiOperation(value = "删除", notes = "删除")
+	public R deleteAll(@PathVariable("ids") String ids) {
+		String[] strings = ids.split(",");
+		boolean b = organizationRatingRuleService.removeByIds(Arrays.asList(strings));
+		if (b) {
+			return R.ok().data(b);
+		} else {
+			return R.error().data("删除失败!");
+		}
+	}
 
 
 }