|
@@ -0,0 +1,102 @@
|
|
|
+package com.ims.eval.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.ims.eval.cache.CacheContext;
|
|
|
+import com.ims.eval.config.CustomException;
|
|
|
+import com.ims.eval.entity.BinSection;
|
|
|
+import com.ims.eval.entity.IndicatorType;
|
|
|
+import com.ims.eval.entity.dto.result.R;
|
|
|
+import com.ims.eval.service.IBinSectionService;
|
|
|
+import com.ims.eval.service.IIndicatorTypeService;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 生产经营业务分类 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author wang
|
|
|
+ * @since 2023-03-12
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("//bin-section")
|
|
|
+public class BinSectionController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBinSectionService binSectionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CacheContext cache;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询
|
|
|
+ *
|
|
|
+ * @param id 主键ID
|
|
|
+ * @param sectionName name
|
|
|
+ * @param sectionCode code
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@ImsPreAuth("eval:binSection:view")
|
|
|
+ @GetMapping(value = "list")
|
|
|
+ public R list(@RequestParam(value = "id", required = false) String id,
|
|
|
+ @RequestParam(value = "sectionName", required = false) String sectionName,
|
|
|
+ @RequestParam(value = "sectionCode", required = false) String sectionCode) {
|
|
|
+// List<IndicatorType> list = iIndicatorTypeService.list(id, typeName, typeCode);
|
|
|
+ List<BinSection> list =CacheContext.bsnList;
|
|
|
+ return R.ok().data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @param binSection
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+
|
|
|
+ //@ImsPreAuth("eval:binSection:edit")
|
|
|
+ @PostMapping(value = "/save")
|
|
|
+ @ApiOperation(value = "新增(修改)", notes = "新增(修改)")
|
|
|
+ public R addAll(@RequestBody BinSection binSection) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ boolean b = binSectionService.saveOrUpdate(binSection);
|
|
|
+ if (b) {
|
|
|
+ cache.initIndicatorType();
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("保存失败!");
|
|
|
+ }
|
|
|
+ } catch (CustomException e){
|
|
|
+ return R.customError(e.getMessage()).data("失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@ImsPreAuth("eval:binSection:remove")
|
|
|
+ @PostMapping(value = "/remove/{ids}")
|
|
|
+ @ApiOperation(value = "删除", notes = "删除")
|
|
|
+ public R deleteAll(@PathVariable("ids") String ids) {
|
|
|
+ String[] strings = ids.split(",");
|
|
|
+ boolean b = binSectionService.removeByIds(Arrays.asList(strings));
|
|
|
+ if (b) {
|
|
|
+ cache.initDataDictionary();
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("删除失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|