云文档目录表新增文档类型字段
This commit is contained in:
@@ -23,6 +23,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,6 +53,9 @@ public class AiCloudDocController extends BaseController {
|
|||||||
@Operation(summary = "查询全部AI云文档目录表")
|
@Operation(summary = "查询全部AI云文档目录表")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<AiCloudDoc>> list(AiCloudDocParam param) {
|
public ApiResult<List<AiCloudDoc>> list(AiCloudDocParam param) {
|
||||||
|
if(param.getCompanyId()==null && param.getProjectId()==null) {
|
||||||
|
return success(new ArrayList<AiCloudDoc>());
|
||||||
|
}
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(aiCloudDocService.listRel(param));
|
return success(aiCloudDocService.listRel(param));
|
||||||
}
|
}
|
||||||
@@ -86,6 +91,16 @@ public class AiCloudDocController extends BaseController {
|
|||||||
aiCloudDoc.setCategoryId(aiCloudDocParent.getCategoryId());
|
aiCloudDoc.setCategoryId(aiCloudDocParent.getCategoryId());
|
||||||
aiCloudDoc.setCompanyId(aiCloudDocParent.getCompanyId());
|
aiCloudDoc.setCompanyId(aiCloudDocParent.getCompanyId());
|
||||||
}
|
}
|
||||||
|
// 设置 docType
|
||||||
|
if (aiCloudDoc.getProjectId() != null && aiCloudDoc.getProjectId() != 0) {
|
||||||
|
aiCloudDoc.setDocType(1);
|
||||||
|
} else if (aiCloudDoc.getProjectId() != null && aiCloudDoc.getProjectId() == 0 && aiCloudDoc.getCompanyId() != null && aiCloudDoc.getCompanyId() != 0) {
|
||||||
|
aiCloudDoc.setDocType(2);
|
||||||
|
} else if (aiCloudDoc.getProjectId() != null && aiCloudDoc.getProjectId() == 0 && aiCloudDoc.getCompanyId() != null && aiCloudDoc.getCompanyId() == 0) {
|
||||||
|
aiCloudDoc.setDocType(3);
|
||||||
|
} else {
|
||||||
|
aiCloudDoc.setDocType(0);
|
||||||
|
}
|
||||||
if (aiCloudDocService.save(aiCloudDoc)) {
|
if (aiCloudDocService.save(aiCloudDoc)) {
|
||||||
return success("添加成功");
|
return success("添加成功");
|
||||||
}
|
}
|
||||||
@@ -119,6 +134,18 @@ public class AiCloudDocController extends BaseController {
|
|||||||
@Operation(summary = "批量添加AI云文档目录表")
|
@Operation(summary = "批量添加AI云文档目录表")
|
||||||
@PostMapping("/batch")
|
@PostMapping("/batch")
|
||||||
public ApiResult<?> saveBatch(@RequestBody List<AiCloudDoc> list) {
|
public ApiResult<?> saveBatch(@RequestBody List<AiCloudDoc> list) {
|
||||||
|
for (AiCloudDoc aiCloudDoc : list) {
|
||||||
|
// 设置 docType
|
||||||
|
if (aiCloudDoc.getProjectId() != null && aiCloudDoc.getProjectId() != 0) {
|
||||||
|
aiCloudDoc.setDocType(1);
|
||||||
|
} else if (aiCloudDoc.getProjectId() != null && aiCloudDoc.getProjectId() == 0 && aiCloudDoc.getCompanyId() != null && aiCloudDoc.getCompanyId() != 0) {
|
||||||
|
aiCloudDoc.setDocType(2);
|
||||||
|
} else if (aiCloudDoc.getProjectId() != null && aiCloudDoc.getProjectId() == 0 && aiCloudDoc.getCompanyId() != null && aiCloudDoc.getCompanyId() == 0) {
|
||||||
|
aiCloudDoc.setDocType(3);
|
||||||
|
} else {
|
||||||
|
aiCloudDoc.setDocType(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (aiCloudDocService.saveBatch(list)) {
|
if (aiCloudDocService.saveBatch(list)) {
|
||||||
return success("添加成功");
|
return success("添加成功");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,21 +24,24 @@ public class AiCloudDoc implements Serializable {
|
|||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@Schema(description = "云目录ID")
|
@Schema(description = "上级目录ID")
|
||||||
private String categoryId;
|
private Integer parentId;
|
||||||
|
|
||||||
@Schema(description = "项目ID")
|
|
||||||
private Integer projectId;
|
|
||||||
|
|
||||||
@Schema(description = "单位ID")
|
@Schema(description = "单位ID")
|
||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
|
|
||||||
@Schema(description = "上级目录ID")
|
@Schema(description = "项目ID")
|
||||||
private Integer parentId;
|
private Integer projectId;
|
||||||
|
|
||||||
|
@Schema(description = "文档类型: 0=未分类, 1=项目目录, 2=公司目录, 3=公共目录")
|
||||||
|
private Integer docType;
|
||||||
|
|
||||||
@Schema(description = "目录名称")
|
@Schema(description = "目录名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "云目录ID")
|
||||||
|
private String categoryId;
|
||||||
|
|
||||||
@Schema(description = "排序(数字越小越靠前)")
|
@Schema(description = "排序(数字越小越靠前)")
|
||||||
private Integer sortNumber;
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,16 @@ public class AiCloudDocServiceImpl extends ServiceImpl<AiCloudDocMapper, AiCloud
|
|||||||
topDirectory.setTenantId(oaCompany.getTenantId());
|
topDirectory.setTenantId(oaCompany.getTenantId());
|
||||||
topDirectory.setCreateTime(LocalDateTime.now());
|
topDirectory.setCreateTime(LocalDateTime.now());
|
||||||
topDirectory.setUpdateTime(LocalDateTime.now());
|
topDirectory.setUpdateTime(LocalDateTime.now());
|
||||||
|
// 设置 docType
|
||||||
|
if (projectId != null && projectId != 0) {
|
||||||
|
topDirectory.setDocType(1);
|
||||||
|
} else if (projectId != null && projectId == 0 && oaCompany.getCompanyId() != null && oaCompany.getCompanyId() != 0) {
|
||||||
|
topDirectory.setDocType(2);
|
||||||
|
} else if (projectId != null && projectId == 0 && oaCompany.getCompanyId() != null && oaCompany.getCompanyId() == 0) {
|
||||||
|
topDirectory.setDocType(3);
|
||||||
|
} else {
|
||||||
|
topDirectory.setDocType(0);
|
||||||
|
}
|
||||||
this.save(topDirectory);
|
this.save(topDirectory);
|
||||||
}
|
}
|
||||||
Integer topDirId = topDirectory.getId();
|
Integer topDirId = topDirectory.getId();
|
||||||
@@ -198,6 +208,16 @@ public class AiCloudDocServiceImpl extends ServiceImpl<AiCloudDocMapper, AiCloud
|
|||||||
doc.setTenantId(oaCompany.getTenantId());
|
doc.setTenantId(oaCompany.getTenantId());
|
||||||
doc.setCreateTime(LocalDateTime.now());
|
doc.setCreateTime(LocalDateTime.now());
|
||||||
doc.setUpdateTime(LocalDateTime.now());
|
doc.setUpdateTime(LocalDateTime.now());
|
||||||
|
// 设置 docType
|
||||||
|
if (projectId != null && projectId != 0) {
|
||||||
|
doc.setDocType(1);
|
||||||
|
} else if (projectId != null && projectId == 0 && oaCompany.getCompanyId() != null && oaCompany.getCompanyId() != 0) {
|
||||||
|
doc.setDocType(2);
|
||||||
|
} else if (projectId != null && projectId == 0 && oaCompany.getCompanyId() != null && oaCompany.getCompanyId() == 0) {
|
||||||
|
doc.setDocType(3);
|
||||||
|
} else {
|
||||||
|
doc.setDocType(0);
|
||||||
|
}
|
||||||
newDirectories.add(doc);
|
newDirectories.add(doc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,13 @@ public class OaCompanyServiceImpl extends ServiceImpl<OaCompanyMapper, OaCompany
|
|||||||
topDirectory.setTenantId(oaCompany.getTenantId());
|
topDirectory.setTenantId(oaCompany.getTenantId());
|
||||||
topDirectory.setCreateTime(LocalDateTime.now());
|
topDirectory.setCreateTime(LocalDateTime.now());
|
||||||
topDirectory.setUpdateTime(LocalDateTime.now());
|
topDirectory.setUpdateTime(LocalDateTime.now());
|
||||||
|
// 设置 docType
|
||||||
|
if (oaCompany.getCompanyId() != null && oaCompany.getCompanyId() != 0) {
|
||||||
|
topDirectory.setDocType(2);
|
||||||
|
} else {
|
||||||
|
topDirectory.setDocType(0);
|
||||||
|
}
|
||||||
|
|
||||||
// 保存顶级目录并获取其ID
|
// 保存顶级目录并获取其ID
|
||||||
aiCloudDocService.save(topDirectory);
|
aiCloudDocService.save(topDirectory);
|
||||||
Integer topDirId = topDirectory.getId(); // 假设实体类有getDocId()方法
|
Integer topDirId = topDirectory.getId(); // 假设实体类有getDocId()方法
|
||||||
@@ -162,6 +168,12 @@ public class OaCompanyServiceImpl extends ServiceImpl<OaCompanyMapper, OaCompany
|
|||||||
doc.setTenantId(oaCompany.getTenantId());
|
doc.setTenantId(oaCompany.getTenantId());
|
||||||
doc.setCreateTime(LocalDateTime.now());
|
doc.setCreateTime(LocalDateTime.now());
|
||||||
doc.setUpdateTime(LocalDateTime.now());
|
doc.setUpdateTime(LocalDateTime.now());
|
||||||
|
// 设置 docType
|
||||||
|
if (oaCompany.getCompanyId() != null && oaCompany.getCompanyId() != 0) {
|
||||||
|
doc.setDocType(2);
|
||||||
|
} else {
|
||||||
|
doc.setDocType(0);
|
||||||
|
}
|
||||||
directories.add(doc);
|
directories.add(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user