|
@@ -0,0 +1,131 @@
|
|
|
+package com.gyee.backconfig.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.gyee.backconfig.config.R;
|
|
|
+import com.gyee.backconfig.model.auto.ProBasicSquare;
|
|
|
+import com.gyee.backconfig.service.auto.IProBasicSquareService;
|
|
|
+import com.gyee.common.model.StringUtils;
|
|
|
+import oracle.security.o3logon.b;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 前端控制器(方阵)
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author wang
|
|
|
+ * @since 2022-10-14
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("//pro-basic-square")
|
|
|
+public class ProBasicSquareController {
|
|
|
+ @Resource
|
|
|
+ private IProBasicSquareService proBasicSquareService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @param code
|
|
|
+ * @param windpowerstationId
|
|
|
+ * @param name
|
|
|
+ * @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 = "name", required = false) String name,
|
|
|
+ @RequestParam(value = "pageNum", required = true) String pageNum,
|
|
|
+ @RequestParam(value = "pageSize", required = true) String pageSize) {
|
|
|
+ IPage<ProBasicSquare> list = proBasicSquareService.list(id, code, windpowerstationId, name, pageNum, pageSize);
|
|
|
+ if (null != list) {
|
|
|
+ return R.ok().data(list);
|
|
|
+ } else {
|
|
|
+ return R.error().data("查询失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/companys/{id}")
|
|
|
+ public R findOne(@PathVariable("id") String id) {
|
|
|
+ QueryWrapper<ProBasicSquare> qw = new QueryWrapper<>();
|
|
|
+ qw.eq("id", id);
|
|
|
+ ProBasicSquare ProBasicSquare = proBasicSquareService.getOne(qw);
|
|
|
+ if (StringUtils.isNotNull(ProBasicSquare)) {
|
|
|
+ return R.ok().data(ProBasicSquare);
|
|
|
+ } else {
|
|
|
+ return R.error().data("查询失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量插入
|
|
|
+ * @param proBasicSquare
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/save")
|
|
|
+ public R addAll(@RequestBody ProBasicSquare proBasicSquare) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ boolean b = proBasicSquareService.saveOrUpdate(proBasicSquare);
|
|
|
+ System.out.println(b);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+
|
|
|
+ }
|
|
|
+ System.out.println(2222);
|
|
|
+
|
|
|
+ boolean b = proBasicSquareService.saveOrUpdate(proBasicSquare);
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("保存失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @DeleteMapping(value = "/remove-companys/{ids}")
|
|
|
+ public R deleteAll(@PathVariable("ids") String ids) {
|
|
|
+ String[] strings = ids.split(",");
|
|
|
+ boolean b = proBasicSquareService.removeByIds(Arrays.asList(strings));
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("删除失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量修改
|
|
|
+ * @param list
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PutMapping(value = "/update")
|
|
|
+ public R update(@RequestBody List<ProBasicSquare> list) {
|
|
|
+ boolean b = proBasicSquareService.updateBatchById(list);
|
|
|
+ if (b) {
|
|
|
+ return R.ok().data(b);
|
|
|
+ } else {
|
|
|
+ return R.error().data("更新失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|