zh
2024-11-25 aac98d314df1563537e386ab9df150191035b280
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.ycl.controller;
 
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ycl.common.base.Result;
import com.ycl.common.group.Add;
import com.ycl.common.group.Update;
import com.ycl.domain.entity.FlowableType;
import com.ycl.domain.form.PlanForm;
import com.ycl.domain.query.PlanQuery;
import com.ycl.domain.vo.PlanVO;
import com.ycl.framework.utils.PageUtil;
import com.ycl.service.FlowableTypeService;
import com.ycl.service.PlanService;
import com.ycl.system.domain.base.AbsQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.constraints.NotEmpty;
import java.util.List;
 
/**
 * 工作流分类 前端控制器
 */
@Validated
@RequiredArgsConstructor
@Api(value = "工作流分类", tags = "工作流分类管理")
@RestController
@RequestMapping("/flowable_type")
public class FlowableTypeController {
 
    private final FlowableTypeService flowableTypeService;
 
    @PostMapping
    @ApiOperation(value = "添加", notes = "添加")
//    @PreAuthorize("hasAuthority('flowableType:add')")
    public Result add(@RequestBody @Validated(Add.class) FlowableType form) {
        flowableTypeService.save(form);
        return Result.ok();
    }
 
    @PutMapping
    @ApiOperation(value = "修改", notes = "修改")
//    @PreAuthorize("hasAuthority('flowableType:edit')")
    public Result update(@RequestBody @Validated(Update.class) FlowableType form) {
        flowableTypeService.updateById(form);
        return Result.ok();
    }
 
    @DeleteMapping("/{id}")
    @ApiOperation(value = "ID删除", notes = "ID删除")
//    @PreAuthorize("hasAuthority('flowableType:del')")
    public Result removeById(@PathVariable("id") String id) {
        flowableTypeService.removeById(id);
        return Result.ok();
    }
 
 
    @GetMapping("/page")
    @ApiOperation(value = "分页", notes = "分页")
//    @PreAuthorize("hasAuthority('flowableType:page')")
    public Result page(AbsQuery query) {
        IPage<FlowableType> page = PageUtil.getPage(query, FlowableType.class);
        flowableTypeService.page(page);
        return Result.ok().data(page.getRecords()).total(page.getTotal());
    }
 
}