| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?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.fs.company.mapper.AdminAiSceneModelMapper">
- <resultMap type="com.fs.company.domain.AdminAiSceneModel" id="AdminAiSceneModelResult">
- <id property="id" column="id"/>
- <result property="sceneCode" column="scene_code"/>
- <result property="modelId" column="model_id"/>
- <result property="pipelineOrder" column="pipeline_order"/>
- <result property="role" column="role"/>
- <result property="sortWeight" column="sort_weight"/>
- <result property="createTime" column="create_time"/>
- </resultMap>
- <resultMap type="com.fs.company.domain.AdminAiSceneModel" id="AdminAiSceneModelWithModelResult" extends="AdminAiSceneModelResult">
- <association property="model" javaType="com.fs.company.domain.AdminAiModel">
- <id property="id" column="m_id"/>
- <result property="modelName" column="m_model_name"/>
- <result property="providerCode" column="m_provider_code"/>
- <result property="modelIdentifier" column="m_model_identifier"/>
- <result property="apiEndpoint" column="m_api_endpoint"/>
- <result property="apiKey" column="m_api_key"/>
- <result property="embeddingEndpoint" column="m_embedding_endpoint"/>
- <result property="maxTokens" column="m_max_tokens"/>
- <result property="temperature" column="m_temperature"/>
- <result property="sortOrder" column="m_sort_order"/>
- <result property="status" column="m_status"/>
- </association>
- </resultMap>
- <select id="selectBySceneCode" resultMap="AdminAiSceneModelWithModelResult">
- select sm.id, sm.scene_code, sm.model_id, sm.pipeline_order, sm.role, sm.sort_weight, sm.create_time,
- m.id as m_id, m.model_name as m_model_name, m.provider_code as m_provider_code,
- m.model_identifier as m_model_identifier, m.api_endpoint as m_api_endpoint,
- m.api_key as m_api_key, m.embedding_endpoint as m_embedding_endpoint,
- m.max_tokens as m_max_tokens, m.temperature as m_temperature,
- m.sort_order as m_sort_order, m.status as m_status
- from admin_ai_scene_model sm
- inner join admin_ai_model m on sm.model_id = m.id
- where sm.scene_code = #{sceneCode}
- order by sm.pipeline_order asc, sm.sort_weight asc
- </select>
- <select id="selectEnabledBySceneCode" resultMap="AdminAiSceneModelWithModelResult">
- select sm.id, sm.scene_code, sm.model_id, sm.pipeline_order, sm.role, sm.sort_weight, sm.create_time,
- m.id as m_id, m.model_name as m_model_name, m.provider_code as m_provider_code,
- m.model_identifier as m_model_identifier, m.api_endpoint as m_api_endpoint,
- m.api_key as m_api_key, m.embedding_endpoint as m_embedding_endpoint,
- m.max_tokens as m_max_tokens, m.temperature as m_temperature,
- m.sort_order as m_sort_order, m.status as m_status
- from admin_ai_scene_model sm
- inner join admin_ai_model m on sm.model_id = m.id
- where sm.scene_code = #{sceneCode} and m.status = 1
- order by sm.pipeline_order asc, sm.sort_weight asc
- </select>
- <select id="selectAll" resultMap="AdminAiSceneModelWithModelResult">
- select sm.id, sm.scene_code, sm.model_id, sm.pipeline_order, sm.role, sm.sort_weight, sm.create_time,
- m.id as m_id, m.model_name as m_model_name, m.provider_code as m_provider_code,
- m.model_identifier as m_model_identifier, m.api_endpoint as m_api_endpoint,
- m.api_key as m_api_key, m.embedding_endpoint as m_embedding_endpoint,
- m.max_tokens as m_max_tokens, m.temperature as m_temperature,
- m.sort_order as m_sort_order, m.status as m_status
- from admin_ai_scene_model sm
- inner join admin_ai_model m on sm.model_id = m.id
- order by sm.scene_code, sm.pipeline_order asc, sm.sort_weight asc
- </select>
- <insert id="insert" useGeneratedKeys="true" keyProperty="id">
- insert into admin_ai_scene_model (
- scene_code, model_id, pipeline_order, role, sort_weight, create_time
- ) values (
- #{sceneCode}, #{modelId}, #{pipelineOrder}, #{role}, #{sortWeight}, NOW()
- )
- </insert>
- <delete id="deleteById">
- delete from admin_ai_scene_model where id = #{id}
- </delete>
- <delete id="deleteBySceneCode">
- delete from admin_ai_scene_model where scene_code = #{sceneCode}
- </delete>
- <delete id="deleteBySceneAndModel">
- delete from admin_ai_scene_model where scene_code = #{sceneCode} and model_id = #{modelId}
- </delete>
- <update id="updateOrder">
- update admin_ai_scene_model
- set pipeline_order = #{pipelineOrder}, role = #{role}, sort_weight = #{sortWeight}
- where id = #{id}
- </update>
- </mapper>
|