Bonus-Cloud-AI-V2/bonus-modules/bonus-ai/src/main/resources/mapper/ModelManagerMapper.xml

132 lines
6.7 KiB
XML
Raw Normal View History

2024-12-10 16:20:20 +08:00
<?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"/>
2024-12-11 18:37:36 +08:00
<result property="manualFileName" column="manual_file_name"/>
<result property="datasetId" column="dataset_id"/>
<result property="modelFileName" column="model_file_name"/>
<result property="datasetName" column="dataset_name"/>
2024-12-10 16:20:20 +08:00
</resultMap>
<sql id="selectAiModelManagerVo">
2024-12-11 18:37:36 +08:00
select amm.id,
su.user_name AS create_by,
amm.model_name,
amm.model_version,
amm.model_type,
amm.model_frame,
amm.model_path,
amm.model_manual,
amm.remark,
amm.create_time,
amm.update_time,
amm.is_active,
amm.dataset_id,
ad.dataset_name,
amm.manual_file_name,
amm.model_file_name
from ai_model_manager amm
LEFT JOIN sys_user su ON amm.create_by = su.user_id
LEFT JOIN ai_dataset ad ON amm.dataset_id = ad.dataset_id
2024-12-10 16:20:20 +08:00
</sql>
2024-12-11 18:37:36 +08:00
<select id="selectAiModelManagerList" parameterType="com.bonus.ai.domain.ModelManagerEntity"
resultMap="AiModelManagerResult">
2024-12-10 16:20:20 +08:00
<include refid="selectAiModelManagerVo"/>
<where>
2024-12-11 18:37:36 +08:00
<if test="modelName != null and modelName != ''">and amm.model_name like concat('%', #{modelName}, '%')
</if>
<if test="modelVersion != null and modelVersion != ''">and amm.model_version = #{modelVersion}</if>
<if test="modelType != null and modelType != ''">and amm.model_type = #{modelType}</if>
<if test="modelFrame != null and modelFrame != ''">and amm.model_frame = #{modelFrame}</if>
<if test="modelPath != null and modelPath != ''">and amm.model_path = #{modelPath}</if>
<if test="modelManual != null and modelManual != ''">and amm.model_manual = #{modelManual}</if>
<if test="isActive != null and isActive != ''">and amm.is_active = #{isActive}</if>
2024-12-10 16:20:20 +08:00
</where>
</select>
<select id="selectAiModelManagerById" parameterType="Long" resultMap="AiModelManagerResult">
<include refid="selectAiModelManagerVo"/>
2024-12-11 18:37:36 +08:00
where amm.id = #{id}
2024-12-10 16:20:20 +08:00
</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>
2024-12-11 18:37:36 +08:00
<if test="datasetId != null">dataset_id,</if>
<if test="modelFileName != null">model_file_name,</if>
<if test="manualFileName != null">manual_file_name,</if>
2024-12-10 16:20:20 +08:00
<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>
2024-12-11 18:37:36 +08:00
<if test="datasetId != null">#{datasetId},</if>
<if test="modelFileName != null">#{modelFileName},</if>
<if test="manualFileName != null">#{manualFileName},</if>
2024-12-10 16:20:20 +08:00
<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="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>
2024-12-11 18:37:36 +08:00
<if test="datasetId != null">dataset_Id = #{datasetId},</if>
<if test="modelFileName != null">model_file_name = #{modelFileName},</if>
<if test="manualFileName != null">manual_file_name = #{manualFileName},</if>
2024-12-10 16:20:20 +08:00
<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>