tj
2025-06-05 2d549a04870d1315868a7cf19952b64e8071e711
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package com.cloudroam.controller.v1;
 
 
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cloudroam.bo.meeting.MeetingBO;
import com.cloudroam.bo.meeting.MeetingUserDaily;
import com.cloudroam.bo.projectModule.ProjectModuleBO;
import com.cloudroam.bo.projectModule.ProjectModuleTreeBO;
import com.cloudroam.common.annotation.LogParams;
import com.cloudroam.common.util.PageUtil;
import com.cloudroam.dto.meeting.CreateMeetingDTO;
import com.cloudroam.dto.meeting.MeetingPageDTO;
import com.cloudroam.dto.meeting.UpdateMeetingDTO;
import com.cloudroam.dto.projectInfo.QueryProjectInfoDTO;
import com.cloudroam.dto.projectModule.CreateProjectModuleDTO;
import com.cloudroam.dto.projectModule.ProjectModulePageDTO;
import com.cloudroam.model.MeetingDO;
import com.cloudroam.service.ProjectModuleService;
import io.github.talelin.autoconfigure.exception.NotFoundException;
import io.github.talelin.core.annotation.Logger;
import io.github.talelin.core.annotation.LoginRequired;
import io.github.talelin.core.annotation.PermissionMeta;
import io.github.talelin.core.annotation.PermissionModule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.cloudroam.model.ProjectModuleDO;
import com.cloudroam.vo.CreatedVO;
import com.cloudroam.vo.DeletedVO;
import com.cloudroam.vo.PageResponseVO;
import com.cloudroam.vo.UpdatedVO;
 
import javax.validation.constraints.Min;
import javax.validation.constraints.Max;
import javax.validation.constraints.Positive;
import java.util.List;
 
/**
* @author generator@TaoJie
* @since 2024-08-16
*/
@RestController
@RequestMapping("/v1/project-module")
@PermissionModule("项目模块管理")
public class ProjectModuleController {
 
    @Autowired
    private ProjectModuleService projectModuleService;
 
    @PostMapping("")
    @PermissionMeta(value = "项目模块创建", mount =true)
    @Logger(template = "{user.nickname} 创建了项目模块 ")
    @LoginRequired
    @LogParams
    public CreatedVO create(@RequestBody @Validated CreateProjectModuleDTO validator) {
 
         projectModuleService.createProjectModule(validator);
 
         return new CreatedVO();
    }
 
    @PutMapping("/{id}")
    @LoginRequired
    @PermissionMeta(value = "项目模块更新",mount = true)
    @Logger(template = "{user.nickname} 更新了项目模块")
    public UpdatedVO update(@PathVariable  String id,@RequestBody @Validated CreateProjectModuleDTO validator) {
        if(StrUtil.isBlank(id)){
            throw new NotFoundException("传入的Id不能为空");
        }
        ProjectModuleDO moduleDO=projectModuleService.getById(id);
        if(moduleDO == null){
            throw new NotFoundException("项目模块不存在");
        }
 
        projectModuleService.updateProjectModule(validator);
 
        return new UpdatedVO();
    }
 
    @DeleteMapping("/{id}")
    @LoginRequired
    @PermissionMeta(value = "项目模块删除",mount = false)
    @Logger(template = "{user.nickname} 项目模块删除 ")
    public DeletedVO delete(@PathVariable  String id) {
        if(StrUtil.isBlank(id)){
            throw new NotFoundException("传入的Id不能为空");
        }
        ProjectModuleDO moduleDO=projectModuleService.getById(id);
        if(moduleDO == null){
            throw new NotFoundException("项目模块不存在");
        }
        projectModuleService.deleteProjectModuleById(id);
 
        return new DeletedVO();
    }
 
    @GetMapping("/{id}")
    public ProjectModuleDO get(@PathVariable(value = "id") String id) {
 
        return projectModuleService.getById(id);
    }
 
    @GetMapping("/bo/{id}")
    public ProjectModuleTreeBO getProjectModuleTreeBO(@PathVariable(value = "id") String id) {
 
        return projectModuleService.getProjectModuleTreeBOById(id);
    }
 
    @GetMapping("/page")
    @PermissionMeta(value = "项目模块列表", module = "项目模块管理",mount = true)
    @Logger(template = "{user.nickname} 查看了项目模块列表")
    @LoginRequired
    public PageResponseVO<ProjectModuleTreeBO> page(
             @Validated QueryProjectInfoDTO dto
            ) {
        IPage<ProjectModuleTreeBO> iPage=projectModuleService.getProjectModulePage(dto);
        return PageUtil.build(iPage);
    }
 
 
    @GetMapping("/tree/list")
    @PermissionMeta(value = "提取项目模块信息" ,mount = false)
    @Logger(template = "{user.nickname} 提取取项目模块信息")
    @LoginRequired
    public List<ProjectModuleTreeBO> listTree(ProjectModulePageDTO dto ) {
        return projectModuleService.listTree(dto);
    }
 
 
    @GetMapping("/list")
    @PermissionMeta(value = "提取项目模块信息" ,mount = false)
    @Logger(template = "{user.nickname} 提取取项目模块信息")
    @LoginRequired
    public List<ProjectModuleDO> list(ProjectModulePageDTO dto ) {
 
        return projectModuleService.list(dto);
    }
 
 
 
 
}