luyie
3 months ago
6 changed files with 173 additions and 1 deletions
@ -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<IPage<KnowledgeFileInfo>> listPage(Query query, KnowledgeFileInfo req) { |
||||||
|
return R.data(knowledgeFileInfoService.page(Condition.getPage(query), |
||||||
|
Condition.<KnowledgeFileInfo>getQueryWrapper(new KnowledgeFileInfo(), req).orderByDesc(KnowledgeFileInfo::getCreateTime))); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/detail") |
||||||
|
@ApiOperation(value = "查看详情") |
||||||
|
@ApiOperationSupport(order = 2) |
||||||
|
public R<KnowledgeFileInfo> 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<BladeFile> upload(@ApiParam(value = "上传文件", required = true) @RequestParam("file") MultipartFile file) { |
||||||
|
return ossClient.putFile(file); |
||||||
|
} |
||||||
|
} |
@ -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; |
||||||
|
|
||||||
|
} |
@ -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<KnowledgeFileInfo> { |
||||||
|
} |
@ -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<KnowledgeFileInfo> { |
||||||
|
} |
@ -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<KnowledgeFileInfoMapper, KnowledgeFileInfo> implements KnowledgeFileInfoService { |
||||||
|
} |
Loading…
Reference in new issue