<?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.ruoyi.project.business.mapper.TpParaRelatedActionMapper">

    <resultMap type="TpParaRelatedAction" id="TpParaRelatedActionResult">
        <result property="id" column="id"/>
        <result property="caseId" column="case_id"/>
        <result property="paraCode" column="para_code"/>
        <result property="computedFlag" column="computed_flag"/>
        <result property="value" column="value"/>
        <result property="selectItem" column="select_item"/>
        <result property="editable" column="editable"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createTime" column="create_time"/>
        <result property="createBy" column="create_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="remark" column="remark"/>
    </resultMap>

    <sql id="selectTpParaRelatedActionVo">
        select id,
               case_id,
               para_code,
               computed_flag,
               value,
               select_item,
               editable,
               del_flag,
               create_time,
               create_by,
               update_time,
               update_by,
               remark
        from tp_para_related_action
    </sql>

    <resultMap id="TpParaRelatedActionDtoResult" type="com.ruoyi.project.business.dto.TpParaRelatedActionDto"
               extends="TpParaRelatedActionResult">
        <result property="paraName" column="para_name"/>
        <result property="paraNameUS" column="para_nameUS"/>
        <result property="paraNameRU" column="para_nameRU"/>
        <result property="paraNameES" column="para_nameES"/>
        <result property="label" column="label"/>
        <result property="labelUS" column="labelUS"/>
        <result property="labelRU" column="labelRU"/>
        <result property="labelES" column="labelES"/>
        <result property="inputType" column="input_type"/>

    </resultMap>


    <select id="queryMoreInfo" parameterType="long" resultMap="TpParaRelatedActionDtoResult">
        SELECT case_id,
        tpl.id as para_id,
        tpra.id,
        tpra.para_code,
        select_item,
        editable,
        tpra.`VALUE`,
        tpra.`computed_flag`,
        tpl.input_type,
        tpl.para_name,
        tpl.para_nameES,
        tpl.para_nameRU,
        tpl.para_nameUS,
        tpsi.label,
        tpsi.labelES,
        tpsi.labelRU,
        tpsi.labelUS
        FROM tp_para_related_action tpra
        INNER JOIN tp_para_library tpl on tpl.para_code = tpra.para_code
        left JOIN tp_para_select_item tpsi on tpsi.para_id = tpl.id and tpsi.`value` = tpra.`value`
        where tpra.del_flag='0' and case_id in
        <foreach collection="caseIds" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>


    </select>


</mapper>