|
@@ -1,9 +1,16 @@
|
|
|
package com.ims.eval.controller;
|
|
|
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import com.ims.eval.dao.result.CustomException;
|
|
|
+import com.ims.eval.dao.result.R;
|
|
|
+import com.ims.eval.entity.IntervalScoringTable;
|
|
|
+import com.ims.eval.service.IIntervalScoringTableService;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -17,4 +24,60 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@RequestMapping("//interval-scoring-table")
|
|
|
public class IntervalScoringTableController {
|
|
|
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IIntervalScoringTableService intervalScoringTableService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 区间评分详情查询
|
|
|
+ *
|
|
|
+ * @param ruleId 考评得分规则id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "list")
|
|
|
+ public R list(@RequestParam(value = "ruleId", required = false) String ruleId){
|
|
|
+ List<IntervalScoringTable> list = intervalScoringTableService.list(ruleId);
|
|
|
+ return R.ok().data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加/修改
|
|
|
+ *
|
|
|
+ * @param intervalScoringTable
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/saveOrUpdate")
|
|
|
+ @ApiOperation(value = "新增(修改)", notes = "新增(修改)")
|
|
|
+ public R saveOrUpdate(@RequestBody IntervalScoringTable intervalScoringTable) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ boolean b = intervalScoringTableService.saveOrUpdate(intervalScoringTable);
|
|
|
+ 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 = intervalScoringTableService.removeByIds(Arrays.asList(strings));
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("删除失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|