|
@@ -1,9 +1,16 @@
|
|
|
package com.gyee.backconfig.controller;
|
|
|
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.gyee.backconfig.config.R;
|
|
|
+import com.gyee.backconfig.model.auto.ProBasicWindpowerstation;
|
|
|
+import com.gyee.backconfig.model.auto.ProBasicWindturbine;
|
|
|
+import com.gyee.backconfig.service.auto.IProBasicWindturbineService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.Arrays;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -16,5 +23,69 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@RestController
|
|
|
@RequestMapping("//pro-basic-windturbine")
|
|
|
public class ProBasicWindturbineController {
|
|
|
+ @Resource
|
|
|
+ private IProBasicWindturbineService proBasicWindturbineService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @param code
|
|
|
+ * @param windpowerstationId
|
|
|
+ * @param projectId
|
|
|
+ * @param lineId
|
|
|
+ * @param pageNum
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public R findList(@RequestParam(value = "id", required = false) String id,
|
|
|
+ @RequestParam(value = "code", required = false) String code,
|
|
|
+ @RequestParam(value = "windpowerstationId", required = false) String windpowerstationId,
|
|
|
+ @RequestParam(value = "projectId", required = false) String projectId,
|
|
|
+ @RequestParam(value = "lineId", required = false) String lineId,
|
|
|
+ @RequestParam(value = "pageNum", required = true) String pageNum,
|
|
|
+ @RequestParam(value = "pageSize", required = true) String pageSize) {
|
|
|
+ IPage<ProBasicWindturbine> list = proBasicWindturbineService.list(id, code, windpowerstationId, projectId, lineId, pageNum, pageSize);
|
|
|
+ if (null != list) {
|
|
|
+ return R.ok().data(list);
|
|
|
+ } else {
|
|
|
+ return R.error().data("查询失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @param proBasicWindpowerstation
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public R addAll(@RequestBody ProBasicWindturbine proBasicWindpowerstation) {
|
|
|
+
|
|
|
+ boolean b = proBasicWindturbineService.saveOrUpdate(proBasicWindpowerstation);
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("保存失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @DeleteMapping(value = "/{ids}")
|
|
|
+ public R deleteAll(@PathVariable("ids") String ids) {
|
|
|
+ String[] strings = ids.split(",");
|
|
|
+ boolean b = proBasicWindturbineService.removeByIds(Arrays.asList(strings));
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("删除失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|