/*
|
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
*
|
* Redistribution and use in source and binary forms, with or without
|
* modification, are permitted provided that the following conditions are met:
|
*
|
* Redistributions of source code must retain the above copyright notice,
|
* this list of conditions and the following disclaimer.
|
* Redistributions in binary form must reproduce the above copyright
|
* notice, this list of conditions and the following disclaimer in the
|
* documentation and/or other materials provided with the distribution.
|
* Neither the name of the dreamlu.net developer nor the names of its
|
* contributors may be used to endorse or promote products derived from
|
* this software without specific prior written permission.
|
* Author: Chill 庄骞 (smallchill@163.com)
|
*/
|
package cn.gistack.sm.skPanorama.controller;
|
|
import cn.gistack.sm.skPanoramaState.entity.SkPanoramaStateEntity;
|
import cn.gistack.sm.skPanoramaState.service.ISkPanoramaStateService;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiParam;
|
import lombok.AllArgsConstructor;
|
import javax.validation.Valid;
|
|
import lombok.extern.slf4j.Slf4j;
|
import org.springblade.core.secure.BladeUser;
|
import org.springblade.core.mp.support.Condition;
|
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.utils.Func;
|
import org.springframework.web.bind.annotation.*;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import cn.gistack.sm.skPanorama.entity.SkPanoramaEntity;
|
import cn.gistack.sm.skPanorama.vo.SkPanoramaVO;
|
import cn.gistack.sm.skPanorama.wrapper.SkPanoramaWrapper;
|
import cn.gistack.sm.skPanorama.service.ISkPanoramaService;
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* 水库全景图 控制器
|
*
|
* @author BladeX
|
* @since 2024-03-29
|
*/
|
//@RestController
|
//@AllArgsConstructor
|
//@RequestMapping("/skPanorama")
|
//@Api(value = "水库全景图", tags = "水库全景图接口")
|
|
@Slf4j
|
@Api(tags="全景")
|
@RestController
|
@RequestMapping("/skPanorama")
|
@AllArgsConstructor
|
public class SkPanoramaController extends BladeController {
|
|
private final ISkPanoramaService skPanoramaService;
|
|
private final ISkPanoramaStateService skPanoramaStateService;
|
|
/**
|
* 水库全景图 详情
|
*/
|
@GetMapping("/detail")
|
@ApiOperation(value = "详情", notes = "传入skPanorama")
|
public R<SkPanoramaVO> detail(SkPanoramaEntity skPanorama) {
|
SkPanoramaEntity detail = skPanoramaService.getOne(Condition.getQueryWrapper(skPanorama));
|
return R.data(SkPanoramaWrapper.build().entityVO(detail));
|
}
|
/**
|
* 水库全景图 分页
|
*/
|
@GetMapping("/list")
|
@ApiOperation(value = "分页", notes = "传入skPanorama")
|
public R<IPage<SkPanoramaVO>> list(SkPanoramaEntity skPanorama, Query query) {
|
IPage<SkPanoramaEntity> pages = skPanoramaService.page(Condition.getPage(query), Condition.getQueryWrapper(skPanorama));
|
return R.data(SkPanoramaWrapper.build().pageVO(pages));
|
}
|
|
/**
|
* 水库全景图 自定义分页
|
*/
|
@GetMapping("/page")
|
@ApiOperation(value = "分页", notes = "传入skPanorama")
|
public R<IPage<SkPanoramaVO>> page(SkPanoramaVO skPanorama, Query query) {
|
IPage<SkPanoramaVO> pages = skPanoramaService.selectSkPanoramaPage(Condition.getPage(query), skPanorama);
|
return R.data(pages);
|
}
|
|
/**
|
* 水库全景图 新增
|
*/
|
@PostMapping("/save")
|
@ApiOperation(value = "新增", notes = "传入skPanorama")
|
public R save(@Valid @RequestBody SkPanoramaEntity skPanorama) {
|
return R.status(skPanoramaService.save(skPanorama));
|
}
|
|
|
/**
|
* 保存全景图的测站数据
|
* @param
|
* @return
|
*/
|
@PostMapping("/saveList")
|
@ApiOperation(value = "新增", notes = "传入skPanoramaState")
|
public R saveList(@Valid @RequestBody SkPanoramaEntity skPanorama) {
|
List<SkPanoramaStateEntity> stateLsit = skPanorama.getStateLsit();
|
List<SkPanoramaStateEntity> updateList = new ArrayList<>();
|
List<SkPanoramaStateEntity> addList = new ArrayList<>();
|
if (stateLsit != null && stateLsit.size()>0) {
|
// for (SkPanoramaStateEntity item :stateLsit) {
|
// Long id = item.getId();
|
// if (id != null) {
|
// // 更新
|
// updateList.add(item);
|
// } else {
|
// // 新增
|
// addList.add(item);
|
// }
|
// }
|
// boolean b = true;
|
// if (addList != null) {
|
// b = skPanoramaStateService.saveBatch(addList);
|
// }
|
// if (updateList != null) {
|
// b = skPanoramaStateService.saveOrUpdateBatch(updateList);
|
// }
|
boolean b =skPanoramaStateService.saveOrUpdateBatch(stateLsit);
|
|
return R.status(b);
|
}
|
return R.status(false);
|
}
|
|
|
/**
|
* 水库全景图 修改
|
*/
|
@PostMapping("/update")
|
@ApiOperation(value = "修改", notes = "传入skPanorama")
|
public R update(@Valid @RequestBody SkPanoramaEntity skPanorama) {
|
return R.status(skPanoramaService.updateById(skPanorama));
|
}
|
|
/**
|
* 水库全景图 新增或修改
|
*/
|
@PostMapping("/submit")
|
@ApiOperation(value = "新增或修改", notes = "传入skPanorama")
|
public R submit(@Valid @RequestBody SkPanoramaEntity skPanorama) {
|
return R.status(skPanoramaService.saveOrUpdate(skPanorama));
|
}
|
|
/**
|
* 水库全景图 删除
|
*/
|
@PostMapping("/remove")
|
@ApiOperation(value = "逻辑删除", notes = "传入ids")
|
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
return R.status(skPanoramaService.deleteLogic(Func.toLongList(ids)));
|
}
|
|
|
/**
|
* 根据水库id获取水库全景图片级水库测站
|
*/
|
@GetMapping("/getskAllInfo")
|
public R getSkPanoramaAllInfo(@RequestParam("resGuid")String resGuid) {
|
SkPanoramaEntity skPanoramaEntity = new SkPanoramaEntity();
|
skPanoramaEntity.setResGuid(resGuid);
|
List<SkPanoramaEntity> list = skPanoramaService.findList(skPanoramaEntity);
|
return R.data(list);
|
}
|
|
}
|