/*
|
* Copyright (c) 2018-2025, ztt 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 pig4cloud.com 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: ztt
|
*/
|
|
package com.chinaztt.mes.aps.controller;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.chinaztt.ztt.common.core.util.R;
|
import com.chinaztt.ztt.common.log.annotation.SysLog;
|
import com.chinaztt.mes.aps.entity.Scene;
|
import com.chinaztt.mes.aps.service.SceneService;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.AllArgsConstructor;
|
import org.springframework.web.bind.annotation.*;
|
|
|
/**
|
* 排场场景
|
*
|
* @author zhangxy
|
* @date 2020-10-29 11:16:16
|
*/
|
@RestController
|
@AllArgsConstructor
|
@RequestMapping("/scene" )
|
@Api(value = "scene", tags = "排场场景管理")
|
public class SceneController {
|
|
private final SceneService sceneService;
|
|
/**
|
* 分页查询
|
* @param page 分页对象
|
* @param scene 排场场景
|
* @return
|
*/
|
@ApiOperation(value = "分页查询", notes = "分页查询")
|
@GetMapping("/page" )
|
@PreAuthorize("@pms.hasPermission('aps_scene_view')" )
|
public R getScenePage(Page page, Scene scene) {
|
return R.ok(sceneService.page(page, Wrappers.query(scene)));
|
}
|
|
|
@ApiOperation(value = "查询所有", notes = "查询所有")
|
@GetMapping("/all" )
|
@PreAuthorize("@pms.hasPermission('aps_scene_view')" )
|
public R getSceneAll() {
|
return R.ok(sceneService.list());
|
}
|
|
|
/**
|
* 通过id查询排场场景
|
* @param id id
|
* @return R
|
*/
|
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
@GetMapping("/{id}" )
|
@PreAuthorize("@pms.hasPermission('aps_scene_view')" )
|
public R getById(@PathVariable("id" ) Long id) {
|
return R.ok(sceneService.getById(id));
|
}
|
|
/**
|
* 新增排场场景
|
* @param scene 排场场景
|
* @return R
|
*/
|
@ApiOperation(value = "新增排场场景", notes = "新增排场场景")
|
@SysLog("新增排场场景" )
|
@PostMapping
|
@PreAuthorize("@pms.hasPermission('aps_scene_add')" )
|
public R save(@RequestBody Scene scene) {
|
return R.ok(sceneService.save(scene));
|
}
|
|
/**
|
* 修改排场场景
|
* @param scene 排场场景
|
* @return R
|
*/
|
@ApiOperation(value = "修改排场场景", notes = "修改排场场景")
|
@SysLog("修改排场场景" )
|
@PutMapping
|
@PreAuthorize("@pms.hasPermission('aps_scene_edit')" )
|
public R updateById(@RequestBody Scene scene) {
|
return R.ok(sceneService.updateById(scene));
|
}
|
|
/**
|
* 通过id删除排场场景
|
* @param id id
|
* @return R
|
*/
|
@ApiOperation(value = "通过id删除排场场景", notes = "通过id删除排场场景")
|
@SysLog("通过id删除排场场景" )
|
@DeleteMapping("/{id}" )
|
@PreAuthorize("@pms.hasPermission('aps_scene_del')" )
|
public R removeById(@PathVariable Long id) {
|
return R.ok(sceneService.removeById(id));
|
}
|
|
}
|