¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.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 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.workflow.domain.bo.TestLeaveBo; |
| | | import org.dromara.workflow.domain.vo.TestLeaveVo; |
| | | import org.dromara.workflow.service.ITestLeaveService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 请å |
| | | * |
| | | * @author may |
| | | * @date 2023-07-21 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/demo/leave") |
| | | public class TestLeaveController extends BaseController { |
| | | |
| | | private final ITestLeaveService testLeaveService; |
| | | |
| | | /** |
| | | * æ¥è¯¢è¯·åå表 |
| | | */ |
| | | @SaCheckPermission("demo:leave:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<TestLeaveVo> list(TestLeaveBo bo, PageQuery pageQuery) { |
| | | return testLeaveService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºè¯·åå表 |
| | | */ |
| | | @SaCheckPermission("demo:leave:export") |
| | | @Log(title = "请å", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(TestLeaveBo bo, HttpServletResponse response) { |
| | | List<TestLeaveVo> list = testLeaveService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "请å", TestLeaveVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·å请å详ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("demo:leave:query") |
| | | @GetMapping("/{id}") |
| | | public R<TestLeaveVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(testLeaveService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢è¯·å |
| | | */ |
| | | @SaCheckPermission("demo:leave:add") |
| | | @Log(title = "请å", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<TestLeaveVo> add(@Validated(AddGroup.class) @RequestBody TestLeaveBo bo) { |
| | | return R.ok(testLeaveService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹è¯·å |
| | | */ |
| | | @SaCheckPermission("demo:leave:edit") |
| | | @Log(title = "请å", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<TestLeaveVo> edit(@Validated(EditGroup.class) @RequestBody TestLeaveBo bo) { |
| | | return R.ok(testLeaveService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤è¯·å |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("demo:leave:remove") |
| | | @Log(title = "请å", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(testLeaveService.deleteWithValidByIds(List.of(ids))); |
| | | } |
| | | } |