2022-04-22 15:26:39 +08:00
|
|
|
package net.maku.system.controller;
|
|
|
|
|
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
import net.maku.framework.common.page.PageResult;
|
|
|
|
|
import net.maku.framework.common.query.Query;
|
|
|
|
|
import net.maku.framework.common.utils.Result;
|
|
|
|
|
import net.maku.system.convert.SysOauthClientConvert;
|
|
|
|
|
import net.maku.system.entity.SysOauthClientEntity;
|
|
|
|
|
import net.maku.system.service.SysOauthClientService;
|
|
|
|
|
import net.maku.system.vo.oauth.SysOauthClientPostVO;
|
|
|
|
|
import net.maku.system.vo.oauth.SysOauthClientPutVO;
|
|
|
|
|
import net.maku.system.vo.oauth.SysOauthClientVO;
|
2022-04-23 23:01:54 +08:00
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
2022-04-22 15:26:39 +08:00
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 客户端管理
|
|
|
|
|
*
|
|
|
|
|
* @author 阿沐 babamu@126.com
|
|
|
|
|
*/
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("sys/client")
|
|
|
|
|
@Tag(name="客户端管理")
|
|
|
|
|
@AllArgsConstructor
|
|
|
|
|
public class SysOauthClientController {
|
|
|
|
|
private final SysOauthClientService sysOauthClientService;
|
|
|
|
|
|
|
|
|
|
@GetMapping("page")
|
|
|
|
|
@Operation(summary = "分页")
|
2022-04-23 23:01:54 +08:00
|
|
|
@PreAuthorize("hasAuthority('sys:client:page')")
|
2022-04-22 15:26:39 +08:00
|
|
|
public Result<PageResult<SysOauthClientVO>> page(@Valid Query query){
|
|
|
|
|
PageResult<SysOauthClientVO> page = sysOauthClientService.page(query);
|
|
|
|
|
|
|
|
|
|
return Result.ok(page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("{id}")
|
|
|
|
|
@Operation(summary = "信息")
|
2022-04-23 23:01:54 +08:00
|
|
|
@PreAuthorize("hasAuthority('sys:client:info')")
|
2022-04-22 15:26:39 +08:00
|
|
|
public Result<SysOauthClientVO> get(@PathVariable("id") Long id){
|
|
|
|
|
SysOauthClientEntity entity = sysOauthClientService.getById(id);
|
|
|
|
|
|
|
|
|
|
return Result.ok(SysOauthClientConvert.INSTANCE.convert(entity));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping
|
|
|
|
|
@Operation(summary = "保存")
|
2022-04-23 23:01:54 +08:00
|
|
|
@PreAuthorize("hasAuthority('sys:client:save')")
|
2022-04-22 15:26:39 +08:00
|
|
|
public Result<String> save(@RequestBody SysOauthClientPostVO vo){
|
|
|
|
|
sysOauthClientService.save(vo);
|
|
|
|
|
|
|
|
|
|
return Result.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PutMapping
|
|
|
|
|
@Operation(summary = "修改")
|
2022-04-23 23:01:54 +08:00
|
|
|
@PreAuthorize("hasAuthority('sys:client:update')")
|
2022-04-22 15:26:39 +08:00
|
|
|
public Result<String> update(@RequestBody @Valid SysOauthClientPutVO vo){
|
|
|
|
|
sysOauthClientService.update(vo);
|
|
|
|
|
|
|
|
|
|
return Result.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@DeleteMapping
|
|
|
|
|
@Operation(summary = "删除")
|
2022-04-23 23:01:54 +08:00
|
|
|
@PreAuthorize("hasAuthority('sys:client:delete')")
|
2022-04-22 15:26:39 +08:00
|
|
|
public Result<String> delete(@RequestBody List<Long> idList){
|
|
|
|
|
sysOauthClientService.delete(idList);
|
|
|
|
|
|
|
|
|
|
return Result.ok();
|
|
|
|
|
}
|
|
|
|
|
}
|