/*
|
* Copyright 2019-2020 Zheng Jie
|
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
* you may not use this file except in compliance with the License.
|
* You may obtain a copy of the License at
|
*
|
* http://www.apache.org/licenses/LICENSE-2.0
|
*
|
* Unless required by applicable law or agreed to in writing, software
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* See the License for the specific language governing permissions and
|
* limitations under the License.
|
*/
|
package me.zhengjie.modules.system.rest;
|
|
import me.zhengjie.annotation.Log;
|
import me.zhengjie.modules.system.domain.SysUserLevelOther;
|
import me.zhengjie.modules.system.service.SysUserLevelOtherService;
|
import me.zhengjie.modules.system.service.dto.SysUserLevelOtherQueryCriteria;
|
import org.springframework.data.domain.Pageable;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.http.HttpStatus;
|
import org.springframework.http.ResponseEntity;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
import io.swagger.annotations.*;
|
import java.io.IOException;
|
import javax.servlet.http.HttpServletResponse;
|
|
/**
|
* @website https://eladmin.vip
|
* @author 赵士淞
|
* @date 2022-12-26
|
**/
|
@RestController
|
@RequiredArgsConstructor
|
@Api(tags = "用户级别其他管理")
|
@RequestMapping("/api/sysUserLevelOther")
|
public class SysUserLevelOtherController {
|
|
private final SysUserLevelOtherService sysUserLevelOtherService;
|
|
@Log("导出数据")
|
@ApiOperation("导出数据")
|
@GetMapping(value = "/download")
|
@PreAuthorize("@el.check('sysUserLevelOther:download')")
|
public void exportSysUserLevelOther(HttpServletResponse response, SysUserLevelOtherQueryCriteria criteria) throws IOException {
|
sysUserLevelOtherService.download(sysUserLevelOtherService.queryAll(criteria), response);
|
}
|
|
@GetMapping
|
@Log("查询用户级别其他")
|
@ApiOperation("查询用户级别其他")
|
@PreAuthorize("@el.check('sysUserLevelOther:list')")
|
public ResponseEntity<Object> querySysUserLevelOther(SysUserLevelOtherQueryCriteria criteria, Pageable pageable){
|
return new ResponseEntity<>(sysUserLevelOtherService.queryAll(criteria,pageable),HttpStatus.OK);
|
}
|
|
@GetMapping(value = "/all")
|
@Log("查询用户级别其他")
|
@ApiOperation("查询用户级别其他")
|
@PreAuthorize("@el.check('sysUserLevelOther:list')")
|
public ResponseEntity<Object> querySysUserLevelOther(SysUserLevelOtherQueryCriteria criteria){
|
return new ResponseEntity<>(sysUserLevelOtherService.queryAll(criteria),HttpStatus.OK);
|
}
|
|
@GetMapping(value = "/targetYearMonth")
|
@Log("查询指定年月用户级别其他")
|
@ApiOperation("查询指定年月用户级别其他")
|
@PreAuthorize("@el.check('sysUserLevelOther:list')")
|
public ResponseEntity<Object> queryTargetYearMonth(SysUserLevelOtherQueryCriteria criteria){
|
return new ResponseEntity<>(sysUserLevelOtherService.queryTargetYearMonth(criteria),HttpStatus.OK);
|
}
|
|
@PostMapping
|
@Log("新增用户级别其他")
|
@ApiOperation("新增用户级别其他")
|
@PreAuthorize("@el.check('sysUserLevelOther:add')")
|
public ResponseEntity<Object> createSysUserLevelOther(@Validated @RequestBody SysUserLevelOther resources) throws Exception{
|
return new ResponseEntity<>(sysUserLevelOtherService.create(resources),HttpStatus.CREATED);
|
}
|
|
@PutMapping
|
@Log("修改用户级别其他")
|
@ApiOperation("修改用户级别其他")
|
@PreAuthorize("@el.check('sysUserLevelOther:edit')")
|
public ResponseEntity<Object> updateSysUserLevelOther(@Validated @RequestBody SysUserLevelOther resources) throws Exception{
|
sysUserLevelOtherService.update(resources);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
}
|
|
@DeleteMapping
|
@Log("删除用户级别其他")
|
@ApiOperation("删除用户级别其他")
|
@PreAuthorize("@el.check('sysUserLevelOther:del')")
|
public ResponseEntity<Object> deleteSysUserLevelOther(@RequestBody Long[] ids) {
|
sysUserLevelOtherService.deleteAll(ids);
|
return new ResponseEntity<>(HttpStatus.OK);
|
}
|
}
|