|
@@ -0,0 +1,131 @@
|
|
|
+package org.dromara.system.controller;
|
|
|
+
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
+import jakarta.validation.constraints.NotEmpty;
|
|
|
+import jakarta.validation.constraints.NotNull;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.dromara.common.core.domain.R;
|
|
|
+import org.dromara.common.core.validate.AddGroup;
|
|
|
+import org.dromara.common.core.validate.EditGroup;
|
|
|
+import org.dromara.common.excel.utils.ExcelUtil;
|
|
|
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
|
+import org.dromara.common.log.annotation.Log;
|
|
|
+import org.dromara.common.log.enums.BusinessType;
|
|
|
+import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
+import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
+import org.dromara.common.web.core.BaseController;
|
|
|
+import org.dromara.system.domain.bo.GameNavigatorBo;
|
|
|
+import org.dromara.system.domain.vo.GameNavigatorVo;
|
|
|
+import org.dromara.system.domain.vo.VsNavBottomMainVo;
|
|
|
+import org.dromara.system.service.IGameNavigatorService;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 赛事主导航表管理
|
|
|
+ *
|
|
|
+ * @author system
|
|
|
+ * @date 2025-01-20
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@Validated
|
|
|
+@RequiredArgsConstructor
|
|
|
+@RestController
|
|
|
+@RequestMapping("/system/scenic/navigator")
|
|
|
+public class GameNavigatorController extends BaseController {
|
|
|
+
|
|
|
+ private final IGameNavigatorService gameNavigatorService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询底部主导航表列表
|
|
|
+ */
|
|
|
+ @SaCheckPermission("scenic:navigator:list")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo<GameNavigatorVo> list(GameNavigatorBo bo, PageQuery pageQuery) {
|
|
|
+ return gameNavigatorService.queryPageList(bo, pageQuery);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出底部主导航表列表
|
|
|
+ */
|
|
|
+ @SaCheckPermission("scenic:navigator:export")
|
|
|
+ @Log(title = "底部主导航表", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/export")
|
|
|
+ public void export(GameNavigatorBo bo, HttpServletResponse response) {
|
|
|
+ try {
|
|
|
+ List<GameNavigatorVo> list = gameNavigatorService.queryList(bo);
|
|
|
+ ExcelUtil.exportExcel(list, "底部主导航表", GameNavigatorVo.class, response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 如果导出过程中出现异常,重置Content-Type并返回错误信息
|
|
|
+ response.reset();
|
|
|
+ response.setContentType("application/json;charset=UTF-8");
|
|
|
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
|
|
+ try {
|
|
|
+ response.getWriter().write("{\"code\":500,\"msg\":\"导出失败:" + e.getMessage() + "\"}");
|
|
|
+ } catch (IOException ex) {
|
|
|
+ // 忽略写入错误
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取底部主导航表详细信息
|
|
|
+ *
|
|
|
+ * @param navId 主键
|
|
|
+ */
|
|
|
+ @SaCheckPermission("scenic:navigator:query")
|
|
|
+ @GetMapping("/{navId}")
|
|
|
+ public R<GameNavigatorVo> getInfo(@NotNull(message = "主键不能为空")
|
|
|
+ @PathVariable Long navId) {
|
|
|
+ return R.ok(gameNavigatorService.queryById(navId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增底部主导航表
|
|
|
+ */
|
|
|
+ @SaCheckPermission("scenic:navigator:add")
|
|
|
+ @Log(title = "底部主导航表", businessType = BusinessType.INSERT)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PostMapping()
|
|
|
+ public R<Void> add(@Validated(AddGroup.class) @RequestBody GameNavigatorBo bo) {
|
|
|
+ return toAjax(gameNavigatorService.insertByBo(bo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改底部主导航表
|
|
|
+ */
|
|
|
+ @SaCheckPermission("scenic:navigator:edit")
|
|
|
+ @Log(title = "底部主导航表", businessType = BusinessType.UPDATE)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PutMapping()
|
|
|
+ public R<Void> edit(@Validated(EditGroup.class) @RequestBody GameNavigatorBo bo) {
|
|
|
+ return toAjax(gameNavigatorService.updateByBo(bo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除底部主导航表
|
|
|
+ *
|
|
|
+ * @param ids 主键串
|
|
|
+ */
|
|
|
+ @SaCheckPermission("scenic:navigator:remove")
|
|
|
+ @Log(title = "底部主导航表", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
|
+ @PathVariable Long[] ids) {
|
|
|
+ return toAjax(gameNavigatorService.deleteWithValidByIds(List.of(ids), true));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取启用的底部主导航列表
|
|
|
+ */
|
|
|
+ @GetMapping("/enabled")
|
|
|
+ public R<List<GameNavigatorVo>> getEnabledNavList() {
|
|
|
+ return R.ok(gameNavigatorService.getEnabledNavList());
|
|
|
+ }
|
|
|
+
|
|
|
+}
|