package com.iailab.module.system.controller.admin.app;
|
|
import com.iailab.framework.common.pojo.CommonResult;
|
import com.iailab.framework.common.pojo.PageResult;
|
import com.iailab.framework.common.util.object.BeanUtils;
|
import com.iailab.module.system.controller.admin.app.vo.*;
|
import com.iailab.module.system.dal.dataobject.app.AppGroupDO;
|
import com.iailab.module.system.service.app.AppGroupService;
|
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import javax.validation.Valid;
|
|
import java.util.List;
|
|
import static com.iailab.framework.common.pojo.CommonResult.success;
|
|
/**
|
* @author Houzhongjian
|
* @Description
|
* @createTime 2024年09月20日
|
*/
|
@Tag(name = "管理后台 - 应用分组")
|
@RestController
|
@RequestMapping("/system/app-group")
|
public class AppGroupController {
|
|
@Resource
|
private AppGroupService appGroupService;
|
|
@PostMapping("/create")
|
@Operation(summary = "创建应用分组")
|
@PreAuthorize("@ss.hasPermission('system:app-group:create')")
|
public CommonResult<Long> createApp(@Valid @RequestBody AppGroupSaveReqVO createReqVO) {
|
return success(appGroupService.create(createReqVO));
|
}
|
|
@PutMapping("/update")
|
@Operation(summary = "更新应用分组")
|
@PreAuthorize("@ss.hasPermission('system:app-group:update')")
|
public CommonResult<Boolean> updateApp(@Valid @RequestBody AppGroupSaveReqVO updateReqVO) {
|
appGroupService.update(updateReqVO);
|
return success(true);
|
}
|
|
@DeleteMapping("/delete")
|
@Operation(summary = "删除应用分组")
|
@Parameter(name = "id", description = "ID", required = true, example = "1024")
|
@PreAuthorize("@ss.hasPermission('system:app-group:delete')")
|
public CommonResult<Boolean> deleteAppGroup(@RequestParam("id") Long id) {
|
appGroupService.delete(id);
|
return success(true);
|
}
|
|
@GetMapping("/get")
|
@Operation(summary = "获得应用分组")
|
@Parameter(name = "id", description = "ID", required = true, example = "1024")
|
@PreAuthorize("@ss.hasPermission('system:app-group:query')")
|
public CommonResult<AppGroupRespVO> getInfo(@RequestParam("id") Long id) {
|
AppGroupDO data = appGroupService.getInfo(id);
|
return success(BeanUtils.toBean(data, AppGroupRespVO.class));
|
}
|
|
@GetMapping("/page")
|
@Operation(summary = "获得分页")
|
@PreAuthorize("@ss.hasPermission('system:app-group:query')")
|
public CommonResult<PageResult<AppGroupRespVO>> getAppGroupPage(@Valid AppGroupPageReqVO pageVO) {
|
PageResult<AppGroupDO> pageResult = appGroupService.getPage(pageVO);
|
return success(BeanUtils.toBean(pageResult, AppGroupRespVO.class));
|
}
|
|
@GetMapping("/getAppGroupList")
|
@Operation(summary = "获得应用分组列表")
|
@PreAuthorize("@ss.hasPermission('system:app-group:query')")
|
public CommonResult<List<AppGroupRespVO>> getAppList() {
|
List<AppGroupDO> appGroupDOS = appGroupService.getList();
|
return success(BeanUtils.toBean(appGroupDOS, AppGroupRespVO.class));
|
}
|
}
|