|
@@ -1,12 +1,15 @@
|
|
|
package com.gyee.backconfig.controller;
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.gyee.backconfig.config.R;
|
|
|
+import com.gyee.backconfig.model.auto.Inverter;
|
|
|
+import com.gyee.backconfig.model.auto.Junctionbox;
|
|
|
import com.gyee.backconfig.service.auto.IJunctionboxService;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.Arrays;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -22,4 +25,62 @@ public class JunctionboxController {
|
|
|
@Resource
|
|
|
private IJunctionboxService junctionboxService;
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询
|
|
|
+ * @param id
|
|
|
+ * @param code
|
|
|
+ * @param windpowerstationid
|
|
|
+ * @param inverterid
|
|
|
+ * @param pageNum
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/listByPage")
|
|
|
+ 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 = "inverterid", required = false) String inverterid,
|
|
|
+ @RequestParam(value = "pageNum", required = true) String pageNum,
|
|
|
+ @RequestParam(value = "pageSize", required = true) String pageSize) {
|
|
|
+ IPage<Junctionbox> list = junctionboxService.list(id, code, windpowerstationid, inverterid, pageNum, pageSize);
|
|
|
+ if (null != list) {
|
|
|
+ return R.ok().data(list);
|
|
|
+ } else {
|
|
|
+ return R.error().data("查询失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 插入
|
|
|
+ *
|
|
|
+ * @param junctionbox
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/save")
|
|
|
+ public R addAll(@RequestBody Junctionbox junctionbox) {
|
|
|
+ boolean b = junctionboxService.saveOrUpdate(junctionbox);
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("保存失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @DeleteMapping(value = "/remove-junctionbox/{ids}")
|
|
|
+ public R deleteAll(@PathVariable("ids") String ids) {
|
|
|
+ String[] strings = ids.split(",");
|
|
|
+ boolean b = junctionboxService.removeByIds(Arrays.asList(strings));
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("删除失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|