feat: 语料库接口
This commit is contained in:
parent
628575dcfa
commit
d49c3bd0ab
@ -60,6 +60,12 @@
|
|||||||
<artifactId>cmvr-iot-device</artifactId>
|
<artifactId>cmvr-iot-device</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 语音交互-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cmvr</groupId>
|
||||||
|
<artifactId>cmvr-iot-vi</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<env>dev</env>
|
<env>dev</env>
|
||||||
|
|||||||
@ -0,0 +1,99 @@
|
|||||||
|
package com.cmvr.web.controller.vi;
|
||||||
|
|
||||||
|
import com.cmvr.common.core.controller.BaseController;
|
||||||
|
import com.cmvr.common.core.domain.AjaxResult;
|
||||||
|
import com.cmvr.common.core.page.TableDataInfo;
|
||||||
|
import com.cmvr.vi.model.domain.ViCorpus;
|
||||||
|
import com.cmvr.vi.service.IViCorpusService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语料库Controller
|
||||||
|
*
|
||||||
|
* @author cmvr-iot
|
||||||
|
*/
|
||||||
|
@Api(tags = "语音交互--语料库")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/vi/corpus")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ViCorpusController extends BaseController {
|
||||||
|
|
||||||
|
private final IViCorpusService viCorpusService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询语料库列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("查询语料库列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('vi:corpus:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(ViCorpus viCorpus) {
|
||||||
|
startPage();
|
||||||
|
List<ViCorpus> list = viCorpusService.selectViCorpusList(viCorpus);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 导出语料库列表
|
||||||
|
// */
|
||||||
|
// @ApiOperation("查询语料库列表")
|
||||||
|
// @PreAuthorize("@ss.hasPermi('vi:corpus:export')")
|
||||||
|
// @PostMapping("/export")
|
||||||
|
// public void export(HttpServletResponse response, ViCorpus viCorpus) {
|
||||||
|
// List<ViCorpus> list = viCorpusService.selectViCorpusList(viCorpus);
|
||||||
|
// ExcelUtil<ViCorpus> util = new ExcelUtil<ViCorpus>(ViCorpus.class);
|
||||||
|
// util.exportExcel(response, list, "语料库数据");
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取语料库详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("根据id获取语料库详细信息")
|
||||||
|
@PreAuthorize("@ss.hasPermi('vi:corpus:query')")
|
||||||
|
@GetMapping(value = "/{corpusId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("corpusId") Long corpusId) {
|
||||||
|
return success(viCorpusService.selectViCorpusByCorpusId(corpusId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增语料库
|
||||||
|
*/
|
||||||
|
@ApiOperation("新增语料库")
|
||||||
|
@PreAuthorize("@ss.hasPermi('vi:corpus:add')")
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody ViCorpus viCorpus) {
|
||||||
|
return toAjax(viCorpusService.insertViCorpus(viCorpus));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改语料库
|
||||||
|
*/
|
||||||
|
@ApiOperation("修改语料库")
|
||||||
|
@PreAuthorize("@ss.hasPermi('vi:corpus:edit')")
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody ViCorpus viCorpus) {
|
||||||
|
return toAjax(viCorpusService.updateViCorpus(viCorpus));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除语料库
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除语料库")
|
||||||
|
@PreAuthorize("@ss.hasPermi('vi:corpus:remove')")
|
||||||
|
@DeleteMapping("/{corpusIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] corpusIds) {
|
||||||
|
return toAjax(viCorpusService.deleteViCorpusByCorpusIds(corpusIds));
|
||||||
|
}
|
||||||
|
}
|
||||||
28
cmvr-iot-vi/pom.xml
Normal file
28
cmvr-iot-vi/pom.xml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.cmvr</groupId>
|
||||||
|
<artifactId>cmvr-iot</artifactId>
|
||||||
|
<version>3.8.9</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cmvr-iot-vi</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
语音交互模块
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- 通用工具-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cmvr</groupId>
|
||||||
|
<artifactId>cmvr-iot-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.cmvr.vi.mapper;
|
||||||
|
|
||||||
|
import com.cmvr.vi.model.domain.ViCorpus;
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语料库Mapper接口
|
||||||
|
*
|
||||||
|
* @author cmvr-iot
|
||||||
|
*/
|
||||||
|
public interface ViCorpusMapper extends MPJBaseMapper<ViCorpus> {
|
||||||
|
}
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
package com.cmvr.vi.model.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.cmvr.common.annotation.Excel;
|
||||||
|
import com.cmvr.common.core.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语料库对象 vi_corpus
|
||||||
|
*
|
||||||
|
* @author cmvr-iot
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("语料库对象")
|
||||||
|
public class ViCorpus extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语料ID
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("语料ID")
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long corpusId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语料名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "语料名称")
|
||||||
|
@ApiModelProperty("语料名称")
|
||||||
|
private String corpusName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语料类型(WAKEUP唤醒 / TEST测试)
|
||||||
|
*/
|
||||||
|
@Excel(name = "语料类型", readConverterExp = "WAKEUP唤醒,TEST测试")
|
||||||
|
@ApiModelProperty("语料类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语音对应的文本
|
||||||
|
*/
|
||||||
|
@Excel(name = "语音对应的文本")
|
||||||
|
@ApiModelProperty("语音对应的文本")
|
||||||
|
private String textContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语音文件存放路径
|
||||||
|
*/
|
||||||
|
@Excel(name = "语音文件存放路径")
|
||||||
|
@ApiModelProperty("语音文件存放路径")
|
||||||
|
private String audioPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 音色
|
||||||
|
*/
|
||||||
|
@Excel(name = "音色")
|
||||||
|
@ApiModelProperty("音色")
|
||||||
|
private String voiceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方言
|
||||||
|
*/
|
||||||
|
@Excel(name = "方言")
|
||||||
|
@ApiModelProperty("方言")
|
||||||
|
private String dialect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预期结果(预留)
|
||||||
|
*/
|
||||||
|
// @Excel(name = "预期结果(预留)")
|
||||||
|
@ApiModelProperty("预期结果(预留)")
|
||||||
|
private String expectedResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同一父语料下的顺序
|
||||||
|
*/
|
||||||
|
@Excel(name = "同一父语料下的顺序")
|
||||||
|
@ApiModelProperty("同一父语料下的顺序")
|
||||||
|
private Integer sortOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||||
|
@ApiModelProperty(value = "状态", notes = "0=正常,1=停用")
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
package com.cmvr.vi.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.cmvr.vi.model.domain.ViCorpus;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语料库Service接口
|
||||||
|
*
|
||||||
|
* @author cmvr-iot
|
||||||
|
*/
|
||||||
|
public interface IViCorpusService extends IService<ViCorpus> {
|
||||||
|
/**
|
||||||
|
* 查询语料库
|
||||||
|
*
|
||||||
|
* @param corpusId 语料库主键
|
||||||
|
* @return 语料库
|
||||||
|
*/
|
||||||
|
public ViCorpus selectViCorpusByCorpusId(Long corpusId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询语料库列表
|
||||||
|
*
|
||||||
|
* @param viCorpus 语料库
|
||||||
|
* @return 语料库集合
|
||||||
|
*/
|
||||||
|
public List<ViCorpus> selectViCorpusList(ViCorpus viCorpus);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增语料库
|
||||||
|
*
|
||||||
|
* @param viCorpus 语料库
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertViCorpus(ViCorpus viCorpus);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改语料库
|
||||||
|
*
|
||||||
|
* @param viCorpus 语料库
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateViCorpus(ViCorpus viCorpus);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除语料库
|
||||||
|
*
|
||||||
|
* @param corpusIds 需要删除的语料库主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteViCorpusByCorpusIds(Long[] corpusIds);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
package com.cmvr.vi.service.impl;
|
||||||
|
|
||||||
|
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.cmvr.vi.mapper.ViCorpusMapper;
|
||||||
|
import com.cmvr.vi.model.domain.ViCorpus;
|
||||||
|
import com.cmvr.vi.service.IViCorpusService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 语料库Service业务层处理
|
||||||
|
*
|
||||||
|
* @author cmvr-iot
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class IViCorpusServiceImpl extends ServiceImpl<ViCorpusMapper, ViCorpus> implements IViCorpusService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询语料库
|
||||||
|
*
|
||||||
|
* @param corpusId 语料库主键
|
||||||
|
* @return 语料库
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ViCorpus selectViCorpusByCorpusId(Long corpusId) {
|
||||||
|
return this.getById(corpusId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询语料库列表
|
||||||
|
*
|
||||||
|
* @param viCorpus 语料库
|
||||||
|
* @return 语料库
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ViCorpus> selectViCorpusList(ViCorpus viCorpus) {
|
||||||
|
LambdaQueryWrapper<ViCorpus> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.eq(ViCorpus::getType, viCorpus.getType());
|
||||||
|
return this.list(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增语料库
|
||||||
|
*
|
||||||
|
* @param viCorpus 语料库
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertViCorpus(ViCorpus viCorpus) {
|
||||||
|
return this.baseMapper.insert(viCorpus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改语料库
|
||||||
|
*
|
||||||
|
* @param viCorpus 语料库
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateViCorpus(ViCorpus viCorpus) {
|
||||||
|
return this.baseMapper.updateById(viCorpus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除语料库
|
||||||
|
*
|
||||||
|
* @param corpusIds 需要删除的语料库主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteViCorpusByCorpusIds(Long[] corpusIds) {
|
||||||
|
return this.baseMapper.deleteBatchIds(Arrays.asList(corpusIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
8
pom.xml
8
pom.xml
@ -260,6 +260,13 @@
|
|||||||
<version>${cmvr-iot.version}</version>
|
<version>${cmvr-iot.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 语音交互-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cmvr</groupId>
|
||||||
|
<artifactId>cmvr-iot-vi</artifactId>
|
||||||
|
<version>${cmvr-iot.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- 大模型调用-->
|
<!-- 大模型调用-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cmvr</groupId>
|
<groupId>com.cmvr</groupId>
|
||||||
@ -314,6 +321,7 @@
|
|||||||
<module>cmvr-iot-device</module>
|
<module>cmvr-iot-device</module>
|
||||||
<module>cmvr-iot-test</module>
|
<module>cmvr-iot-test</module>
|
||||||
<module>cmvr-iot-api</module>
|
<module>cmvr-iot-api</module>
|
||||||
|
<module>cmvr-iot-vi</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user