84 lines
2.8 KiB
Java
84 lines
2.8 KiB
Java
package com.gunshi.project.ss.controller;
|
|
|
|
|
|
import com.gunshi.core.result.R;
|
|
import com.gunshi.project.ss.entity.so.DocCenterPageSo;
|
|
import com.gunshi.project.ss.model.DocCenter;
|
|
import com.gunshi.project.ss.model.FileAssociations;
|
|
import com.gunshi.project.ss.service.DocCategoryService;
|
|
import com.gunshi.project.ss.service.DocCenterService;
|
|
import com.gunshi.project.ss.service.FileAssociationsService;
|
|
import com.ruoyi.system.mapper.SysUserMapper;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
@Tag(name = "资料中心")
|
|
@RestController
|
|
@RequestMapping(value = "/docCenter")
|
|
public class DocCenterController extends AbstractCommonFileController {
|
|
|
|
@Autowired
|
|
private DocCenterService docCenterService;
|
|
|
|
@Autowired
|
|
private FileAssociationsService fileService;
|
|
|
|
|
|
|
|
@Operation(description = "分页查询")
|
|
@PostMapping("/page")
|
|
public R<Page<DocCenter>> pageInfo(@RequestBody DocCenterPageSo pageSo){
|
|
Page<DocCenter> res = docCenterService.pageInfo(pageSo);
|
|
// List<DocCenter> records = res.getRecords();
|
|
// if(!records.isEmpty()){
|
|
// for (DocCenter record : records) {
|
|
// List<FileAssociations> files = fileService.getFiles(record.getBusinessName(), record.getId().toString());
|
|
// record.setFiles(files);
|
|
// }
|
|
// }
|
|
return R.ok(res);
|
|
}
|
|
|
|
@Operation(description = "新增")
|
|
@PostMapping("/insert")
|
|
public DocCenter insert(@RequestBody DocCenter docCenter){
|
|
boolean flag = docCenterService.saveData(docCenter);
|
|
// if(flag){
|
|
// fileService.saveFile(docCenter.getFiles(), docCenter.getBusinessName(), docCenter.getId().toString());
|
|
// }
|
|
return docCenter;
|
|
}
|
|
|
|
@Operation(description = "删除")
|
|
@GetMapping("/delete/{id}")
|
|
public R<Boolean> delete(@PathVariable("id") Integer id){
|
|
DocCenter center = docCenterService.deleteById(id);
|
|
// if(center != null){
|
|
// fileService.deleteFile(center.getBusinessName(), center.getId().toString());
|
|
// }
|
|
return R.ok(true);
|
|
}
|
|
|
|
|
|
@Operation(description = "修改")
|
|
@PostMapping("/edit")
|
|
public DocCenter edit(@RequestBody DocCenter docCenter){
|
|
boolean flag = docCenterService.updateData(docCenter);
|
|
// if(flag){
|
|
// fileService.saveFile(docCenter.getFiles(), docCenter.getBusinessName(), docCenter.getId().toString());
|
|
// }
|
|
return docCenter;
|
|
}
|
|
|
|
@Override
|
|
public String getGroupId() {
|
|
return "zzzx";
|
|
}
|
|
}
|