<?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.predict.mapper.PstatModelMapper">

    <resultMap type="PstatModel" id="PstatModelResult">
        <result property="pstatNo" column="pstat_no"/>
        <result property="pstatName" column="pstat_name"/>
        <result property="pstatType" column="pstat_type"/>
        <result property="dllName" column="dll_name"/>
        <result property="processTag" column="process_tag"/>
        <result property="relatedParaTable" column="related_para_table"/>
    </resultMap>

    <sql id="selectPstatModelVo">
        select pstat_no, pstat_name, pstat_type, dll_name, process_tag, related_para_table from pstat_model
    </sql>

    <select id="selectPstatModelList" parameterType="PstatModel" resultMap="PstatModelResult">
        select
        pm.*,
        emi.item_name as "processTagName"
        from
        pstat_model pm
        left join enum_menu_item emi on emi.item_val = pm.process_tag and emi.menu_no = 121
        <where>
            <if test="pstatNo != null ">and pm.pstat_no = #{pstatNo}</if>
            <if test="pstatName != null  and pstatName != ''">and pm.pstat_name like concat(concat('%', #{pstatName}),
                '%')
            </if>
            <if test="pstatType != null ">and pm.pstat_type = #{pstatType}</if>
            <if test="dllName != null  and dllName != ''">and pm.dll_name like concat(concat('%', #{dllName}), '%')</if>
            <if test="processTag != null ">and pm.process_tag = #{processTag}</if>
            <if test="relatedParaTable != null ">and pm.related_para_table = #{relatedParaTable}</if>
        </where>
    </select>

    <select id="selectPstatModelById" parameterType="Long" resultMap="PstatModelResult">
        <include refid="selectPstatModelVo"/>
        where pstat_no = #{pstatNo}
    </select>

</mapper>