人脸识别与大模型问答

This commit is contained in:
jiang 2024-09-26 20:21:51 +08:00
parent 8722b04d0e
commit b56b55ad3d
13 changed files with 1066 additions and 261 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-modules</artifactId>
<version>24.7.1</version>
<version>24.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -2,15 +2,19 @@ package com.bonus.ai.controller;
import com.bonus.ai.domain.*;
import com.bonus.ai.service.DataSetService;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.system.api.RemoteFileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author bonus
@ -18,20 +22,23 @@ import java.util.List;
@RestController
@RequestMapping("/dataSet")
@Slf4j
public class DataSetController {
public class DataSetController extends BaseController {
@Resource
private DataSetService dataSetService;
@Resource
private RemoteFileService remoteFileService;
/**
* 根据数据集 ID 查询对应的数据集信息
*
* @param datasetId 数据集的唯一标识符
* @return 返回指定数据集 ID 对应的 DataSetEntity 对象
*/
@PostMapping("/getDatasetById")
public AjaxResult getDatasetById(Long datasetId) {
return null;
@GetMapping("/getDatasetById/{datasetId}")
public AjaxResult getDatasetById(@PathVariable Long datasetId) {
return dataSetService.getDatasetById(datasetId);
}
/**
@ -40,9 +47,26 @@ public class DataSetController {
* @param entity 包含查询条件的 DataSetEntity 对象
* @return 返回所有符合条件的数据集的集合
*/
@PostMapping("/getAllDatasets")
public AjaxResult getAllDatasets(DataSetEntity entity) {
return null;
@GetMapping("/getAllDatasets")
public TableDataInfo getAllDatasets(DataSetEntity entity) {
try {
startPage();
List<DataSetEntity> allDatasets = dataSetService.getAllDatasets(entity);
return getDataTable(allDatasets);
} catch (Exception e) {
log.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
}
/**
* 查询所有的数据集信息
*
* @return 返回所有符合条件的数据集的集合
*/
@GetMapping("/getDatasets")
public AjaxResult getDatasets() {
return AjaxResult.success(dataSetService.getAllDatasets(null));
}
/**
@ -52,8 +76,8 @@ public class DataSetController {
* @return 返回插入操作影响的行数成功插入的记录数通常为 1
*/
@PostMapping("/insertDataset")
public AjaxResult insertDataset(DataSetEntity entity) {
return null;
public AjaxResult insertDataset(@RequestBody DataSetEntity entity) {
return dataSetService.insertDataset(entity);
}
/**
@ -63,8 +87,8 @@ public class DataSetController {
* @return 返回更新操作影响的行数成功更新的记录数通常为 1
*/
@PostMapping("/updateDataset")
public AjaxResult updateDataset(DataSetEntity entity) {
return null;
public AjaxResult updateDataset(@RequestBody DataSetEntity entity) {
return dataSetService.updateDataset(entity);
}
/**
@ -73,9 +97,9 @@ public class DataSetController {
* @param datasetId 数据集的唯一标识符
* @return 返回删除操作影响的行数成功删除的记录数通常为 1
*/
@PostMapping("/deleteDataset")
public AjaxResult deleteDataset(Long datasetId) {
return null;
@DeleteMapping("/deleteDataset/{datasetId}")
public AjaxResult deleteDataset(@PathVariable Long datasetId) {
return dataSetService.deleteDataset(datasetId);
}
/**
@ -84,9 +108,9 @@ public class DataSetController {
* @param categoryId 类别的唯一标识符
* @return 返回指定类别 ID 对应的 DataSetCategoryEntity 对象
*/
@PostMapping("/getCategoryById")
public AjaxResult getCategoryById(Long categoryId) {
return null;
@GetMapping("/getCategoryById/{categoryId}")
public AjaxResult getCategoryById(@PathVariable Long categoryId) {
return dataSetService.getCategoryById(categoryId);
}
/**
@ -96,7 +120,7 @@ public class DataSetController {
* @return 返回所有符合条件的类别的列表
*/
@PostMapping("/getCategories")
public AjaxResult getCategories(DataSetCategoryEntity entity) {
public AjaxResult getCategories(@RequestBody DataSetCategoryEntity entity) {
return dataSetService.getCategories(entity);
}
@ -107,8 +131,8 @@ public class DataSetController {
* @return 返回插入操作影响的行数成功插入的记录数通常为 1
*/
@PostMapping("/insertCategory")
public AjaxResult insertCategory(DataSetCategoryEntity entity) {
return null;
public AjaxResult insertCategory(@RequestBody DataSetCategoryEntity entity) {
return dataSetService.insertCategory(entity);
}
/**
@ -118,8 +142,8 @@ public class DataSetController {
* @return 返回更新操作影响的行数成功更新的记录数通常为 1
*/
@PostMapping("/updateCategory")
public AjaxResult updateCategory(DataSetCategoryEntity entity) {
return null;
public AjaxResult updateCategory(@RequestBody DataSetCategoryEntity entity) {
return dataSetService.updateCategory(entity);
}
/**
@ -128,9 +152,9 @@ public class DataSetController {
* @param categoryId 要删除的类别的唯一标识符
* @return 返回删除操作影响的行数成功删除的记录数通常为 1
*/
@PostMapping("/deleteCategory")
public AjaxResult deleteCategory(Long categoryId) {
return null;
@DeleteMapping("/deleteCategory/{categoryId}")
public AjaxResult deleteCategory(@PathVariable Long categoryId) {
return dataSetService.deleteCategory(categoryId);
}
/**
@ -150,9 +174,16 @@ public class DataSetController {
* @param entity 查询条件
* @return 数据集文件列表
*/
@PostMapping("/getAllFiles")
public AjaxResult getAllFiles(DataSetFileEntity entity) {
return null;
@GetMapping("/getAllFiles")
public TableDataInfo getAllFiles(DataSetFileEntity entity) {
try {
startPage();
List<DataSetFileEntity> allFiles = dataSetService.getAllFiles(entity);
return getDataTable(allFiles);
} catch (Exception e) {
log.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
}
/**
@ -162,8 +193,8 @@ public class DataSetController {
* @return 影响的行数
*/
@PostMapping("/insertFile")
public AjaxResult insertFile(DataSetFileEntity entity) {
return null;
public AjaxResult insertFile(@RequestBody DataSetFileEntity entity) {
return dataSetService.insertFile(entity);
}
/**
@ -173,19 +204,19 @@ public class DataSetController {
* @return 影响的行数
*/
@PostMapping("/updateFile")
public AjaxResult updateFile(DataSetFileEntity datasetFile) {
return null;
public AjaxResult updateFile(@RequestBody DataSetFileEntity datasetFile) {
return dataSetService.updateFile(datasetFile);
}
/**
* 根据 ID 删除数据集文件逻辑删除
*
* @param fileId 文件 ID
* @param fileIds 文件 ID
* @return 影响的行数
*/
@PostMapping("/deleteFile")
public AjaxResult deleteFile(Long fileId) {
return null;
@DeleteMapping("/deleteFile/{fileIds}")
public AjaxResult deleteFile(@PathVariable Long[] fileIds) {
return dataSetService.deleteFile(fileIds);
}
/**
@ -194,8 +225,8 @@ public class DataSetController {
* @param taskId 任务 ID
* @return 数据集任务实体
*/
@PostMapping("/getTaskById")
public AjaxResult getTaskById(Long taskId) {
@GetMapping("/getTaskById/{taskId}")
public AjaxResult getTaskById(@PathVariable Long taskId) {
return null;
}
@ -205,9 +236,16 @@ public class DataSetController {
* @param entity 查询条件
* @return 数据集任务列表
*/
@PostMapping("/getAllTasks")
public AjaxResult getAllTasks(DataSetTaskEntity entity) {
return null;
@GetMapping("/getAllTasks")
public TableDataInfo getAllTasks(DataSetTaskEntity entity) {
try {
startPage();
List<DataSetTaskEntity> list = dataSetService.getAllTasks(entity);
return getDataTable(list);
} catch (Exception e) {
log.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
}
/**
@ -217,8 +255,8 @@ public class DataSetController {
* @return 影响的行数
*/
@PostMapping("/insertTask")
public AjaxResult insertTask(DataSetTaskEntity entity) {
return null;
public AjaxResult insertTask(@RequestBody DataSetTaskEntity entity) {
return dataSetService.insertTask(entity);
}
/**
@ -228,8 +266,8 @@ public class DataSetController {
* @return 影响的行数
*/
@PostMapping("/updateTask")
public AjaxResult updateTask(DataSetTaskEntity datasetTask) {
return null;
public AjaxResult updateTask(@RequestBody DataSetTaskEntity datasetTask) {
return dataSetService.updateTask(datasetTask);
}
/**
@ -238,9 +276,9 @@ public class DataSetController {
* @param taskId 任务 ID
* @return 影响的行数
*/
@PostMapping("/deleteTask")
public AjaxResult deleteTask(Long taskId) {
return null;
@DeleteMapping("/deleteTask/{taskId}")
public AjaxResult deleteTask(@PathVariable Long taskId) {
return dataSetService.deleteTask(taskId);
}
/**
@ -249,9 +287,9 @@ public class DataSetController {
* @param logId 日志 ID
* @return 数据集日志实体
*/
@PostMapping("/getLogById")
public AjaxResult getLogById(Long logId) {
return null;
@PostMapping("/getLogById/{logId}")
public AjaxResult getLogById(@PathVariable Long logId) {
return dataSetService.getLogById(logId);
}
/**
@ -260,42 +298,179 @@ public class DataSetController {
* @param entity 查询条件
* @return 数据集日志列表
*/
@PostMapping("/getAllLogs")
public AjaxResult getAllLogs(DataSetLogEntity entity) {
return null;
@GetMapping("/getAllLogs")
public TableDataInfo getAllLogs(DataSetLogEntity entity) {
try {
startPage();
List<DataSetLogEntity> list = dataSetService.getAllLogs(entity);
return getDataTable(list);
} catch (Exception e) {
log.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
}
/**
* 根据 ID 查询模型
*
* @param modelId 模型管理 ID
* @return 模型管理实体
*/
@GetMapping("/getModelsById/{modelId}")
public AjaxResult getModelsById(@PathVariable Long modelId) {
return dataSetService.getModelsById(modelId);
}
/**
* 插入新的日志
* 查询所有模型
*
* @param log 数据集日志实体
* @return 影响的行数
* @param entity 查询条件
* @return 模型管理列表
*/
@PostMapping("/insertLog")
public AjaxResult insertLog(DataSetLogEntity log) {
return null;
@GetMapping("/getAllModels")
public TableDataInfo getAllModels(AiModelEntity entity) {
try {
startPage();
List<AiModelEntity> list = dataSetService.getAllModels(entity);
return getDataTable(list);
} catch (Exception e) {
log.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
}
/**
* 更新日志信息
* 查询所有模型
*
* @param log 数据集日志实体
* @return 影响的行数
* @return 模型管理列表
*/
@PostMapping("/updateLog")
public AjaxResult updateLog(DataSetLogEntity log) {
return null;
@GetMapping("/getModelsList")
public AjaxResult getModelsList() {
return AjaxResult.success(dataSetService.getAllModels(null));
}
/**
* 根据 ID 删除日志
* 插入新的模型
*
* @param logId 日志 ID
* @param entity 模型实体
* @return 影响的行数
*/
@PostMapping("/deleteLog")
public AjaxResult deleteLog(Long logId) {
return null;
@PostMapping("/insertModel")
public AjaxResult insertModel(@RequestBody AiModelEntity entity) {
return dataSetService.insertModel(entity);
}
/**
* 更新模型实体
*
* @param entity 模型实体
* @return 影响的行数
*/
@PostMapping("/updateModel")
public AjaxResult updateModel(@RequestBody AiModelEntity entity) {
return dataSetService.updateModel(entity);
}
/**
* 根据 ID 删除模型
*
* @param modelIds 模型 ID
* @return 影响的行数
*/
@DeleteMapping("/deleteModel/{modelIds}")
public AjaxResult deleteModel(@PathVariable Long[] modelIds) {
return dataSetService.deleteModel(modelIds);
}
/**
* 根据 ID 查询算法评价
*
* @param algorithmId 算法评价 ID
* @return 算法评价实体
*/
@GetMapping("/getAlgorithmById/{algorithmId}")
public AjaxResult getAlgorithmById(@PathVariable Long algorithmId) {
return dataSetService.getAlgorithmById(algorithmId);
}
/**
* 查询所有算法评价
*
* @param entity 查询条件
* @return 算法评价列表
*/
@GetMapping("/getAllAlgorithms")
public TableDataInfo getAllAlgorithms(DataSetAlgorithm entity) {
try {
startPage();
List<DataSetAlgorithm> list = dataSetService.getAllAlgorithms(entity);
return getDataTable(list);
} catch (Exception e) {
log.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
}
/**
* 插入新的算法评价
*
* @param entity 算法评价实体
* @return 影响的行数
*/
@PostMapping("/insertAlgorithm")
public AjaxResult insertAlgorithm(@RequestBody DataSetAlgorithm entity) {
return dataSetService.insertAlgorithm(entity);
}
/**
* 更新算法评价
*
* @param entity 算法评价实体
* @return 影响的行数
*/
@PostMapping("/updateAlgorithm")
public AjaxResult updateAlgorithm(@RequestBody DataSetAlgorithm entity) {
return dataSetService.updateAlgorithm(entity);
}
/**
* 根据 ID 删除算法评价
*
* @param algorithmIds 算法评价 ID
* @return 影响的行数
*/
@DeleteMapping("/deleteAlgorithm/{algorithmIds}")
public AjaxResult deleteAlgorithm(@PathVariable Long[] algorithmIds) {
return dataSetService.deleteAlgorithm(algorithmIds);
}
// 处理多个文件上传
@PostMapping("/uploadImgFiles")
public AjaxResult uploadImgFiles(@RequestParam("files") MultipartFile[] files, @RequestParam("datasetId") Long datasetId) {
if (ObjectUtils.isEmpty(files)) {
return AjaxResult.error("请选择文件");
}
try {
AjaxResult ajaxResult = remoteFileService.uploadFile(files);
if (ajaxResult.isSuccess()) {
List<Map<String, String>> data = (List<Map<String, String>>) ajaxResult.get("data");
for (Map<String, String> map : data) {
DataSetFileEntity entity = new DataSetFileEntity();
entity.setFileAddress(map.get("url"));
entity.setDatasetId(datasetId);
entity.setFileName(map.get("name"));
dataSetService.insertFile(entity);
}
return AjaxResult.success();
} else {
return AjaxResult.error("上传文件失败");
}
} catch (Exception e) {
return AjaxResult.error();
}
}

View File

@ -0,0 +1,73 @@
package com.bonus.ai.domain;
import com.bonus.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author bonus
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AiModelEntity extends BaseEntity {
/**
* 模型唯一id
*/
private Long modelId;
/**
* 模型名称
*/
private String modelName;
/**
* 模型版本
*/
private String modelVersion;
/**
* 分任务类型id
*/
private Long subTaskTypeId;
/**
* 模型类型
*/
private String modelType;
/**
* 数据集
*/
private Long dataSetId;
/**
* 数据集名称
*/
private String dataSetName;
/**
* 推理语言
*/
private String inferLanguage;
/**
* 模型格式
*/
private String modelFormat;
/**
* 部署要求
*/
private String deployRequirement;
/**
* 模型相对地址
*/
private String modelAddress;
/**
* 使用手册相对地址
*/
private String userGuide;
/**
* 描述
*/
private String description;
/**
* 算法选择
*/
private String algorithm;
}

View File

@ -0,0 +1,40 @@
package com.bonus.ai.domain;
import com.bonus.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DataSetAlgorithm extends BaseEntity {
/**
* 主键
*/
private Long algorithmId;
/**
* 模型id
*/
private Long modelId;
/**
* 模型名称
*/
private String modelName;
/**
* 样本数
*/
private int validationSampleCount;
/**
* 准确数
*/
private int correctCount;
/**
* 漏检数
*/
private int missedDetectionCount;
/**
* 识别速度
*/
private String recognitionSpeed;
}

View File

@ -35,7 +35,7 @@ public class DataSetCategoryEntity implements Serializable {
/**
* 创建人
*/
private String createdBy;
private Long createdBy;
/**
* 描述
*/
@ -62,6 +62,8 @@ public class DataSetCategoryEntity implements Serializable {
*/
private Date updateTime;
/** 子菜单 */
/**
* 子菜单
*/
private List<DataSetCategoryEntity> children = new ArrayList<DataSetCategoryEntity>();
}

View File

@ -1,7 +1,9 @@
package com.bonus.ai.domain;
import com.bonus.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@ -11,10 +13,11 @@ import java.util.Date;
* @author bonus
* 数据集表
*/
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DataSetEntity implements Serializable {
public class DataSetEntity extends BaseEntity {
/**
* 数据集id
*/
@ -35,28 +38,28 @@ public class DataSetEntity implements Serializable {
* 数据集描述
*/
private String description;
/**
* 记录创建者
*/
private Long createBy;
/**
* 记录创建人姓名
*/
private String createName;
/**
* 记录创建时间
*/
private Date createTime;
/**
* 记录更新者
*/
private String updateBy;
/**
* 记录更新者姓名
*/
private String updateName;
/**
* 记录更新时间
* 样本类型id
*/
private Date updateTime;
private Long categoryId;
/**
* 样本类型名称
*/
private String categoryName;
/**
* 样本数量
*/
private int num;
/**
* 文件地址
*/
private String filePath;
}

View File

@ -1,19 +1,17 @@
package com.bonus.ai.domain;
import com.bonus.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @author bonus
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DataSetFileEntity implements Serializable {
public class DataSetFileEntity extends BaseEntity {
/**
* 数据集文件唯一标识符
*/
@ -46,29 +44,15 @@ public class DataSetFileEntity implements Serializable {
* 文件描述信息
*/
private String description;
/**
* 记录创建者
*/
private Long createBy;
/**
* 记录创建人姓名
*/
private String createName;
/**
* 记录创建时间
*/
private Date createTime;
/**
* 记录更新者
*/
private String updateBy;
/**
* 记录更新者姓名
*/
private String updateName;
/**
* 记录更新时间
*/
private Date updateTime;
private Long[] fileIds;
}

View File

@ -1,5 +1,6 @@
package com.bonus.ai.domain;
import com.bonus.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -12,7 +13,7 @@ import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DataSetLogEntity {
public class DataSetLogEntity extends BaseEntity {
/**
* 日志唯一标识符
*/

View File

@ -1,5 +1,6 @@
package com.bonus.ai.domain;
import com.bonus.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -13,7 +14,7 @@ import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DataSetTaskEntity implements Serializable {
public class DataSetTaskEntity extends BaseEntity implements Serializable {
/**
* 任务唯一标识符
*/
@ -21,7 +22,7 @@ public class DataSetTaskEntity implements Serializable {
/**
* 任务类型和状态关联 ID
*/
private Long typeStatusId;
private Long datasetId;
/**
* 任务归属人
*/
@ -34,28 +35,36 @@ public class DataSetTaskEntity implements Serializable {
* 描述
*/
private String description;
/**
* 记录创建者
*/
private Long createBy;
/**
* 记录创建人姓名
*/
private String createName;
/**
* 记录创建时间
*/
private Date createTime;
/**
* 记录更新者
*/
private String updateBy;
/**
* 记录更新者姓名
*/
private String updateName;
/**
* 记录更新时间
* 任务名称
*/
private Date updateTime;
private String taskName;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 任务状态
*/
private String status;
/**
* 紧急程度
*/
private String level;
/**
* 完成进度
*/
private int num;
}

View File

@ -133,7 +133,7 @@ public interface DataSetMapper {
* @param fileId 文件 ID
* @return 影响的行数
*/
int deleteFile(Long fileId);
int deleteFile(Long[] fileId);
/**
* 根据 ID 查询任务信息
@ -201,18 +201,82 @@ public interface DataSetMapper {
int insertLog(DataSetLogEntity log);
/**
* 更新日志信息
* 根据 ID 查询模型
*
* @param log 数据集日志实体
* @return 影响的行数
* @param modelId 模型管理 ID
* @return 模型管理实体
*/
int updateLog(DataSetLogEntity log);
AiModelEntity getModelsById(Long modelId);
/**
* 根据 ID 删除日志
* 查询所有模型
*
* @param logId 日志 ID
* @param entity 查询条件
* @return 模型管理列表
*/
List<AiModelEntity> getAllModels(AiModelEntity entity);
/**
* 插入新的模型
*
* @param entity 模型实体
* @return 影响的行数
*/
int deleteLog(Long logId);
int insertModel(AiModelEntity entity);
/**
* 更新模型实体
*
* @param entity 模型实体
* @return 影响的行数
*/
int updateModel(AiModelEntity entity);
/**
* 根据 ID 删除模型
*
* @param modelIds 模型 ID
* @return 影响的行数
*/
int deleteModel(Long[] modelIds);
/**
* 根据 ID 查询算法评价
*
* @param algorithmId 算法评价 ID
* @return 算法评价实体
*/
DataSetAlgorithm getAlgorithmById(Long algorithmId);
/**
* 查询所有算法评价
*
* @param entity 查询条件
* @return 算法评价列表
*/
List<DataSetAlgorithm> getAllAlgorithms(DataSetAlgorithm entity);
/**
* 插入新的算法评价
*
* @param entity 算法评价实体
* @return 影响的行数
*/
int insertAlgorithm(DataSetAlgorithm entity);
/**
* 更新算法评价
*
* @param entity 算法评价实体
* @return 影响的行数
*/
int updateAlgorithm(DataSetAlgorithm entity);
/**
* 根据 ID 删除算法评价
*
* @param algorithmIds 算法评价 ID
* @return 影响的行数
*/
int deleteAlgorithm(Long[] algorithmIds);
}

View File

@ -3,6 +3,8 @@ package com.bonus.ai.service;
import com.bonus.ai.domain.*;
import com.bonus.common.core.web.domain.AjaxResult;
import java.util.List;
/**
* @author bonus
@ -23,7 +25,7 @@ public interface DataSetService {
* @param entity 包含查询条件的 DataSetEntity 对象
* @return 返回所有符合条件的数据集的集合
*/
AjaxResult getAllDatasets(DataSetEntity entity);
List<DataSetEntity> getAllDatasets(DataSetEntity entity);
/**
* 插入新的数据集到数据库
@ -103,7 +105,7 @@ public interface DataSetService {
* @param entity 查询条件
* @return 数据集文件列表
*/
AjaxResult getAllFiles(DataSetFileEntity entity);
List<DataSetFileEntity> getAllFiles(DataSetFileEntity entity);
/**
* 插入新的数据集文件
@ -127,7 +129,7 @@ public interface DataSetService {
* @param fileId 文件 ID
* @return 影响的行数
*/
AjaxResult deleteFile(Long fileId);
AjaxResult deleteFile(Long[] fileId);
/**
* 根据 ID 查询任务信息
@ -143,7 +145,7 @@ public interface DataSetService {
* @param entity 查询条件
* @return 数据集任务列表
*/
AjaxResult getAllTasks(DataSetTaskEntity entity);
List<DataSetTaskEntity> getAllTasks(DataSetTaskEntity entity);
/**
* 插入新的任务
@ -184,29 +186,85 @@ public interface DataSetService {
* @param entity 查询条件
* @return 数据集日志列表
*/
AjaxResult getAllLogs(DataSetLogEntity entity);
List<DataSetLogEntity> getAllLogs(DataSetLogEntity entity);
/**
* 插入新的日志
* 根据 ID 查询模型
*
* @param log 数据集日志实体
* @return 影响的行数
* @param modelId 模型管理 ID
* @return 模型管理实体
*/
AjaxResult insertLog(DataSetLogEntity log);
AjaxResult getModelsById(Long modelId);
/**
* 更新日志信息
* 查询所有模型
*
* @param log 数据集日志实体
* @return 影响的行数
* @param entity 查询条件
* @return 模型管理列表
*/
AjaxResult updateLog(DataSetLogEntity log);
List<AiModelEntity> getAllModels(AiModelEntity entity);
/**
* 根据 ID 删除日志
* 插入新的模型
*
* @param logId 日志 ID
* @param entity 模型实体
* @return 影响的行数
*/
AjaxResult deleteLog(Long logId);
AjaxResult insertModel(AiModelEntity entity);
/**
* 更新模型实体
*
* @param entity 模型实体
* @return 影响的行数
*/
AjaxResult updateModel(AiModelEntity entity);
/**
* 根据 ID 删除模型
*
* @param modelIds 模型 ID
* @return 影响的行数
*/
AjaxResult deleteModel(Long[] modelIds);
/**
* 根据 ID 查询算法评价
*
* @param algorithmId 算法评价 ID
* @return 算法评价实体
*/
AjaxResult getAlgorithmById(Long algorithmId);
/**
* 查询所有算法评价
*
* @param entity 查询条件
* @return 算法评价列表
*/
List<DataSetAlgorithm> getAllAlgorithms(DataSetAlgorithm entity);
/**
* 插入新的算法评价
*
* @param entity 算法评价实体
* @return 影响的行数
*/
AjaxResult insertAlgorithm(DataSetAlgorithm entity);
/**
* 更新算法评价
*
* @param entity 算法评价实体
* @return 影响的行数
*/
AjaxResult updateAlgorithm(DataSetAlgorithm entity);
/**
* 根据 ID 删除算法评价
*
* @param algorithmIds 算法评价 ID
* @return 影响的行数
*/
AjaxResult deleteAlgorithm(Long[] algorithmIds);
}

View File

@ -4,15 +4,19 @@ import com.bonus.ai.domain.*;
import com.bonus.ai.mapper.DataSetMapper;
import com.bonus.ai.service.DataSetService;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
/**
* @author bonus
*/
@Service
@Slf4j
public class DataSetServiceImpl implements DataSetService {
@Resource
private DataSetMapper mapper;
@ -25,7 +29,12 @@ public class DataSetServiceImpl implements DataSetService {
*/
@Override
public AjaxResult getDatasetById(Long datasetId) {
return null;
try {
DataSetEntity entity = mapper.getDatasetById(datasetId);
return AjaxResult.success(entity);
} catch (Exception e) {
return AjaxResult.error("获取数据失败");
}
}
/**
@ -35,8 +44,8 @@ public class DataSetServiceImpl implements DataSetService {
* @return 返回所有符合条件的数据集的集合
*/
@Override
public AjaxResult getAllDatasets(DataSetEntity entity) {
return null;
public List<DataSetEntity> getAllDatasets(DataSetEntity entity) {
return mapper.getAllDatasets(entity);
}
/**
@ -47,7 +56,13 @@ public class DataSetServiceImpl implements DataSetService {
*/
@Override
public AjaxResult insertDataset(DataSetEntity entity) {
return null;
try {
entity.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
int i = mapper.insertDataset(entity);
return i > 0 ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
} catch (Exception e) {
return AjaxResult.error("新增失败");
}
}
/**
@ -58,7 +73,13 @@ public class DataSetServiceImpl implements DataSetService {
*/
@Override
public AjaxResult updateDataset(DataSetEntity entity) {
return null;
try {
entity.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
int i = mapper.updateDataset(entity);
return i > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改成功");
} catch (Exception e) {
return AjaxResult.error("修改失败");
}
}
/**
@ -69,7 +90,12 @@ public class DataSetServiceImpl implements DataSetService {
*/
@Override
public AjaxResult deleteDataset(Long datasetId) {
return null;
try {
int i = mapper.deleteDataset(datasetId);
return i > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
} catch (Exception e) {
return AjaxResult.error("删除失败");
}
}
/**
@ -80,7 +106,12 @@ public class DataSetServiceImpl implements DataSetService {
*/
@Override
public AjaxResult getCategoryById(Long categoryId) {
return null;
try {
DataSetCategoryEntity entity = mapper.getCategoryById(categoryId);
return AjaxResult.success(entity);
} catch (Exception e) {
return AjaxResult.error("获取数据失败");
}
}
/**
@ -107,7 +138,17 @@ public class DataSetServiceImpl implements DataSetService {
*/
@Override
public AjaxResult insertCategory(DataSetCategoryEntity entity) {
return null;
try {
entity.setCreatedBy(SecurityUtils.getUserId());
int i = mapper.insertCategory(entity);
if (i > 0) {
return AjaxResult.success("新增成功");
} else {
return AjaxResult.error("新增失败");
}
} catch (Exception e) {
return AjaxResult.error("新增失败");
}
}
/**
@ -118,7 +159,12 @@ public class DataSetServiceImpl implements DataSetService {
*/
@Override
public AjaxResult updateCategory(DataSetCategoryEntity entity) {
return null;
try {
int i = mapper.updateCategory(entity);
return i > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
} catch (Exception e) {
return AjaxResult.error("修改失败");
}
}
/**
@ -129,7 +175,12 @@ public class DataSetServiceImpl implements DataSetService {
*/
@Override
public AjaxResult deleteCategory(Long categoryId) {
return null;
try {
int i = mapper.deleteCategory(categoryId);
return i > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
} catch (Exception e) {
return AjaxResult.error("删除失败");
}
}
/**
@ -150,8 +201,8 @@ public class DataSetServiceImpl implements DataSetService {
* @return 数据集文件列表
*/
@Override
public AjaxResult getAllFiles(DataSetFileEntity entity) {
return null;
public List<DataSetFileEntity> getAllFiles(DataSetFileEntity entity) {
return mapper.getAllFiles(entity);
}
/**
@ -162,7 +213,12 @@ public class DataSetServiceImpl implements DataSetService {
*/
@Override
public AjaxResult insertFile(DataSetFileEntity entity) {
return null;
try {
int i = mapper.insertFile(entity);
return i > 0 ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
} catch (Exception e) {
return AjaxResult.error("新增失败");
}
}
/**
@ -173,7 +229,12 @@ public class DataSetServiceImpl implements DataSetService {
*/
@Override
public AjaxResult updateFile(DataSetFileEntity datasetFile) {
return null;
try {
int i = mapper.updateFile(datasetFile);
return i > 0 ? AjaxResult.success("移动成功") : AjaxResult.error("移动失败");
} catch (Exception e) {
return AjaxResult.error("移动失败");
}
}
/**
@ -183,8 +244,13 @@ public class DataSetServiceImpl implements DataSetService {
* @return 影响的行数
*/
@Override
public AjaxResult deleteFile(Long fileId) {
return null;
public AjaxResult deleteFile(Long[] fileId) {
try {
int i = mapper.deleteFile(fileId);
return i > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
} catch (Exception e) {
return AjaxResult.error("删除失败");
}
}
/**
@ -205,8 +271,8 @@ public class DataSetServiceImpl implements DataSetService {
* @return 数据集任务列表
*/
@Override
public AjaxResult getAllTasks(DataSetTaskEntity entity) {
return null;
public List<DataSetTaskEntity> getAllTasks(DataSetTaskEntity entity) {
return mapper.getAllTasks(entity);
}
/**
@ -217,7 +283,12 @@ public class DataSetServiceImpl implements DataSetService {
*/
@Override
public AjaxResult insertTask(DataSetTaskEntity entity) {
return null;
try {
int i = mapper.insertTask(entity);
return i > 0 ? AjaxResult.success("添加成功") : AjaxResult.error("添加失败");
} catch (Exception e) {
return AjaxResult.error("添加失败");
}
}
/**
@ -228,7 +299,12 @@ public class DataSetServiceImpl implements DataSetService {
*/
@Override
public AjaxResult updateTask(DataSetTaskEntity datasetTask) {
return null;
try {
int i = mapper.updateTask(datasetTask);
return i > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
} catch (Exception e) {
return AjaxResult.error("修改失败");
}
}
/**
@ -239,7 +315,12 @@ public class DataSetServiceImpl implements DataSetService {
*/
@Override
public AjaxResult deleteTask(Long taskId) {
return null;
try {
int i = mapper.deleteTask(taskId);
return i > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
} catch (Exception e) {
return AjaxResult.error("删除失败");
}
}
/**
@ -260,40 +341,163 @@ public class DataSetServiceImpl implements DataSetService {
* @return 数据集日志列表
*/
@Override
public AjaxResult getAllLogs(DataSetLogEntity entity) {
return null;
public List<DataSetLogEntity> getAllLogs(DataSetLogEntity entity) {
return mapper.getAllLogs(entity);
}
/**
* 插入新的日志
* 根据 ID 查询模型
*
* @param log 数据集日志实体
* @return 影响的行数
* @param modelId 模型管理 ID
* @return 模型管理实体
*/
@Override
public AjaxResult insertLog(DataSetLogEntity log) {
return null;
public AjaxResult getModelsById(Long modelId) {
try {
AiModelEntity entity = mapper.getModelsById(modelId);
return AjaxResult.success(entity);
} catch (Exception e) {
return AjaxResult.error("获取数据失败");
}
}
/**
* 更新日志信息
* 查询所有模型
*
* @param log 数据集日志实体
* @return 影响的行数
* @param entity 查询条件
* @return 模型管理列表
*/
@Override
public AjaxResult updateLog(DataSetLogEntity log) {
return null;
public List<AiModelEntity> getAllModels(AiModelEntity entity) {
return mapper.getAllModels(entity);
}
/**
* 根据 ID 删除日志
* 插入新的模型
*
* @param logId 日志 ID
* @param entity 模型实体
* @return 影响的行数
*/
@Override
public AjaxResult deleteLog(Long logId) {
return null;
public AjaxResult insertModel(AiModelEntity entity) {
try {
entity.setCreateBy(SecurityUtils.getUsername());
int i = mapper.insertModel(entity);
return i > 0 ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
} catch (Exception e) {
return AjaxResult.error("新增失败");
}
}
/**
* 更新模型实体
*
* @param entity 模型实体
* @return 影响的行数
*/
@Override
public AjaxResult updateModel(AiModelEntity entity) {
try {
int i = mapper.updateModel(entity);
return i > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
} catch (Exception e) {
return AjaxResult.error("修改失败");
}
}
/**
* 根据 ID 删除模型
*
* @param modelIds 模型 ID
* @return 影响的行数
*/
@Override
public AjaxResult deleteModel(Long[] modelIds) {
try {
int i = mapper.deleteModel(modelIds);
return i > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
} catch (Exception e) {
return AjaxResult.error("删除失败");
}
}
/**
* 根据 ID 查询算法评价
*
* @param algorithmId 算法评价 ID
* @return 算法评价实体
*/
@Override
public AjaxResult getAlgorithmById(Long algorithmId) {
try {
DataSetAlgorithm algorithmById = mapper.getAlgorithmById(algorithmId);
return AjaxResult.success(algorithmById);
} catch (Exception e) {
log.debug(e.getMessage());
return AjaxResult.error("获取数据失败");
}
}
/**
* 查询所有算法评价
*
* @param entity 查询条件
* @return 算法评价列表
*/
@Override
public List<DataSetAlgorithm> getAllAlgorithms(DataSetAlgorithm entity) {
return mapper.getAllAlgorithms(entity);
}
/**
* 插入新的算法评价
*
* @param entity 算法评价实体
* @return 影响的行数
*/
@Override
public AjaxResult insertAlgorithm(DataSetAlgorithm entity) {
try {
entity.setCreateBy(SecurityUtils.getUsername());
int i = mapper.insertAlgorithm(entity);
return i > 0 ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
} catch (Exception e) {
log.debug(e.getMessage());
return AjaxResult.error("新增失败");
}
}
/**
* 更新算法评价
*
* @param entity 算法评价实体
* @return 影响的行数
*/
@Override
public AjaxResult updateAlgorithm(DataSetAlgorithm entity) {
try {
int i = mapper.updateAlgorithm(entity);
return i > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
} catch (Exception e) {
log.debug(e.getMessage());
return AjaxResult.error("修改失败");
}
}
/**
* 根据 ID 删除算法评价
*
* @param algorithmIds 算法评价 ID
* @return 影响的行数
*/
@Override
public AjaxResult deleteAlgorithm(Long[] algorithmIds) {
try {
int i = mapper.deleteAlgorithm(algorithmIds);
return i > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
} catch (Exception e) {
log.debug(e.getMessage());
return AjaxResult.error("删除失败");
}
}
}

View File

@ -3,22 +3,28 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.ai.mapper.DataSetMapper">
<!--
根据数据集 ID 查询数据集的详细信息。
使用 AS 关键字将数据库字段映射到 Java 对象的属性。
-->
<select id="getDatasetById" resultType="com.bonus.ai.domain.DataSetEntity">
SELECT dataset_id AS datasetId,
dataset_name AS datasetName,
sub_task_type_id AS subTaskTypeId,
description AS description,
create_by AS createBy,
create_time AS createTime,
update_by AS updateBy,
update_time AS updateTime
FROM ai_dataset
WHERE dataset_id = #{datasetId}
AND del_flag = '0' <!-- 只查询未被删除的数据 -->
SELECT ad.dataset_id AS datasetId,
ad.dataset_name AS datasetName,
ad.sub_task_type_id AS subTaskTypeId,
ad.description AS description,
ad.create_by AS createBy,
ad.create_time AS createTime,
ad.update_by AS updateBy,
ad.update_time AS updateTime,
ad.category_id AS categoryID,
adc.category_name AS categoryName,
ad.file_path AS filePath
FROM ai_dataset ad
LEFT JOIN ai_dataset_category adc ON adc.category_id = ad.category_id
WHERE ad.dataset_id = #{datasetId}
AND ad.del_flag = '0' <!-- 只查询未被删除的数据 -->
</select>
<!--
@ -26,38 +32,31 @@
使用 <if> 标签判断 datasetName 是否为空,从而动态生成 SQL 语句。
-->
<select id="getAllDatasets" resultType="com.bonus.ai.domain.DataSetEntity">
SELECT dataset_id AS datasetId,
dataset_name AS datasetName,
sub_task_type_id AS subTaskTypeId,
description AS description,
create_by AS createBy,
create_time AS createTime,
update_by AS updateBy,
update_time AS updateTime
FROM ai_dataset
WHERE del_flag = '0' <!-- 只查询未被删除的数据 -->
SELECT ad.dataset_id AS datasetId,
ad.dataset_name AS datasetName,
ad.sub_task_type_id AS subTaskTypeId,
ad.description AS description,
ad.create_by AS createBy,
ad.create_time AS createTime,
ad.update_by AS updateBy,
ad.update_time AS updateTime,
ad.category_id AS categoryID,
adc.category_name AS categoryName,
ad.file_path AS filePath,
(SELECT COUNT(ai_dataset_file.file_id) from ai_dataset_file WHERE ai_dataset_file.dataset_id = ad.dataset_id and
ai_dataset_file.del_flag='0') AS num
FROM ai_dataset ad
LEFT JOIN ai_dataset_category adc ON adc.category_id = ad.category_id
WHERE ad.del_flag = '0' <!-- 只查询未被删除的数据 -->
<if test="datasetName != null and datasetName != ''">
AND dataset_name LIKE CONCAT('%', #{datasetName}, '%') <!-- 根据 datasetName 进行模糊查询 -->
AND ad.dataset_name LIKE CONCAT('%', #{datasetName}, '%') <!-- 根据 datasetName 进行模糊查询 -->
</if>
</select>
<!--
根据类别 ID 查询类别的详细信息。
具体实现尚未提供。
-->
<select id="getCategoryById" resultType="com.bonus.ai.domain.DataSetCategoryEntity">
<!--
SELECT category_id, category_name, ...
FROM dataset_category
WHERE category_id = #{categoryId}
-->
</select>
<!--
查询所有类别信息。
具体实现尚未提供。
-->
<select id="getCategories" resultType="com.bonus.ai.domain.DataSetCategoryEntity">
SELECT category_id AS categoryId,
category_name AS categoryName,
parent_id AS parentId,
@ -66,25 +65,157 @@
description AS description,
create_time AS createTime
FROM ai_dataset_category
WHERE del_flag = '0'
WHERE category_id = #{categoryId}
</select>
<!--
查询所有类别信息。
具体实现尚未提供。
-->
<select id="getCategories" resultType="com.bonus.ai.domain.DataSetCategoryEntity">
SELECT adc.category_id AS categoryId,
adc.category_name AS categoryName,
adc.parent_id AS parentId,
adc.enabled AS enabled,
adc.created_by AS createdBy,
adc.description AS description,
adc.create_time AS createTime,
su.user_name AS createName
FROM ai_dataset_category adc
LEFT JOIN sys_user su ON su.user_id = adc.created_by
WHERE adc.del_flag = '0'
<if test="categoryName != null and categoryName != ''">
AND adc.category_name LIKE CONCAT('%', #{categoryName}, '%') <!-- 根据 datasetName 进行模糊查询 -->
</if>
<if test="enabled != null and enabled != ''">
AND adc.enabled =#{enabled} <!-- 根据 datasetName 进行模糊查询 -->
</if>
</select>
<select id="getFileById" resultType="com.bonus.ai.domain.DataSetFileEntity">
</select>
<select id="getAllFiles" resultType="com.bonus.ai.domain.DataSetFileEntity">
SELECT file_id AS fileId,
file_name AS fileName,
dataset_id AS datasetId,
file_address AS fileAddress,
is_audited AS isAudited,
is_labeled AS isLabeled,
create_by AS createBy,
create_time AS createTime,
update_by AS updateBy,
update_time AS updateTime
FROM ai_dataset_file
WHERE del_flag = '0'
and dataset_id = #{datasetId}
</select>
<select id="getTaskById" resultType="com.bonus.ai.domain.DataSetTaskEntity">
</select>
<select id="getAllTasks" resultType="com.bonus.ai.domain.DataSetTaskEntity">
SELECT task_id AS taskId,
dataset_id AS datasetId,
task_owner AS taskOwner,
description AS description,
create_by AS createBy,
create_time AS createTime,
task_name AS taskName,
start_time AS startTime,
end_time AS endTime,
status AS status,
level AS level
FROM ai_dataset_task
WHERE del_flag = '0'
</select>
<select id="getLogById" resultType="com.bonus.ai.domain.DataSetLogEntity">
</select>
<select id="getAllLogs" resultType="com.bonus.ai.domain.DataSetLogEntity">
SELECT log_id AS logId,
file_id AS fileId,
operation_type AS operationType,
operation_by AS operationBy,
operation_time AS operationTime,
operation_result AS operationResult,
operation_reason AS operationReason
from ai_dataset_log
</select>
<select id="getModelsById" resultType="com.bonus.ai.domain.AiModelEntity">
SELECT am.model_id AS modelId,
am.model_name AS modelName,
am.model_version AS modelVersion,
am.infer_language AS inferLanguage,
am.model_format AS modelFormat,
am.deploy_requirement AS deployRequirement,
am.model_address AS modelAddress,
am.user_guide AS userGuide,
am.description AS description,
am.dataSetId AS dataSetId,
ad.dataset_name AS datasetName,
am.model_type AS modelType,
am.algorithm AS algorithm,
am.create_by AS createBy,
am.create_time AS createTime
FROM ai_model am
left join ai_dataset ad ON ad.dataset_id = am.dataSetId
WHERE am.del_flag = '0'
AND am.model_id = #{modelId}
</select>
<select id="getAllModels" resultType="com.bonus.ai.domain.AiModelEntity">
SELECT am.model_id AS modelId,
am.model_name AS modelName,
am.model_version AS modelVersion,
am.infer_language AS inferLanguage,
am.model_format AS modelFormat,
am.deploy_requirement AS deployRequirement,
am.model_address AS modelAddress,
am.user_guide AS userGuide,
am.description AS description,
am.dataSetId AS dataSetId,
ad.dataset_name AS datasetName,
am.model_type AS modelType,
am.algorithm AS algorithm,
am.create_by AS createBy,
am.create_time AS createTime
FROM ai_model am
left join ai_dataset ad ON ad.dataset_id = am.dataSetId
WHERE am.del_flag = '0'
<if test="modelName != null and modelName != ''">
AND am.model_name LIKE CONCAT('%', #{modelName}, '%') <!-- 根据 datasetName 进行模糊查询 -->
</if>
<if test="modelType != null and modelType != ''">
AND am.model_type = #{modelType}
</if>
</select>
<select id="getAlgorithmById" resultType="com.bonus.ai.domain.DataSetAlgorithm">
SELECT algorithm_id AS algorithmId,
model_id AS modelId,
validationSampleCount AS validationSampleCount,
correctCount AS correctCount,
missedDetectionCount AS missedDetectionCount,
recognitionSpeed AS recognitionSpeed,
create_by AS createBy,
create_time AS createTime
from ai_dataset_algorithm
WHERE algorithm_id = #{algorithmId}
</select>
<select id="getAllAlgorithms" resultType="com.bonus.ai.domain.DataSetAlgorithm">
SELECT ada.algorithm_id AS algorithmId,
ada.model_id AS modelId,
am.model_name AS modelName,
ada.validationSampleCount AS validationSampleCount,
ada.correctCount AS correctCount,
ada.missedDetectionCount AS missedDetectionCount,
ada.recognitionSpeed AS recognitionSpeed,
ada.create_by AS createBy,
ada.create_time AS createTime
from ai_dataset_algorithm ada
left join ai_model am ON am.model_id = ada.model_id
WHERE ada.del_flag = '0'
<if test="modelId != null and modelId != ''">
AND ada.model_id =#{modelId} <!-- 根据 datasetName 进行模糊查询 -->
</if>
</select>
<!--
@ -92,10 +223,9 @@
useGeneratedKeys 属性用于自动生成主键并将其赋值给 Java 对象的属性。
-->
<insert id="insertDataset" useGeneratedKeys="true" keyProperty="datasetId">
INSERT INTO ai_dataset (dataset_name, sub_task_type_id, description, create_by, create_time,
update_by, update_time)
VALUES (#{datasetName}, #{subTaskTypeId}, #{description}, #{createBy}, #{createTime}, #{updateBy},
#{updateTime})
INSERT INTO ai_dataset (dataset_name, sub_task_type_id, description, create_by,
update_by, category_id)
VALUES (#{datasetName}, #{subTaskTypeId}, #{description}, #{createBy}, #{updateBy}, #{categoryId})
</insert>
<!--
@ -103,20 +233,38 @@
具体实现尚未提供。
-->
<insert id="insertCategory">
<!--
INSERT INTO dataset_category (category_name, parent_id, ...)
VALUES (#{categoryName}, #{parentId}, ...)
-->
INSERT INTO ai_dataset_category (category_name, parent_id, enabled, created_by, description)
VALUES (#{categoryName}, #{parentId}, #{enabled}, #{createdBy}, #{description})
</insert>
<insert id="insertFile">
INSERT INTO ai_dataset_file (file_name, dataset_id, file_address, is_audited, is_labeled)
VALUE (#{fileName}, #{datasetId}, #{fileAddress}, #{isAudited}, #{isLabeled})
</insert>
<insert id="insertTask">
INSERT INTO ai_dataset_task (dataset_id, task_owner, description, create_by,
task_name, start_time, end_time, status, level)
VALUES (#{datasetId}, #{task_owner}, #{description}, #{create_by}, #{taskName}, #{startTime}, #{endTime},
#{status}, #{level});
</insert>
<insert id="insertLog">
</insert>
<insert id="insertModel">
INSERT INTO ai_model (model_name, model_version, sub_task_type_id,
infer_language, model_format, deploy_requirement, model_address,
user_guide, description, create_by,
algorithm, dataSetId, model_type)
VALUES (#{modelName}, #{modelVersion}, #{subTaskTypeId}, #{inferLanguage}, #{modelFormat},
#{deployRequirement}, #{modelAddress}, #{userGuide}, #{description}, #{createBy}, #{algorithm},
#{dataSetId}, #{modelType});
</insert>
<insert id="insertAlgorithm">
INSERT INTO ai_dataset_algorithm(model_id, validationSampleCount, correctCount, missedDetectionCount,
recognitionSpeed,
create_by) VALUE (#{modelId}, #{validationSampleCount}, #{correctCount},
#{missedDetectionCount}, #{recognitionSpeed}, #{createBy})
</insert>
<!--
更新指定数据集的信息。
@ -125,11 +273,9 @@
<update id="updateDataset">
UPDATE ai_dataset
SET dataset_name = #{datasetName},
sub_task_type_id = #{subTaskTypeId},
del_flag = #{delFlag}, <!-- 根据需要设置删除标志 -->
description = #{description},
update_by = #{updateBy},
update_time = #{updateTime}
category_id = #{categoryId}
WHERE dataset_id = #{datasetId}
</update>
<!--
@ -137,11 +283,12 @@
具体实现尚未提供。
-->
<update id="updateCategory">
<!--
UPDATE dataset_category
SET category_name = #{categoryName}, ...
UPDATE ai_dataset_category
SET category_name = #{categoryName},
parent_id =#{parentId},
enabled =#{enabled},
description =#{description}
WHERE category_id = #{categoryId}
-->
</update>
<!--
删除数据集(逻辑删除),将 del_flag 设置为 '1'。
@ -157,30 +304,75 @@
具体实现尚未提供。
-->
<update id="deleteCategory">
<!--
UPDATE ai_dataset
UPDATE ai_dataset_category
SET del_flag = '1'
WHERE category_id = #{categoryId}
-->
</update>
<update id="updateFile">
UPDATE ai_dataset_file
SET dataset_id = #{datasetId},
update_by = #{updateBy}
WHERE file_id IN
<foreach collection="fileIds" item="fileId" open="(" separator="," close=")">
#{fileId}
</foreach>
</update>
<update id="deleteFile">
UPDATE ai_dataset_file
SET del_flag = '1'
WHERE file_id IN
<foreach collection="array" item="fileId" open="(" separator="," close=")">
#{fileId}
</foreach>
</update>
<update id="updateTask">
UPDATE ai_dataset_task
SET level = #{level}
WHERE task_id = #{taskId}
</update>
<update id="deleteTask">
UPDATE ai_dataset_task
SET del_flag = '1'
WHERE task_id = #{taskId}
</update>
<update id="updateLog">
<update id="updateModel">
UPDATE ai_model
set model_name = #{modelName},
model_version = #{modelVersion},
infer_language = #{inferLanguage},
model_format = #{modelFormat},
deploy_requirement = #{deployRequirement},
model_address = #{modelAddress},
user_guide =#{userGuide},
model_type = #{modelType},
dataSetId = #{dataSetId},
algorithm = #{algorithm}
WHERE model_id = #{modelId}
</update>
<update id="deleteLog">
<update id="deleteModel">
UPDATE ai_model
SET del_flag ='1'
where model_id in
<foreach item="modelId" collection="array" open="(" separator="," close=")">
#{modelId}
</foreach>
</update>
<update id="updateAlgorithm">
UPDATE ai_dataset_algorithm
set model_id =#{modelId},
validationSampleCount = #{validationSampleCount},
correctCount = #{correctCount},
missedDetectionCount = #{missedDetectionCount},
recognitionSpeed = #{recognitionSpeed}
WHERE algorithm_id = #{algorithmId}
</update>
<update id="deleteAlgorithm">
UPDATE ai_dataset_algorithm
SET del_flag ='1'
where algorithm_id in
<foreach item="algorithmId" collection="array" open="(" separator="," close=")">
#{algorithmId}
</foreach>
</update>
</mapper>