Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
7fe112bbd9
|
|
@ -1,7 +1,7 @@
|
||||||
package com.bonus.ai.controller;
|
package com.bonus.ai.controller.dataset;
|
||||||
|
|
||||||
|
import com.bonus.ai.domain.DataSetBasicFileEntity;
|
||||||
import com.bonus.ai.domain.dataset.DataSetEntity;
|
import com.bonus.ai.domain.dataset.DataSetEntity;
|
||||||
import com.bonus.ai.mapper.DataSetBasicFileMapper;
|
|
||||||
import com.bonus.common.core.web.controller.BaseController;
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
import com.bonus.ai.service.dataset.DatasetService;
|
import com.bonus.ai.service.dataset.DatasetService;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
|
@ -12,8 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -98,6 +98,37 @@ public class DatasetController extends BaseController {
|
||||||
ajax.put(AjaxResult.DATA_TAG, dataset);
|
ajax.put(AjaxResult.DATA_TAG, dataset);
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 根据数据集编号获取数据集详情
|
||||||
|
* @param entity 筛选条件
|
||||||
|
* @return 返回数据集详情
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "getDataSetBasicFile")
|
||||||
|
public TableDataInfo getDataSetBasicFile(DataSetBasicFileEntity entity) {
|
||||||
|
try {
|
||||||
|
startPage();
|
||||||
|
List<DataSetBasicFileEntity> dataSetBasicFile = datasetService.getDataSetBasicFile(entity);
|
||||||
|
return getDataTable(dataSetBasicFile);
|
||||||
|
}catch (Exception e){
|
||||||
|
return getDataTable(new ArrayList<>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除的数据集
|
||||||
|
* @return 返回影响的行数或错误信
|
||||||
|
*/
|
||||||
|
@PostMapping("/removeDataSetBasicFile")
|
||||||
|
public AjaxResult removeDataSetBasicFile(@RequestParam("datasetId") String datasetId,@RequestParam("fileIds") String fileIds) {
|
||||||
|
// 将字符串转换为 long[] 数组并输出
|
||||||
|
long[] longArray = Arrays.stream(fileIds.split(","))
|
||||||
|
.mapToLong(Long::parseLong)
|
||||||
|
.toArray();
|
||||||
|
return toAjax(datasetService.removeDataSetBasicFile(datasetId,longArray));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置或取消数据集的公共状态
|
* 设置或取消数据集的公共状态
|
||||||
|
|
@ -1,24 +1,33 @@
|
||||||
package com.bonus.ai.controller.dataset;
|
package com.bonus.ai.controller.dataset;
|
||||||
|
|
||||||
import com.bonus.ai.domain.dataset.ReleaseVersionEntity;
|
import com.bonus.ai.domain.dataset.ReleaseVersionEntity;
|
||||||
|
import com.bonus.ai.service.dataset.ReleaseVersionService;
|
||||||
import com.bonus.common.core.web.controller.BaseController;
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/version")
|
@RequestMapping("/version")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ReleaseVersionController extends BaseController {
|
public class ReleaseVersionController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ReleaseVersionService releaseVersionService;
|
||||||
|
|
||||||
/**发布版本,可以针对数据集发布,也可以对标注任务发布
|
/**发布版本,可以针对数据集发布,也可以对标注任务发布
|
||||||
* @param version 发布数据集的版本信息
|
* @param version 发布数据集的版本信息
|
||||||
* @return 返回影响的行数或错误信
|
* @return 返回影响的行数或错误信
|
||||||
*/
|
*/
|
||||||
@PostMapping("/release")
|
@PostMapping("/release")
|
||||||
public AjaxResult release(@Validated @RequestBody ReleaseVersionEntity version) {
|
public AjaxResult release(@Validated @RequestBody ReleaseVersionEntity version) {
|
||||||
return AjaxResult.success();
|
return releaseVersionService.release(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**导出发布版本的数据集
|
/**导出发布版本的数据集
|
||||||
|
|
@ -30,13 +39,29 @@ public class ReleaseVersionController extends BaseController {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除版本发布
|
||||||
|
* @param versionIds id 集合
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/delete/{versionIds}")
|
||||||
|
public AjaxResult delete(@PathVariable Long[] versionIds) {
|
||||||
|
return releaseVersionService.delete(versionIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看发布的版本列表
|
* 查看发布的版本列表
|
||||||
* @return 返回满足条件的版本列表
|
* @return 返回满足条件的版本列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult list() {
|
public TableDataInfo list(ReleaseVersionEntity version) {
|
||||||
return AjaxResult.success();
|
try {
|
||||||
|
List<ReleaseVersionEntity> allReleaseVersions = releaseVersionService.getAllReleaseVersions(version);
|
||||||
|
return getDataTable(allReleaseVersions);
|
||||||
|
}catch (Exception e) {
|
||||||
|
return getDataTable(new ArrayList<>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,4 +67,6 @@ public class DataSetBasicFileEntity extends BaseEntity {
|
||||||
* 文件上传时间
|
* 文件上传时间
|
||||||
*/
|
*/
|
||||||
private Date uploadTime;
|
private Date uploadTime;
|
||||||
|
|
||||||
|
private Long dataSetId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.bonus.ai.domain.enums.AnnotationFileStatus;
|
||||||
import com.bonus.ai.domain.enums.AnnotationTaskStatus;
|
import com.bonus.ai.domain.enums.AnnotationTaskStatus;
|
||||||
import com.bonus.ai.domain.DataSetBasicFileEntity;
|
import com.bonus.ai.domain.DataSetBasicFileEntity;
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
@ -51,4 +52,8 @@ public class DataSetEntity extends BaseEntity {
|
||||||
|
|
||||||
/**数据集关联的文件id*/
|
/**数据集关联的文件id*/
|
||||||
private Long[] fileIds;
|
private Long[] fileIds;
|
||||||
|
|
||||||
|
private Integer annotatedCount;
|
||||||
|
|
||||||
|
private Integer notAnnotatedCount;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,13 +43,6 @@ public interface DataSetLabelsMapper
|
||||||
*/
|
*/
|
||||||
public int updateDataSetLabels(DataSetLabels dataSetLabels);
|
public int updateDataSetLabels(DataSetLabels dataSetLabels);
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除样本标签管理
|
|
||||||
*
|
|
||||||
* @param labelId 样本标签管理主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteDataSetLabelsByLabelId(Long labelId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除样本标签管理
|
* 批量删除样本标签管理
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.ai.mapper;
|
package com.bonus.ai.mapper;
|
||||||
|
|
||||||
|
import com.bonus.ai.domain.DataSetBasicFileEntity;
|
||||||
import com.bonus.ai.domain.dataset.DataSetEntity;
|
import com.bonus.ai.domain.dataset.DataSetEntity;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
|
@ -31,6 +32,10 @@ public interface DatasetMapper {
|
||||||
*/
|
*/
|
||||||
DataSetEntity selectById(@Param("datasetId") Long datasetId);
|
DataSetEntity selectById(@Param("datasetId") Long datasetId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据集文件详情
|
||||||
|
*/
|
||||||
|
List<DataSetBasicFileEntity> getDataSetBasicFile(DataSetBasicFileEntity entity);
|
||||||
/**
|
/**
|
||||||
* 根据UUID查询数据集
|
* 根据UUID查询数据集
|
||||||
*/
|
*/
|
||||||
|
|
@ -61,4 +66,5 @@ public interface DatasetMapper {
|
||||||
public DataSetEntity checkDatasetNameUnique(String datasetName);
|
public DataSetEntity checkDatasetNameUnique(String datasetName);
|
||||||
|
|
||||||
|
|
||||||
|
int removeDataSetBasicFile(@Param("datasetId") String dataSetId, @Param("fileIds") long[] fileIds);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.bonus.ai.mapper;
|
||||||
|
|
||||||
|
import com.bonus.ai.domain.dataset.ReleaseVersionEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author bonus
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ReleaseVersionMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据集版本列表
|
||||||
|
* @param entity 筛选条件
|
||||||
|
* @return 集合
|
||||||
|
*/
|
||||||
|
List<ReleaseVersionEntity> getAllReleaseVersions(ReleaseVersionEntity entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布版本
|
||||||
|
* @param version 数据
|
||||||
|
* @return 条数
|
||||||
|
*/
|
||||||
|
int release(ReleaseVersionEntity version);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除版本发布
|
||||||
|
* @param versionIds 版本集合
|
||||||
|
* @return 条数
|
||||||
|
*/
|
||||||
|
int delete(Long[] versionIds);
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.bonus.ai.service.Impl;
|
package com.bonus.ai.service.Impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.bonus.ai.domain.DataSetBasicFileEntity;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
|
@ -105,7 +107,14 @@ public class DataSetLabelsServiceImpl implements DataSetLabelsService
|
||||||
public AjaxResult deleteDataSetLabelsByLabelIds(Long[] labelIds)
|
public AjaxResult deleteDataSetLabelsByLabelIds(Long[] labelIds)
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
int rows = dataSetLabelsMapper.deleteDataSetLabelsByLabelIds(labelIds);
|
Set<Long> childIds = new HashSet<>();
|
||||||
|
for (Long labelId : labelIds){
|
||||||
|
childIds.addAll(getFileWithChildren(labelId));
|
||||||
|
childIds.add(labelId);
|
||||||
|
}
|
||||||
|
// 转换 Set<Long> 为 Long[]
|
||||||
|
Long[] longArray = childIds.toArray(new Long[0]);
|
||||||
|
int rows = dataSetLabelsMapper.deleteDataSetLabelsByLabelIds(longArray);
|
||||||
return rows>0?AjaxResult.success():AjaxResult.error();
|
return rows>0?AjaxResult.success():AjaxResult.error();
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
|
|
@ -116,8 +125,50 @@ public class DataSetLabelsServiceImpl implements DataSetLabelsService
|
||||||
public AjaxResult getLabelsTree(Long labelId) {
|
public AjaxResult getLabelsTree(Long labelId) {
|
||||||
DataSetLabels entity = new DataSetLabels();
|
DataSetLabels entity = new DataSetLabels();
|
||||||
List<DataSetLabels> dataSetLabels = dataSetLabelsMapper.selectDataSetLabelsList(entity);
|
List<DataSetLabels> dataSetLabels = dataSetLabelsMapper.selectDataSetLabelsList(entity);
|
||||||
|
Set<Long> labelIds = getFileWithChildren(labelId);
|
||||||
|
for (Long id : labelIds){
|
||||||
|
dataSetLabels.removeIf(item -> item.getLabelId().equals(id));
|
||||||
|
}
|
||||||
dataSetLabels.removeIf(item -> item.getLabelId().equals(labelId));
|
dataSetLabels.removeIf(item -> item.getLabelId().equals(labelId));
|
||||||
return AjaxResult.success(dataSetLabels);
|
return AjaxResult.success(dataSetLabels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文件及其子节点
|
||||||
|
* @param labelId ID
|
||||||
|
* @return 当前文件及其所有子节点
|
||||||
|
*/
|
||||||
|
public Set<Long> getFileWithChildren(Long labelId) {
|
||||||
|
// 查询所有文件数据,假设你已经根据需求修改了查询方法
|
||||||
|
DataSetLabels entity =new DataSetLabels();
|
||||||
|
entity.setCreateBy(SecurityUtils.getUserId().toString());
|
||||||
|
List<DataSetLabels> allLabel = dataSetLabelsMapper.selectDataSetLabelsList(entity);
|
||||||
|
// 构建父子关系映射
|
||||||
|
Map<Long, List<Long>> parentToChildrenMap = new HashMap<>();
|
||||||
|
for (DataSetLabels label : allLabel) {
|
||||||
|
parentToChildrenMap
|
||||||
|
.computeIfAbsent(label.getParentId(), k -> new ArrayList<>())
|
||||||
|
.add(label.getLabelId());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用递归或迭代方式获取所有子节点
|
||||||
|
Set<Long> childIds = new HashSet<>();
|
||||||
|
collectChildren(labelId, parentToChildrenMap, childIds);
|
||||||
|
return childIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void collectChildren(Long parentId, Map<Long, List<Long>> parentToChildrenMap, Set<Long> childIds) {
|
||||||
|
// 获取当前父节点的所有子节点
|
||||||
|
List<Long> children = parentToChildrenMap.get(parentId);
|
||||||
|
if (children != null) {
|
||||||
|
for (Long childId : children) {
|
||||||
|
// 将当前子节点 ID 添加到结果集中
|
||||||
|
childIds.add(childId);
|
||||||
|
// 递归获取子节点的子节点
|
||||||
|
collectChildren(childId, parentToChildrenMap, childIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,28 @@ public class DatasetServiceImpl implements DatasetService {
|
||||||
return UserConstants.UNIQUE;
|
return UserConstants.UNIQUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据集文件详情
|
||||||
|
*
|
||||||
|
* @param entity 筛选条件
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DataSetBasicFileEntity> getDataSetBasicFile(DataSetBasicFileEntity entity) {
|
||||||
|
return datasetMapper.getDataSetBasicFile(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件详情删除
|
||||||
|
*
|
||||||
|
* @param dataSetId 数据集id
|
||||||
|
* @param fileIds 文件id集合
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int removeDataSetBasicFile(String dataSetId, long[] fileIds) {
|
||||||
|
return datasetMapper.removeDataSetBasicFile(dataSetId,fileIds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入数据集文件映射关系
|
* 插入数据集文件映射关系
|
||||||
* @param dataSet 数据集实体,包含数据集ID、输入ID、数据类型等信息
|
* @param dataSet 数据集实体,包含数据集ID、输入ID、数据类型等信息
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.bonus.ai.service.Impl.dataset;
|
||||||
|
|
||||||
|
import com.bonus.ai.domain.dataset.ReleaseVersionEntity;
|
||||||
|
import com.bonus.ai.mapper.ReleaseVersionMapper;
|
||||||
|
import com.bonus.ai.service.dataset.ReleaseVersionService;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author bonus
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ReleaseVersionServiceImpl implements ReleaseVersionService {
|
||||||
|
@Resource
|
||||||
|
private ReleaseVersionMapper mapper;
|
||||||
|
/**
|
||||||
|
* 获取数据集版本列表
|
||||||
|
*
|
||||||
|
* @param entity 筛选条件
|
||||||
|
* @return 集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ReleaseVersionEntity> getAllReleaseVersions(ReleaseVersionEntity entity) {
|
||||||
|
return mapper.getAllReleaseVersions(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布版本
|
||||||
|
*
|
||||||
|
* @param version 数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult release(ReleaseVersionEntity version) {
|
||||||
|
try {
|
||||||
|
int num = mapper.release(version);
|
||||||
|
return num>0?AjaxResult.success():AjaxResult.error();
|
||||||
|
}catch (Exception e) {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除版本发布
|
||||||
|
*
|
||||||
|
* @param versionIds 版本集合
|
||||||
|
* @return 条数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult delete(Long[] versionIds) {
|
||||||
|
try {
|
||||||
|
int delete = mapper.delete(versionIds);
|
||||||
|
return delete>0?AjaxResult.success():AjaxResult.error();
|
||||||
|
}catch (Exception e) {
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.ai.service.dataset;
|
package com.bonus.ai.service.dataset;
|
||||||
|
|
||||||
|
import com.bonus.ai.domain.DataSetBasicFileEntity;
|
||||||
import com.bonus.ai.domain.dataset.DataSetEntity;
|
import com.bonus.ai.domain.dataset.DataSetEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -50,4 +51,18 @@ public interface DatasetService {
|
||||||
|
|
||||||
/**验证数据集名称的唯一性*/
|
/**验证数据集名称的唯一性*/
|
||||||
boolean checkDatasetNameUnique(DataSetEntity dataSet);
|
boolean checkDatasetNameUnique(DataSetEntity dataSet);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据集文件详情
|
||||||
|
*/
|
||||||
|
List<DataSetBasicFileEntity> getDataSetBasicFile(DataSetBasicFileEntity entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件详情删除
|
||||||
|
* @param dataSetId 数据集id
|
||||||
|
* @param fileIds 文件id集合
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int removeDataSetBasicFile(String dataSetId, long[] fileIds);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.bonus.ai.service.dataset;
|
||||||
|
|
||||||
|
|
||||||
|
import com.bonus.ai.domain.dataset.ReleaseVersionEntity;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author bonus
|
||||||
|
*/
|
||||||
|
public interface ReleaseVersionService {
|
||||||
|
/**
|
||||||
|
* 获取数据集版本列表
|
||||||
|
* @param entity 筛选条件
|
||||||
|
* @return 集合
|
||||||
|
*/
|
||||||
|
List<ReleaseVersionEntity> getAllReleaseVersions(ReleaseVersionEntity entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布版本
|
||||||
|
* @param version 数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
AjaxResult release(ReleaseVersionEntity version);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除版本发布
|
||||||
|
* @param versionIds 版本集合
|
||||||
|
* @return 条数
|
||||||
|
*/
|
||||||
|
AjaxResult delete(Long[] versionIds);
|
||||||
|
}
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
<select id="selectDataSetLabelsList" parameterType="com.bonus.ai.domain.DataSetLabels" resultMap="DataSetLabelsResult">
|
<select id="selectDataSetLabelsList" parameterType="com.bonus.ai.domain.DataSetLabels" resultMap="DataSetLabelsResult">
|
||||||
<include refid="selectDataSetLabelsVo"/>
|
<include refid="selectDataSetLabelsVo"/>
|
||||||
<where>
|
<where>
|
||||||
|
del_flag ='0'
|
||||||
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
|
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
|
||||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||||
<if test="labelName != null "> and label_name like concat('%', #{labelName}, '%')</if>
|
<if test="labelName != null "> and label_name like concat('%', #{labelName}, '%')</if>
|
||||||
|
|
@ -71,14 +72,11 @@
|
||||||
where label_id = #{labelId}
|
where label_id = #{labelId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteDataSetLabelsByLabelId" parameterType="Long">
|
|
||||||
delete from ai_labels where label_id = #{labelId}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteDataSetLabelsByLabelIds" parameterType="String">
|
<update id="deleteDataSetLabelsByLabelIds" parameterType="String">
|
||||||
delete from ai_labels where label_id in
|
update ai_labels set del_flag ='1' where label_id in
|
||||||
<foreach item="labelId" collection="array" open="(" separator="," close=")">
|
<foreach item="labelId" collection="array" open="(" separator="," close=")">
|
||||||
#{labelId}
|
#{labelId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
<include refid="selectSampleVo"/>
|
<include refid="selectSampleVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="sampleName != null and sampleName != ''"> and sample_name like concat('%', #{sampleName}, '%')</if>
|
<if test="sampleName != null and sampleName != ''"> and sample_name like concat('%', #{sampleName}, '%')</if>
|
||||||
<if test="sampleFormat != null and sampleFormat != ''"> and sample_format = #{sampleFormat}</if>
|
<if test="sampleFormat != null and sampleFormat != ''"> and sample_format like concat('%', #{sampleFormat}, '%')</if>
|
||||||
and del_flag = '0'
|
and del_flag = '0'
|
||||||
</where>
|
</where>
|
||||||
ORDER BY create_time DESC
|
ORDER BY create_time DESC
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,9 @@
|
||||||
<!-- </insert>-->
|
<!-- </insert>-->
|
||||||
|
|
||||||
<insert id="batchDatasetFile">
|
<insert id="batchDatasetFile">
|
||||||
insert into ai_dataset_file_map(file_id, dataset_id, is_annotated) values
|
insert into ai_dataset_file_map(file_id, dataset_id) values
|
||||||
<foreach item="item" index="index" collection="list" separator=",">
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
(#{item.fileId},#{item.datasetId},#{item.isAnnotated})
|
(#{item.fileId},#{item.datasetId})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,32 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDatasetVo">
|
<sql id="selectDatasetVo">
|
||||||
select dataset_id, dataset_uuid, dataset_name, description, data_type, data_source, input_path,
|
SELECT
|
||||||
output_path, annotation_status, is_public, del_flag, create_by, create_time,
|
ad.dataset_id,
|
||||||
update_by, update_time
|
ad.dataset_uuid,
|
||||||
from ai_dataset
|
ad.dataset_name,
|
||||||
|
ad.description,
|
||||||
|
ad.data_type,
|
||||||
|
ad.data_source,
|
||||||
|
ad.input_path,
|
||||||
|
ad.output_path,
|
||||||
|
ad.annotation_status,
|
||||||
|
ad.is_public,
|
||||||
|
ad.del_flag,
|
||||||
|
ad.create_by,
|
||||||
|
ad.create_time,
|
||||||
|
ad.update_by,
|
||||||
|
ad.update_time,
|
||||||
|
ad.input_id,
|
||||||
|
ad.output_id,
|
||||||
|
(SELECT COUNT(*)
|
||||||
|
FROM ai_dataset_file_map adfm
|
||||||
|
WHERE adfm.dataset_id = ad.dataset_id) AS annotatedCount,
|
||||||
|
(SELECT COUNT(*)
|
||||||
|
FROM ai_dataset_file_map adfm
|
||||||
|
WHERE adfm.dataset_id = ad.dataset_id AND adfm.is_annotated = '0') AS notAnnotatedCount
|
||||||
|
FROM
|
||||||
|
ai_dataset ad
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<insert id="insert" parameterType="com.bonus.ai.domain.dataset.DataSetEntity" useGeneratedKeys="true" keyProperty="datasetId">
|
<insert id="insert" parameterType="com.bonus.ai.domain.dataset.DataSetEntity" useGeneratedKeys="true" keyProperty="datasetId">
|
||||||
|
|
@ -70,6 +92,13 @@
|
||||||
#{datasetId}
|
#{datasetId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
<delete id="removeDataSetBasicFile">
|
||||||
|
delete from ai_dataset_file_map
|
||||||
|
where dataset_id = #{datasetId} AND file_id in
|
||||||
|
<foreach collection="fileIds" item="fileId" open="(" separator="," close=")">
|
||||||
|
#{fileId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
<select id="selectById" resultMap="DatasetResult">
|
<select id="selectById" resultMap="DatasetResult">
|
||||||
select d.dataset_id, d.dataset_uuid, d.dataset_name, d.description, d.data_type, d.data_source, d.input_path,
|
select d.dataset_id, d.dataset_uuid, d.dataset_name, d.description, d.data_type, d.data_source, d.input_path,
|
||||||
|
|
@ -91,21 +120,21 @@
|
||||||
<select id="getDatasetList" parameterType="com.bonus.ai.domain.dataset.DataSetEntity" resultMap="DatasetResult">
|
<select id="getDatasetList" parameterType="com.bonus.ai.domain.dataset.DataSetEntity" resultMap="DatasetResult">
|
||||||
<include refid="selectDatasetVo"/>
|
<include refid="selectDatasetVo"/>
|
||||||
<where>
|
<where>
|
||||||
and del_flag = '0'
|
and ad.del_flag = '0'
|
||||||
<if test="datasetName != null and datasetName != ''">
|
<if test="datasetName != null and datasetName != ''">
|
||||||
AND dataset_name like concat('%', #{datasetName}, '%')
|
AND ad.dataset_name like concat('%', #{datasetName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="dataType != null and dataType != ''">
|
<if test="dataType != null and dataType != ''">
|
||||||
AND data_type = #{dataType}
|
AND ad.data_type = #{dataType}
|
||||||
</if>
|
</if>
|
||||||
<if test="annotationStatus != null and annotationStatus != ''">
|
<if test="annotationStatus != null and annotationStatus != ''">
|
||||||
AND annotation_status = #{annotationStatus}
|
AND ad.annotation_status = #{annotationStatus}
|
||||||
</if>
|
</if>
|
||||||
<if test="isPublic != null and isPublic != ''">
|
<if test="isPublic != null and isPublic != ''">
|
||||||
AND is_public = #{isPublic}
|
AND ad.is_public = #{isPublic}
|
||||||
</if>
|
</if>
|
||||||
<if test="createBy != null and createBy != ''">
|
<if test="createBy != null and createBy != ''">
|
||||||
AND create_by = #{createBy}
|
AND ad.create_by = #{createBy}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by create_time desc
|
order by create_time desc
|
||||||
|
|
@ -134,5 +163,18 @@
|
||||||
<select id="selectAllList" resultMap="DatasetResult">
|
<select id="selectAllList" resultMap="DatasetResult">
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getDataSetBasicFile" parameterType="com.bonus.ai.domain.DataSetBasicFileEntity" resultType="com.bonus.ai.domain.DataSetBasicFileEntity">
|
||||||
|
SELECT
|
||||||
|
adfm.file_id AS fileId,
|
||||||
|
abf.file_name AS fileName,
|
||||||
|
abf.file_size AS fileSize,
|
||||||
|
adfm.create_time AS createTime
|
||||||
|
FROM
|
||||||
|
ai_dataset_file_map adfm
|
||||||
|
LEFT JOIN ai_basic_file abf ON abf.file_id = adfm.file_id AND abf.del_flag='0'
|
||||||
|
where adfm.dataset_id =#{dataSetId}
|
||||||
|
<if test="fileName != null and fileName != ''">
|
||||||
|
AND abf.file_name like concat('%', #{fileName}, '%')
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.bonus.ai.mapper.ReleaseVersionMapper">
|
||||||
|
<insert id="release">
|
||||||
|
INSERT INTO ai_dataset_version (version_name, version_description, dataset_id, task_id, create_by)
|
||||||
|
VALUES (#{versionName}, #{versionDesc}, #{datasetId}, #{taskId}, #{createBy});
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="delete">
|
||||||
|
update ai_dataset_version set del_flag='1' where version_id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="getAllReleaseVersions" resultType="com.bonus.ai.domain.dataset.ReleaseVersionEntity">
|
||||||
|
select version_id AS versionId,
|
||||||
|
version_name AS versionName,
|
||||||
|
version_description AS versionDesc,
|
||||||
|
dataset_id AS datasetId,
|
||||||
|
task_id AS taskId,
|
||||||
|
create_by AS createBy,
|
||||||
|
create_time AS createTime
|
||||||
|
from ai_dataset_version
|
||||||
|
where del_flag = '0'
|
||||||
|
ORDER BY create_time DESC
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue