From 1b842485004fbe9dcbbbe454bb161a71e9109466 Mon Sep 17 00:00:00 2001 From: luyie Date: Tue, 10 Sep 2024 17:27:31 +0800 Subject: [PATCH] =?UTF-8?q?add:=E5=A4=A7=E6=A8=A1=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E7=9F=A5=E8=AF=86=E5=BA=93=EF=BC=8C=E6=96=87=E4=BB=B6=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/KnowledgeFileInfoController.java | 76 ++++++++++++++++++++++ .../maintenance/entity/KnowledgeFileInfo.java | 56 ++++++++++++++++ .../mapper/KnowledgeFileInfoMapper.java | 11 ++++ .../service/KnowledgeFileInfoService.java | 11 ++++ .../service/impl/AgentLogServiceImpl.java | 1 - .../service/impl/KnowledgeFileInfoServiceImpl.java | 19 ++++++ 6 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileInfoMapper.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java new file mode 100644 index 0000000..086c632 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/KnowledgeFileInfoController.java @@ -0,0 +1,76 @@ +package com.hnac.hzims.bigmodel.maintenance.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileInfo; +import com.hnac.hzims.bigmodel.maintenance.service.KnowledgeFileInfoService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.oss.model.BladeFile; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springblade.resource.feign.IOssClient; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +/** + * @Author: ypj + * @Date: 2024/9/10 16:44 + */ +@RestController +@Slf4j +@RequestMapping("/knowledge/file") +@Api(value = "知识库文件管理", tags = "知识库文件管理") +@AllArgsConstructor +public class KnowledgeFileInfoController { + private final KnowledgeFileInfoService knowledgeFileInfoService; + private final IOssClient ossClient; + + @GetMapping("/listPage") + @ApiOperation(value = "分页查询") + @ApiOperationSupport(order = 1) + public R> listPage(Query query, KnowledgeFileInfo req) { + return R.data(knowledgeFileInfoService.page(Condition.getPage(query), + Condition.getQueryWrapper(new KnowledgeFileInfo(), req).orderByDesc(KnowledgeFileInfo::getCreateTime))); + } + + @GetMapping("/detail") + @ApiOperation(value = "查看详情") + @ApiOperationSupport(order = 2) + public R detail(@RequestParam @ApiParam("主键ID") Long id) { + return R.data(knowledgeFileInfoService.getById(id)); + } + + @PostMapping("/save") + @ApiOperation(value = "保存") + @ApiOperationSupport(order = 3) + public R save(@RequestBody KnowledgeFileInfo req) { + return R.status(knowledgeFileInfoService.save(req)); + } + + @PutMapping("/update") + @ApiOperation(value = "编辑") + @ApiOperationSupport(order = 4) + public R update(@RequestBody KnowledgeFileInfo req) { + return R.status(knowledgeFileInfoService.updateById(req)); + } + + @DeleteMapping("/remove") + @ApiOperation(value = "删除") + @ApiOperationSupport(order = 5) + public R remove(@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) { + return R.status(knowledgeFileInfoService.removeByIds(Func.toLongList(",", ids))); + } + + @PostMapping("/upload") + @ApiOperation(value = "上传文件") + @ApiOperationSupport(order = 6) + public R upload(@ApiParam(value = "上传文件", required = true) @RequestParam("file") MultipartFile file) { + return ossClient.putFile(file); + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java new file mode 100644 index 0000000..d3ff16d --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/KnowledgeFileInfo.java @@ -0,0 +1,56 @@ +package com.hnac.hzims.bigmodel.maintenance.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tenant.mp.TenantEntity; + +import java.io.Serializable; + +/** + * @Author: ypj + * @Date: 2024/9/10 15:17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("HZIMS_KNOWLEDGE_FILE_INFO") +@ApiModel(value = "知识库文件信息",description = "知识库文件信息") +public class KnowledgeFileInfo extends TenantEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("文件名称") + private String name; + + @ApiModelProperty("文件url") + private String url; + + @ApiModelProperty("文件大小") + private Long size; + + @ApiModelProperty("简介") + private String briefs; + + @ApiModelProperty("标签") + private String tags; + + @ApiModelProperty("业务领域") + private String domain; + + @ApiModelProperty("权限等级,5个等级") + @TableField("AUTHORITY_CLASS") + private Integer authorityClass; + + @ApiModelProperty("是否可见,0为不可见,1为可见") + private Integer visible; + + @ApiModelProperty("文件状态,0为未入库,1为已入库") + @TableField("FILE_STATUS") + private Integer fileStatus; + + @ApiModelProperty("备注") + private String remark; + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileInfoMapper.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileInfoMapper.java new file mode 100644 index 0000000..ed64b9a --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/mapper/KnowledgeFileInfoMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.bigmodel.maintenance.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileInfo; + +/** + * @Author: ypj + * @Date: 2024/9/10 16:41 + */ +public interface KnowledgeFileInfoMapper extends BaseMapper { +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java new file mode 100644 index 0000000..81f58c9 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/KnowledgeFileInfoService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.bigmodel.maintenance.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileInfo; + +/** + * @Author: ypj + * @Date: 2024/9/10 16:42 + */ +public interface KnowledgeFileInfoService extends IService { +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java index 558dfc0..7b45d20 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java @@ -29,7 +29,6 @@ import java.util.Date; @DS("hznlm") public class AgentLogServiceImpl extends ServiceImpl implements AgentLogService { - @Override public Boolean BatchLabel(IdsRequest ids) { Date now = new Date(); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java new file mode 100644 index 0000000..9fc1ad7 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/KnowledgeFileInfoServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.bigmodel.maintenance.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileInfo; +import com.hnac.hzims.bigmodel.maintenance.mapper.KnowledgeFileInfoMapper; +import com.hnac.hzims.bigmodel.maintenance.service.KnowledgeFileInfoService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * @Author: ypj + * @Date: 2024/9/10 16:43 + */ +@Service +@Slf4j +@AllArgsConstructor +public class KnowledgeFileInfoServiceImpl extends ServiceImpl implements KnowledgeFileInfoService { +}