| | |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | 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.TestDemoBo; |
| | |
| | | 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; |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 测试单表Controller |
| | |
| | | @ApiOperation("查询测试单表列表") |
| | | @PreAuthorize("@ss.hasPermi('demo:demo:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<TestDemoVo> list(@Validated TestDemoBo bo) { |
| | | public TableDataInfo<TestDemoVo> list(@Validated(QueryGroup.class) TestDemoBo bo) { |
| | | return iTestDemoService.queryPageList(bo); |
| | | } |
| | | |
| | |
| | | @ApiOperation("自定义分页查询") |
| | | @PreAuthorize("@ss.hasPermi('demo:demo:list')") |
| | | @GetMapping("/page") |
| | | public TableDataInfo<TestDemoVo> page(@Validated TestDemoBo bo) { |
| | | public TableDataInfo<TestDemoVo> page(@Validated(QueryGroup.class) TestDemoBo bo) { |
| | | return iTestDemoService.customPageList(bo); |
| | | } |
| | | |
| | |
| | | @PreAuthorize("@ss.hasPermi('demo:demo:export')") |
| | | @Log(title = "测试单表", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | public AjaxResult<TestDemoVo> export(@Validated TestDemoBo bo) { |
| | | public void export(@Validated TestDemoBo bo, HttpServletResponse response) { |
| | | List<TestDemoVo> list = iTestDemoService.queryList(bo); |
| | | ExcelUtil<TestDemoVo> util = new ExcelUtil<TestDemoVo>(TestDemoVo.class); |
| | | return util.exportExcel(list, "测试单表"); |
| | | // 测试雪花id导出 |
| | | // for (TestDemoVo vo : list) { |
| | | // vo.setId(1234567891234567893L); |
| | | // } |
| | | ExcelUtil.exportExcel(list, "测试单表", TestDemoVo.class, response); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation("新增测试单表") |
| | | @PreAuthorize("@ss.hasPermi('demo:demo:add')") |
| | | @Log(title = "测试单表", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit |
| | | @RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS, message = "不允许重复提交") |
| | | @PostMapping() |
| | | public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody TestDemoBo bo) { |
| | | return toAjax(iTestDemoService.insertByBo(bo) ? 1 : 0); |