luyie
2 months ago
14 changed files with 271 additions and 5 deletions
@ -0,0 +1,32 @@ |
|||||||
|
package com.hnac.hzims.bigmodel.maintenance.constants; |
||||||
|
|
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: ypj |
||||||
|
* @Date: 2024/9/11 16:16 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
public enum StoreStatus { |
||||||
|
|
||||||
|
NOT_STORE(0, "未入库"), |
||||||
|
STORED(1, "已入库"), |
||||||
|
STORING(2, "入库中"); |
||||||
|
|
||||||
|
private final int code; |
||||||
|
private final String msg; |
||||||
|
|
||||||
|
StoreStatus(int code, String msg) { |
||||||
|
this.code = code; |
||||||
|
this.msg = msg; |
||||||
|
} |
||||||
|
|
||||||
|
public static StoreStatus getInstance(int code) { |
||||||
|
for (StoreStatus status : StoreStatus.values()) { |
||||||
|
if (status.getCode() == code) { |
||||||
|
return status; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,72 @@ |
|||||||
|
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.KnowledgeFileFragment; |
||||||
|
import com.hnac.hzims.bigmodel.maintenance.service.KnowledgeFileFragmentService; |
||||||
|
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.tool.api.R; |
||||||
|
import org.springblade.core.tool.utils.Func; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: ypj |
||||||
|
* @Date: 2024/9/11 11:56 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@Slf4j |
||||||
|
@RequestMapping("/knowledge/fragment") |
||||||
|
@AllArgsConstructor |
||||||
|
@Api(value = "知识库文件分片管理", tags = "知识库文件分片管理") |
||||||
|
public class KnowledgeFileFragmentController { |
||||||
|
private final KnowledgeFileFragmentService knowledgeFileFragmentService; |
||||||
|
|
||||||
|
@GetMapping("/listPage") |
||||||
|
@ApiOperation(value = "分页查询") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
public R<IPage<KnowledgeFileFragment>> listPage(Query query, KnowledgeFileFragment req) { |
||||||
|
return R.data(knowledgeFileFragmentService.page(Condition.getPage(query), Condition.getQueryWrapper(new KnowledgeFileFragment(), req))); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/detail") |
||||||
|
@ApiOperation(value = "查看详情") |
||||||
|
@ApiOperationSupport(order = 2) |
||||||
|
public R<KnowledgeFileFragment> detail(@RequestParam @ApiParam("主键ID") Long id) { |
||||||
|
return R.data(knowledgeFileFragmentService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/save") |
||||||
|
@ApiOperation(value = "保存") |
||||||
|
@ApiOperationSupport(order = 3) |
||||||
|
public R save(@RequestBody KnowledgeFileFragment req) { |
||||||
|
return R.status(knowledgeFileFragmentService.save(req)); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping("/update") |
||||||
|
@ApiOperation(value = "编辑") |
||||||
|
@ApiOperationSupport(order = 4) |
||||||
|
public R update(@RequestBody KnowledgeFileFragment req) { |
||||||
|
return R.status(knowledgeFileFragmentService.updateById(req)); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("/remove") |
||||||
|
@ApiOperation(value = "删除") |
||||||
|
@ApiOperationSupport(order = 5) |
||||||
|
public R remove(@RequestParam @ApiParam("主键ID,按逗号分隔") String ids) { |
||||||
|
return R.status(knowledgeFileFragmentService.removeByIds(Func.toLongList(",", ids))); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/getByDocId") |
||||||
|
@ApiOperation(value = "根据文档ID获取分片,不分页") |
||||||
|
public R<List<KnowledgeFileFragment>> getByDocId(@RequestParam @ApiParam("主键ID") Long docId) { |
||||||
|
return R.data(knowledgeFileFragmentService.getByDocId(docId)); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,46 @@ |
|||||||
|
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.mp.support.QueryField; |
||||||
|
import org.springblade.core.mp.support.SqlCondition; |
||||||
|
import org.springblade.core.tenant.mp.TenantEntity; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: ypj |
||||||
|
* @Date: 2024/9/11 9:58 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper=false) |
||||||
|
@TableName("knowledge_file_fragment") |
||||||
|
@ApiModel(value = "知识库文件分片信息",description = "知识库文件分片信息") |
||||||
|
public class KnowledgeFileFragment extends TenantEntity implements Serializable { |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@ApiModelProperty("文档ID") |
||||||
|
@TableField("DOC_ID") |
||||||
|
@QueryField(condition = SqlCondition.EQUAL) |
||||||
|
private Long docId; |
||||||
|
|
||||||
|
@ApiModelProperty("文档问题") |
||||||
|
@TableField("DOC_QS") |
||||||
|
@QueryField(condition = SqlCondition.LIKE) |
||||||
|
private String docQs; |
||||||
|
|
||||||
|
@ApiModelProperty("文档内容") |
||||||
|
@TableField("DOC_CONTENT") |
||||||
|
@QueryField(condition = SqlCondition.LIKE) |
||||||
|
private String docContent; |
||||||
|
|
||||||
|
@ApiModelProperty("文档页码") |
||||||
|
@TableField("DOC_PAGE_INDEX") |
||||||
|
@QueryField(condition = SqlCondition.EQUAL) |
||||||
|
private Integer docPageIndex; |
||||||
|
|
||||||
|
} |
@ -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.KnowledgeFileFragment; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: ypj |
||||||
|
* @Date: 2024/9/11 10:49 |
||||||
|
*/ |
||||||
|
public interface KnowledgeFileFragmentMapper extends BaseMapper<KnowledgeFileFragment> { |
||||||
|
} |
@ -0,0 +1,14 @@ |
|||||||
|
package com.hnac.hzims.bigmodel.maintenance.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileFragment; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: ypj |
||||||
|
* @Date: 2024/9/11 10:50 |
||||||
|
*/ |
||||||
|
public interface KnowledgeFileFragmentService extends IService<KnowledgeFileFragment> { |
||||||
|
List<KnowledgeFileFragment> getByDocId(Long docId); |
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
package com.hnac.hzims.bigmodel.maintenance.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import com.hnac.hzims.bigmodel.maintenance.entity.KnowledgeFileFragment; |
||||||
|
import com.hnac.hzims.bigmodel.maintenance.mapper.KnowledgeFileFragmentMapper; |
||||||
|
import com.hnac.hzims.bigmodel.maintenance.service.KnowledgeFileFragmentService; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: ypj |
||||||
|
* @Date: 2024/9/11 10:51 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
@Slf4j |
||||||
|
@AllArgsConstructor |
||||||
|
@DS("hznlm") |
||||||
|
public class KnowledgeFileFragmentServiceImpl extends ServiceImpl<KnowledgeFileFragmentMapper, KnowledgeFileFragment> implements KnowledgeFileFragmentService { |
||||||
|
private KnowledgeFileFragmentMapper knowledgeFileFragmentMapper; |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<KnowledgeFileFragment> getByDocId(Long docId) { |
||||||
|
LambdaQueryWrapper<KnowledgeFileFragment> queryWrapper = Wrappers.<KnowledgeFileFragment>lambdaQuery() |
||||||
|
.eq(KnowledgeFileFragment::getDocId, docId) |
||||||
|
.orderByAsc(KnowledgeFileFragment::getDocPageIndex); |
||||||
|
return knowledgeFileFragmentMapper.selectList(queryWrapper); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package com.hnac.hzims.bigmodel.maintenance.vo; |
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: ypj |
||||||
|
* @Date: 2024/9/11 14:16 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@ApiModel("单id操作请求") |
||||||
|
public class IdRequest { |
||||||
|
@ApiModelProperty("主键ID") |
||||||
|
private Long id; |
||||||
|
} |
Loading…
Reference in new issue