提交代码

This commit is contained in:
jiang 2024-12-10 16:20:20 +08:00
parent 274731c5ec
commit cb10ed7f7c
10 changed files with 478 additions and 2 deletions

View File

@ -0,0 +1,83 @@
package com.bonus.ai.controller;
import com.bonus.ai.domain.ModelManagerEntity;
import com.bonus.ai.service.ModelManagerService;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import com.bonus.common.security.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* 模型管理Controller
*
* @author bonus
* @date 2024-12-10
*/
@RestController
@RequestMapping("/manager")
public class ModelManagerController extends BaseController {
@Resource
private ModelManagerService aiModelManagerService;
/**
* 查询模型管理列表
*/
@RequiresPermissions("model:manager:list")
@GetMapping("/list")
public TableDataInfo list(ModelManagerEntity aiModelManager) {
try {
startPage();
List<ModelManagerEntity> list = aiModelManagerService.selectAiModelManagerList(aiModelManager);
return getDataTable(list);
} catch (Exception e) {
return getDataTable(new ArrayList<>());
}
}
/**
* 获取模型管理详细信息
*/
@RequiresPermissions("model:manager:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return aiModelManagerService.selectAiModelManagerById(id);
}
/**
* 新增模型管理
*/
@RequiresPermissions("model:manager:add")
@PostMapping("/add")
@SysLog(title = "模型管理", businessType = OperaType.INSERT, logType = 0, module = "模型管理", details = "导出模型管理列表")
public AjaxResult add(@RequestBody ModelManagerEntity aiModelManager) {
return aiModelManagerService.insertAiModelManager(aiModelManager);
}
/**
* 修改模型管理
*/
@RequiresPermissions("model:manager:edit")
@PostMapping("/edit")
@SysLog(title = "模型管理", businessType = OperaType.UPDATE, logType = 0, module = "模型管理", details = "导出模型管理列表")
public AjaxResult edit(@RequestBody ModelManagerEntity aiModelManager) {
return aiModelManagerService.updateAiModelManager(aiModelManager);
}
/**
* 删除模型管理
*/
@RequiresPermissions("model:manager:remove")
@PostMapping("/delete/{ids}")
@SysLog(title = "模型管理", businessType = OperaType.DELETE, logType = 0, module = "模型管理", details = "导出模型管理列表")
public AjaxResult remove(@PathVariable Long[] ids) {
return aiModelManagerService.deleteAiModelManagerByIds(ids);
}
}

View File

@ -69,7 +69,7 @@ public class DataSetBasicFileEntity extends BaseEntity {
private Date uploadTime;
private Long dataSetId;
private String auditFailedReason;
/**查询目的,表示文件在当前任务下的标注状态*/
String fileAnnotationStatus;
String annotationResult;

View File

@ -0,0 +1,59 @@
package com.bonus.ai.domain;
import com.bonus.common.core.annotation.Excel;
import com.bonus.common.core.web.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 模型管理对象 ai_model_manager
*
* @author bonus
* @date 2024-12-10
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ModelManagerEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Long id;
/**
* 模型名称
*/
private String modelName;
/**
* 版本号
*/
private String modelVersion;
/**
* 模型类型
*/
private String modelType;
/**
* 模型框架
*/
private String modelFrame;
/**
* 模型上传path
*/
private String modelPath;
/**
* 使用手册path
*/
private String modelManual;
/**
* 是否删除
*/
private String isActive;
}

View File

@ -79,6 +79,8 @@ public class AnnotationTaskEntity extends BaseEntity {
/**最新版本数*/
private String lastVersionName;
private String auditFailedReason;
@Data
public static class UserFileCount{

View File

@ -0,0 +1,54 @@
package com.bonus.ai.mapper;
import com.bonus.ai.domain.ModelManagerEntity;
import java.util.List;
/**
* 模型管理Mapper接口
*
* @author bonus
* @date 2024-12-10
*/
public interface ModelManagerMapper {
/**
* 查询模型管理
*
* @param id 模型管理主键
* @return 模型管理
*/
public ModelManagerEntity selectAiModelManagerById(Long id);
/**
* 查询模型管理列表
*
* @param aiModelManager 模型管理
* @return 模型管理集合
*/
public List<ModelManagerEntity> selectAiModelManagerList(ModelManagerEntity aiModelManager);
/**
* 新增模型管理
*
* @param aiModelManager 模型管理
* @return 结果
*/
public int insertAiModelManager(ModelManagerEntity aiModelManager);
/**
* 修改模型管理
*
* @param aiModelManager 模型管理
* @return 结果
*/
public int updateAiModelManager(ModelManagerEntity aiModelManager);
/**
* 批量删除模型管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteAiModelManagerByIds(Long[] ids);
}

View File

@ -0,0 +1,108 @@
package com.bonus.ai.service.Impl;
import java.util.List;
import com.bonus.ai.domain.ModelManagerEntity;
import com.bonus.ai.mapper.ModelManagerMapper;
import com.bonus.ai.service.ModelManagerService;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 模型管理Service业务层处理
*
* @author bonus
* @date 2024-12-10
*/
@Service
public class ModelManagerServiceImpl implements ModelManagerService {
@Resource
private ModelManagerMapper aiModelManagerMapper;
/**
* 查询模型管理
*
* @param id 模型管理主键
* @return 模型管理
*/
@Override
public AjaxResult selectAiModelManagerById(Long id) {
try {
ModelManagerEntity aiModelManager = aiModelManagerMapper.selectAiModelManagerById(id);
if (ObjectUtils.isEmpty(aiModelManager)) {
return AjaxResult.error();
} else {
return AjaxResult.success();
}
} catch (Exception e) {
return AjaxResult.error();
}
}
/**
* 查询模型管理列表
*
* @param aiModelManager 模型管理
* @return 模型管理
*/
@Override
public List<ModelManagerEntity> selectAiModelManagerList(ModelManagerEntity aiModelManager) {
return aiModelManagerMapper.selectAiModelManagerList(aiModelManager);
}
/**
* 新增模型管理
*
* @param aiModelManager 模型管理
* @return 结果
*/
@Override
public AjaxResult insertAiModelManager(ModelManagerEntity aiModelManager) {
aiModelManager.setCreateTime(DateUtils.getNowDate());
try {
int rows = aiModelManagerMapper.insertAiModelManager(aiModelManager);
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
} catch (Exception e) {
return AjaxResult.error();
}
}
/**
* 修改模型管理
*
* @param aiModelManager 模型管理
* @return 结果
*/
@Override
public AjaxResult updateAiModelManager(ModelManagerEntity aiModelManager) {
aiModelManager.setUpdateTime(DateUtils.getNowDate());
try {
int rows = aiModelManagerMapper.updateAiModelManager(aiModelManager);
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
} catch (Exception e) {
return AjaxResult.error();
}
}
/**
* 批量删除模型管理
*
* @param ids 需要删除的模型管理主键
* @return 结果
*/
@Override
public AjaxResult deleteAiModelManagerByIds(Long[] ids) {
try {
int rows = aiModelManagerMapper.deleteAiModelManagerByIds(ids);
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
} catch (Exception e) {
return AjaxResult.error();
}
}
}

View File

@ -0,0 +1,56 @@
package com.bonus.ai.service;
import com.bonus.ai.domain.ModelManagerEntity;
import com.bonus.common.core.web.domain.AjaxResult;
import java.util.List;
/**
* 模型管理Service接口
*
* @author bonus
* @date 2024-12-10
*/
public interface ModelManagerService
{
/**
* 查询模型管理
*
* @param id 模型管理主键
* @return 模型管理
*/
public AjaxResult selectAiModelManagerById(Long id);
/**
* 查询模型管理列表
*
* @param aiModelManager 模型管理
* @return 模型管理集合
*/
public List<ModelManagerEntity> selectAiModelManagerList(ModelManagerEntity aiModelManager);
/**
* 新增模型管理
*
* @param aiModelManager 模型管理
* @return 结果
*/
public AjaxResult insertAiModelManager(ModelManagerEntity aiModelManager);
/**
* 修改模型管理
*
* @param aiModelManager 模型管理
* @return 结果
*/
public AjaxResult updateAiModelManager(ModelManagerEntity aiModelManager);
/**
* 批量删除模型管理
*
* @param ids 需要删除的模型管理主键集合
* @return 结果
*/
public AjaxResult deleteAiModelManagerByIds(Long[] ids);
}

View File

@ -240,6 +240,7 @@
adfm.create_time AS createTime,
atap.annotation_status AS fileAnnotationStatus,
atap.annotation_result AS annotationResult,
atap.audit_failed_reason AS auditFailedReason,
aat.task_id
FROM ai_basic_file abf
LEFT JOIN ai_dataset_file_map adfm ON abf.file_id = adfm.file_id

View File

@ -48,7 +48,8 @@
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
WHERE adfm.dataset_id = ad.dataset_id AND adfm.is_annotated = '0') AS notAnnotatedCount,
( SELECT adv.version_name FROM ai_dataset_version adv WHERE adv.dataset_id = ad.dataset_id ORDER BY adv.create_time DESC LIMIT 1 ) AS latestVersionName
FROM
ai_dataset ad
</sql>

View File

@ -0,0 +1,112 @@
<?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.ModelManagerMapper">
<resultMap type="com.bonus.ai.domain.ModelManagerEntity" id="AiModelManagerResult">
<result property="id" column="id"/>
<result property="createBy" column="create_by"/>
<result property="modelName" column="model_name"/>
<result property="modelVersion" column="model_version"/>
<result property="modelType" column="model_type"/>
<result property="modelFrame" column="model_frame"/>
<result property="modelPath" column="model_path"/>
<result property="modelManual" column="model_manual"/>
<result property="remark" column="remark"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="isActive" column="is_active"/>
</resultMap>
<sql id="selectAiModelManagerVo">
select id,
create_by,
model_name,
model_version,
model_type,
model_frame,
model_path,
model_manual,
remark,
create_time,
update_time,
is_active
from ai_model_manager
</sql>
<select id="selectAiModelManagerList" parameterType="com.bonus.ai.domain.ModelManagerEntity" resultMap="AiModelManagerResult">
<include refid="selectAiModelManagerVo"/>
<where>
<if test="modelName != null and modelName != ''">and model_name like concat('%', #{modelName}, '%')</if>
<if test="modelVersion != null and modelVersion != ''">and model_version = #{modelVersion}</if>
<if test="modelType != null and modelType != ''">and model_type = #{modelType}</if>
<if test="modelFrame != null and modelFrame != ''">and model_frame = #{modelFrame}</if>
<if test="modelPath != null and modelPath != ''">and model_path = #{modelPath}</if>
<if test="modelManual != null and modelManual != ''">and model_manual = #{modelManual}</if>
<if test="isActive != null and isActive != ''">and is_active = #{isActive}</if>
</where>
</select>
<select id="selectAiModelManagerById" parameterType="Long" resultMap="AiModelManagerResult">
<include refid="selectAiModelManagerVo"/>
where id = #{id}
</select>
<insert id="insertAiModelManager" parameterType="com.bonus.ai.domain.ModelManagerEntity">
insert into ai_model_manager
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="modelName != null">model_name,</if>
<if test="modelVersion != null">model_version,</if>
<if test="modelType != null">model_type,</if>
<if test="modelFrame != null">model_frame,</if>
<if test="modelPath != null">model_path,</if>
<if test="modelManual != null">model_manual,</if>
<if test="remark != null">remark,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="isActive != null">is_active,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="modelName != null">#{modelName},</if>
<if test="modelVersion != null">#{modelVersion},</if>
<if test="modelType != null">#{modelType},</if>
<if test="modelFrame != null">#{modelFrame},</if>
<if test="modelPath != null">#{modelPath},</if>
<if test="modelManual != null">#{modelManual},</if>
<if test="remark != null">#{remark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="isActive != null">#{isActive},</if>
</trim>
</insert>
<update id="updateAiModelManager" parameterType="com.bonus.ai.domain.ModelManagerEntity">
update ai_model_manager
<trim prefix="SET" suffixOverrides=",">
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="modelName != null">model_name = #{modelName},</if>
<if test="modelVersion != null">model_version = #{modelVersion},</if>
<if test="modelType != null">model_type = #{modelType},</if>
<if test="modelFrame != null">model_frame = #{modelFrame},</if>
<if test="modelPath != null">model_path = #{modelPath},</if>
<if test="modelManual != null">model_manual = #{modelManual},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isActive != null">is_active = #{isActive},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAiModelManagerByIds" parameterType="String">
delete from ai_model_manager where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>