From c82afc8c461956e45be0aa29ca2a7fe3f18ee6f7 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期二, 28 十二月 2021 11:23:33 +0800 Subject: [PATCH] update RedisUtils 迁移到 utils/redis 包下 --- ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java index 8cab868..463ea3b 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java @@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.validate.AddGroup; import com.ruoyi.common.core.validate.EditGroup; +import com.ruoyi.common.core.validate.QueryGroup; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.demo.domain.bo.TestTreeBo; @@ -13,12 +14,14 @@ import com.ruoyi.demo.service.ITestTreeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.util.Arrays; @@ -45,7 +48,7 @@ @ApiOperation("鏌ヨ娴嬭瘯鏍戣〃鍒楄〃") @PreAuthorize("@ss.hasPermi('demo:tree:list')") @GetMapping("/list") - public AjaxResult<List<TestTreeVo>> list(@Validated TestTreeBo bo) { + public AjaxResult<List<TestTreeVo>> list(@Validated(QueryGroup.class) TestTreeBo bo) { List<TestTreeVo> list = iTestTreeService.queryList(bo); return AjaxResult.success(list); } @@ -57,10 +60,9 @@ @PreAuthorize("@ss.hasPermi('demo:tree:export')") @Log(title = "娴嬭瘯鏍戣〃", businessType = BusinessType.EXPORT) @GetMapping("/export") - public AjaxResult<TestTreeVo> export(@Validated TestTreeBo bo) { + public void export(@Validated TestTreeBo bo, HttpServletResponse response) { List<TestTreeVo> list = iTestTreeService.queryList(bo); - ExcelUtil<TestTreeVo> util = new ExcelUtil<TestTreeVo>(TestTreeVo.class); - return util.exportExcel(list, "娴嬭瘯鏍戣〃"); + ExcelUtil.exportExcel(list, "娴嬭瘯鏍戣〃", TestTreeVo.class, response); } /** @@ -69,8 +71,9 @@ @ApiOperation("鑾峰彇娴嬭瘯鏍戣〃璇︾粏淇℃伅") @PreAuthorize("@ss.hasPermi('demo:tree:query')") @GetMapping("/{id}") - public AjaxResult<TestTreeVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖") - @PathVariable("id") Long id) { + public AjaxResult<TestTreeVo> getInfo(@ApiParam("娴嬭瘯鏍慖D") + @NotNull(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable("id") Long id) { return AjaxResult.success(iTestTreeService.queryById(id)); } @@ -103,10 +106,11 @@ */ @ApiOperation("鍒犻櫎娴嬭瘯鏍戣〃") @PreAuthorize("@ss.hasPermi('demo:tree:remove')") - @Log(title = "娴嬭瘯鏍戣〃" , businessType = BusinessType.DELETE) + @Log(title = "娴嬭瘯鏍戣〃", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") - public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") - @PathVariable Long[] ids) { + public AjaxResult<Void> remove(@ApiParam("娴嬭瘯鏍慖D涓�") + @NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ids) { return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); } } -- Gitblit v1.9.3