<?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">
<!--  Copyright (c) 京北方信息技术股份有限公司 Corporation 2023 . All rights reserved. -->
<!--  Mybatis数据库持久层（业务层映射文件）：数据集环境关联表 -->
<!--  version: 1.0  -->
<!--  author:  maven-cctp-plugin    -->
<!--  date:  2023-08-23 17:53:02  -->
<mapper namespace="net.northking.cctp.dataPool.db.dao.DataSetEnvRelDao">


  <select id="selectDataUrlAndTreeName" resultType="net.northking.cctp.dataPool.dto.dataSets.AtuScriptInputSetQuoteFieldDto" parameterType="net.northking.cctp.dataPool.dto.dataSets.AtuScriptInputSetQuoteFieldDto">
    select
    dst.full_name fullName,
    ds.name name,
    dse.file_addr path
    from
    <include refid="Table_Name"/> dse
    inner join data_sets ds on dse.data_set_id=ds.data_set_id
    inner join data_set_tree dst on ds.tree_id=dst.id
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="setId != null">
        AND dse.data_set_id = #{setId,jdbcType=VARCHAR}
      </if>
      <if test="envId != null">
        AND dse.env_id = #{envId,jdbcType=VARCHAR}
      </if>
    </trim>
  </select>

  <select id="getDataSetFile" resultType="net.northking.cctp.dataPool.dto.dataSets.AtuScriptInputSetQuoteFeignDto">
    select
    dse.data_set_id as setId,
    dst.full_name as fullName,
    ds.name as name,
    dse.file_addr as filePath
    from
    <include refid="Table_Name"/> dse
    inner join data_sets ds on dse.data_set_id=ds.data_set_id
    inner join data_set_tree dst on ds.tree_id=dst.id
    where dse.data_set_id in
    <foreach collection="list" item="idItem" open="(" separator="," close=")">
      #{idItem, jdbcType=VARCHAR}
    </foreach>
    and dse.env_id = #{envId,jdbcType=VARCHAR}
  </select>
</mapper>