1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- 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.*;
- import javax.annotation.Resource;
- import java.util.Arrays;
- /**
- * <p>
- * 前端控制器
- * </p>
- *
- * @author wang
- * @since 2022-10-17
- */
- @RestController
- @RequestMapping("//junctionbox")
- 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("删除失败!");
- }
- }
- }
|