123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- package com.gyee.backconfig.controller;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.gyee.backconfig.config.R;
- import com.gyee.backconfig.model.auto.ProBasicWindpowerstation;
- import com.gyee.backconfig.service.auto.IProBasicWindpowerstationService;
- import com.gyee.backconfig.vo.WindpowerstationAdmVo;
- import com.gyee.common.model.StringUtils;
- 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-15
- */
- @RestController
- @RequestMapping("//pro-basic-windpowerstation")
- public class ProBasicWindpowerstationController {
- @Resource
- private IProBasicWindpowerstationService proBasicWindpowerstationService;
- /**
- * 查询
- *
- * @param id
- * @param name
- * @param code
- * @param companyId
- * @param pageNum
- * @param pageSize
- * @return
- */
- @GetMapping(value = "/List")
- public R findList(@RequestParam(value = "id", required = false) String id,
- @RequestParam(value = "name", required = false) String name,
- @RequestParam(value = "code", required = false) String code,
- @RequestParam(value = "companyId", required = false) String companyId,
- @RequestParam(value = "pageNum", required = true) String pageNum,
- @RequestParam(value = "pageSize", required = true) String pageSize) {
- IPage<ProBasicWindpowerstation> list = proBasicWindpowerstationService.getList(id, name, code, companyId, 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 ProBasicWindpowerstation proBasicWindpowerstation) {
- boolean b = proBasicWindpowerstationService.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 = proBasicWindpowerstationService.removeByIds(Arrays.asList(strings));
- if (b) {
- return R.ok().data(b);
- } else {
- return R.error().data("删除失败!");
- }
- }
- /**
- * 行政管理区域风电场列表
- * @param id
- * @param regionId
- * @param regionId
- * @return
- */
- @CrossOrigin(origins = "*", maxAge = 3600)
- @GetMapping(value = "/getAdmList")
- public R getAdmList(
- @RequestParam(value = "id",required = false) String id,
- @RequestParam(value = "regionId",required = false) String regionId,
- @RequestParam(value = "companyId",required = false) String companyId){
- try {
- List<WindpowerstationAdmVo> list = proBasicWindpowerstationService.getList(id,regionId,companyId);
- if (null != list){
- return R.ok().data(list);
- }else {
- return R.error().data("查询失败!");
- }
- } catch (Exception e) {
- e.printStackTrace();
- return R.error().data("查询失败!");
- }
- }
- }
|