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

78 lines
3.8 KiB
XML

<?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.IntelligentAnnotationMapper">
<!-- 定义 ResultMap -->
<resultMap id="IntelligentAnnotationServiceResultMap" type="com.bonus.ai.domain.dataset.IntelligentAnnotationServiceEntity">
<id property="serviceId" column="intelligent_annotation_service_id"/>
<result property="serviceName" column="intelligent_annotation_service_name"/>
<result property="serviceUrl" column="intelligent_annotation_service_url"/>
<result property="annotationLabels" column="intelligent_annotation_service_labels"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<!-- 插入 -->
<insert id="insertIntelligentAnnotationService" parameterType="com.bonus.ai.domain.dataset.IntelligentAnnotationServiceEntity" useGeneratedKeys="true" keyProperty="serviceId">
INSERT INTO ai_intelligent_annotation_service
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="serviceName != null and serviceName != ''">intelligent_annotation_service_name,</if>
<if test="serviceUrl != null and serviceUrl != ''">intelligent_annotation_service_url,</if>
<if test="annotationLabels != null and annotationLabels != ''">intelligent_annotation_service_labels,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="serviceName != null and serviceName != ''">#{serviceName},</if>
<if test="serviceUrl != null and serviceUrl != ''">#{serviceUrl},</if>
<if test="annotationLabels != null and annotationLabels != ''">#{annotationLabels},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<!-- 更新 -->
<update id="updateIntelligentAnnotationService">
UPDATE ai_intelligent_annotation_service
SET intelligent_annotation_service_name = #{serviceName},
intelligent_annotation_service_url = #{serviceUrl},
intelligent_annotation_service_labels = #{annotationLabels},
del_flag = #{delFlag},
update_by = #{updateBy},
update_time = #{updateTime}
WHERE intelligent_annotation_service_id = #{serviceId}
</update>
<update id="deleteIntelligentAnnotationService">
UPDATE ai_intelligent_annotation_service
SET del_flag = '1'
WHERE intelligent_annotation_service_id = #{serviceId}
</update>
<!-- 按 ID 查询 -->
<select id="getIntelligentAnnotationServiceById" resultMap="IntelligentAnnotationServiceResultMap">
SELECT * FROM ai_intelligent_annotation_service
WHERE intelligent_annotation_service_id = #{serviceId}
</select>
<!-- 查询所有有效记录 -->
<select id="getIntelligentAnnotationService" resultMap="IntelligentAnnotationServiceResultMap">
SELECT * FROM ai_intelligent_annotation_service
WHERE del_flag = '0'
</select>
</mapper>