|
@@ -0,0 +1,123 @@
|
|
|
+package com.gyee.configuration.controller.auto;
|
|
|
+
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.gyee.common.model.StringUtils;
|
|
|
+import com.gyee.common.util.CommonUtils;
|
|
|
+import com.gyee.configuration.config.R;
|
|
|
+import com.gyee.configuration.model.auto.Windturbinetestingpointnew;
|
|
|
+import com.gyee.configuration.service.auto.IWindturbinetestingpointnewService;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+
|
|
|
+ * <p>
|
|
|
+ * 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author 谢生杰
|
|
|
+ * @since 2022-06-17
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("//config")
|
|
|
+public class WindturbinetestingpointnewController {
|
|
|
+ @Resource
|
|
|
+ private IWindturbinetestingpointnewService windturbinetestingpointnewService;
|
|
|
+
|
|
|
+ @GetMapping(value = "/windturbinepoint")
|
|
|
+ public R findList(@RequestParam(value = "pageNum",required = true) String pageNum,
|
|
|
+ @RequestParam(value = "pageSize",required = true) String pageSize){
|
|
|
+ QueryWrapper<Windturbinetestingpointnew> qw = new QueryWrapper<>();
|
|
|
+ Page<Windturbinetestingpointnew> page = new Page<>(Integer.parseInt(pageNum),Integer.parseInt(pageSize));
|
|
|
+ Page<Windturbinetestingpointnew> p3DeviceFaultPage = windturbinetestingpointnewService.getBaseMapper().selectPage(page,qw);
|
|
|
+ List<Windturbinetestingpointnew> list = p3DeviceFaultPage.getRecords();
|
|
|
+ if (StringUtils.isNotEmpty(list)){
|
|
|
+ return R.ok(list.size()).data(list);
|
|
|
+ }else {
|
|
|
+ return R.error().data("查询失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/windturbinepoint/{id}")
|
|
|
+ public R findOne(@PathVariable("id") String id){
|
|
|
+ QueryWrapper<Windturbinetestingpointnew> qw = new QueryWrapper<>();
|
|
|
+ qw.eq("id",id);
|
|
|
+ Windturbinetestingpointnew windturbinetestingpointnew = windturbinetestingpointnewService.getOne(qw);
|
|
|
+ if (StringUtils.isNotNull(windturbinetestingpointnew)){
|
|
|
+ return R.ok().data(windturbinetestingpointnew);
|
|
|
+ }else {
|
|
|
+ return R.error().data("查询失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping(value = "/windturbinepoint")
|
|
|
+ public R addAll(@RequestBody List<Windturbinetestingpointnew> list){
|
|
|
+ list.stream().forEach(i->i.setId(CommonUtils.getUUID()));
|
|
|
+ boolean b = windturbinetestingpointnewService.saveBatch(list);
|
|
|
+ if (b){
|
|
|
+ return R.ok().data(b);
|
|
|
+ }else {
|
|
|
+ return R.error().data("保存失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping(value = "/meterpoint/{ids}")
|
|
|
+ public R deleteAll(@PathVariable("ids") String ids){
|
|
|
+ String[] strings = ids.split(",");
|
|
|
+ boolean b = windturbinetestingpointnewService.removeByIds(Arrays.asList(strings));
|
|
|
+ if (b){
|
|
|
+ return R.ok().data(b);
|
|
|
+ }else {
|
|
|
+ return R.error().data("删除失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping(value = "/meterpoint")
|
|
|
+ public R update(@RequestBody List<Windturbinetestingpointnew> list){
|
|
|
+ boolean b = windturbinetestingpointnewService.updateBatchById(list);
|
|
|
+ if (b){
|
|
|
+ return R.ok().data(b);
|
|
|
+ }else {
|
|
|
+ return R.error().data("更新失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @GetMapping(value = "/windturbinepoint/query")
|
|
|
+ public R findListByParam(@RequestParam(value = "wpid",required = false) String wpid,
|
|
|
+ @RequestParam(value = "wtid",required = false) String wtid,
|
|
|
+ @RequestParam(value = "uniformcode",required = false) String uniformcode,
|
|
|
+ @RequestParam(value = "name",required = false) String name,
|
|
|
+ @RequestParam(value = "code",required = false) String code,
|
|
|
+ @RequestParam(value = "pageNum",required = false) String pageNum,
|
|
|
+ @RequestParam(value = "pageSize",required = false) String pageSize){
|
|
|
+ QueryWrapper<Windturbinetestingpointnew> qw = new QueryWrapper<>();
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(wpid)){
|
|
|
+ qw.eq("windpowerstationid",wpid);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(wtid)){
|
|
|
+ qw.eq("windturbineid",wtid);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(uniformcode)){
|
|
|
+ qw.like("uniformcode",uniformcode);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(name)){
|
|
|
+ qw.like("name",name);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(code)){
|
|
|
+ qw.like("code",code);
|
|
|
+ }
|
|
|
+ Page<Windturbinetestingpointnew> page = new Page<>(Integer.parseInt(pageNum),Integer.parseInt(pageSize));
|
|
|
+ Page<Windturbinetestingpointnew> p3DeviceFaultPage = windturbinetestingpointnewService.getBaseMapper().selectPage(page, qw);
|
|
|
+ List<Windturbinetestingpointnew> resultlist = p3DeviceFaultPage.getRecords();
|
|
|
+ if (StringUtils.isNotNull(resultlist)) {
|
|
|
+ return R.ok(resultlist.size()).data(resultlist);
|
|
|
+ }else{
|
|
|
+ return R.error().message("访问失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|