|
@@ -1,12 +1,15 @@
|
|
|
package com.ims.eval.controller;
|
|
|
|
|
|
|
|
|
+import com.ims.eval.dao.result.R;
|
|
|
+import com.ims.eval.entity.Indicator;
|
|
|
import com.ims.eval.entity.IndicatorDictionary;
|
|
|
import com.ims.eval.service.IIndicatorDictionaryService;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -19,17 +22,67 @@ import java.util.List;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("//indicator-dictionary")
|
|
|
-public class IndicatorDictionaryController {
|
|
|
+public class IndicatorDictionaryController {
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private IIndicatorDictionaryService indicatorDictionaryService;
|
|
|
|
|
|
+ /**
|
|
|
+ * @param id 主键ID
|
|
|
+ * @param indicatorId 指标ID
|
|
|
+ * @param optionCode 选项编码
|
|
|
+ * @param optionName 选项名称
|
|
|
+ * @return
|
|
|
+ */
|
|
|
//@ImsPreAuth("eval:indicator:view")
|
|
|
@RequestMapping(value = "list")
|
|
|
- public List<IndicatorDictionary> list() {
|
|
|
- List<IndicatorDictionary> list = indicatorDictionaryService.list();
|
|
|
+ public List<IndicatorDictionary> list(@RequestParam(value = "id", required = false) String id,
|
|
|
+ @RequestParam(value = "indicatorId", required = false) String indicatorId,
|
|
|
+ @RequestParam(value = "optionCode", required = false) String optionCode,
|
|
|
+ @RequestParam(value = "optionName", required = false) String optionName) {
|
|
|
+ List<IndicatorDictionary> list = indicatorDictionaryService.list(id, indicatorId, optionCode, optionName);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @param dictionary
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+
|
|
|
+ //@ImsPreAuth("eval:dataDictionary:edit")
|
|
|
+ @PostMapping(value = "/save")
|
|
|
+ @ApiOperation(value = "新增(修改)", notes = "新增(修改)")
|
|
|
+ public R addAll(@RequestBody IndicatorDictionary dictionary) {
|
|
|
+
|
|
|
+ boolean b = indicatorDictionaryService.saveOrUpdate(dictionary);
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("保存失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@ImsPreAuth("eval:dataDictionary:remove")
|
|
|
+ @DeleteMapping(value = "/remove/{ids}")
|
|
|
+ @ApiOperation(value = "删除", notes = "删除")
|
|
|
+ public R deleteAll(@PathVariable("ids") String ids) {
|
|
|
+ String[] strings = ids.split(",");
|
|
|
+ boolean b = indicatorDictionaryService.removeByIds(Arrays.asList(strings));
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("删除失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|