HandleAffairsCommonController.java
4.59 KB
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
package com.trash.office.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.trash.office.domain.Conference;
import com.trash.office.domain.UploadFile;
import com.trash.office.domain.vo.ConferenceVo;
import com.trash.office.domain.vo.HandleAffairsCommonVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.trash.common.annotation.Log;
import com.trash.common.core.controller.BaseController;
import com.trash.common.core.domain.AjaxResult;
import com.trash.common.enums.BusinessType;
import com.trash.office.domain.HandleAffairsCommon;
import com.trash.office.service.IHandleAffairsCommonService;
import com.trash.common.utils.poi.ExcelUtil;
import com.trash.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 办文办事-普通类Controller
*
* @author 2c
* @date 2023-05-11
*/
@RestController
@RequestMapping("/office/handleAffairsCommon")
public class HandleAffairsCommonController extends BaseController
{
@Autowired
private IHandleAffairsCommonService handleAffairsCommonService;
/**
* 查询办文办事-普通类列表
*/
@PreAuthorize("@ss.hasPermi('office:handleAffairsCommon:list')")
@GetMapping("/list")
public TableDataInfo list(HandleAffairsCommon handleAffairsCommon)
{
startPage();
List<HandleAffairsCommon> list = handleAffairsCommonService.selectHandleAffairsCommonList(handleAffairsCommon);
return getDataTable(list);
}
/**
* 导出办文办事-普通类列表
*/
@PreAuthorize("@ss.hasPermi('office:handleAffairsCommon:export')")
@Log(title = "办文办事-普通类", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(HandleAffairsCommon handleAffairsCommon)
{
List<HandleAffairsCommon> list = handleAffairsCommonService.selectHandleAffairsCommonList(handleAffairsCommon);
for(int i = 0;i<list.size();i++){
list.get(i).setId((long)i+1);
}
ExcelUtil<HandleAffairsCommon> util = new ExcelUtil<HandleAffairsCommon>(HandleAffairsCommon.class);
return util.exportExcel(list, "办文办事-普通");
}
/**
* 获取办文办事-普通类详细信息
*/
@PreAuthorize("@ss.hasPermi('office:handleAffairsCommon:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(handleAffairsCommonService.selectHandleAffairsCommonById(id));
}
/**
* 新增办文办事-普通类
*/
@PreAuthorize("@ss.hasPermi('office:handleAffairsCommon:add')")
@Log(title = "办文办事-普通类", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestParam(value = "fileList") MultipartFile[] files, HandleAffairsCommon handleAffairsCommon) throws IOException
{
return toAjax(handleAffairsCommonService.insertHandleAffairsCommon(files,handleAffairsCommon));
}
/**
* 修改办文办事-普通类
*/
@PreAuthorize("@ss.hasPermi('office:handleAffairsCommon:edit')")
@Log(title = "办文办事-普通类", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestParam(value = "fileList") MultipartFile[] files,String handleAffairsCommon,String[] uploadFilesList) throws IOException
{
HandleAffairsCommonVo handleAffairsCommonVo = new HandleAffairsCommonVo();
handleAffairsCommonVo.setHandleAffairsCommon(JSON.parseObject(handleAffairsCommon, HandleAffairsCommon.class));
List<UploadFile> uploadFileList = new ArrayList<>();
for (String uploadFile : uploadFilesList) {
UploadFile uploadFile1 = JSON.parseObject(uploadFile,UploadFile.class);
if(uploadFile1!=null){
if(uploadFile1.getId()!=null){
uploadFileList.add(uploadFile1);
}
}
}
handleAffairsCommonVo.setUploadFiles(uploadFileList);
return toAjax(handleAffairsCommonService.updateHandleAffairsCommon(files,handleAffairsCommonVo));
}
/**
* 删除办文办事-普通类
*/
@PreAuthorize("@ss.hasPermi('office:handleAffairsCommon:remove')")
@Log(title = "办文办事-普通类", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(handleAffairsCommonService.deleteHandleAffairsCommonByIds(ids));
}
}