<?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.interfaces.mapper.MdModelParamsMapper">

    <resultMap type="com.ruoyi.interfaces.domain.MdModelParams" id="MdModelParamsResult">
        <result property="parId"    column="parId"    />
        <result property="mdid"    column="mdid"    />
        <result property="parName"    column="parName"    />
        <result property="parType"    column="parType"    />
        <result property="parDataType"    column="parDataType"    />
        <result property="parDataRange"    column="parDataRange"    />
        <result property="parDataUnit"    column="parDataUnit"    />
        <result property="parDataWeight"    column="parDataWeight"    />
        <result property="parFilePath"    column="parFilePath"    />
        <result property="parFileName"    column="parFileName"    />
        <result property="parStatus"    column="parStatus"    />
        <result property="createBy"    column="createBy"    />
        <result property="modifyBy"    column="modifyBy"    />
    </resultMap>

    <sql id="selectMdModelParamsVo">
        select parId, mdid, parName, parType, parDataType, parDataRange, parDataUnit, parDataWeight, parFilePath, parFileName, parStatus, createBy, modifyBy from md_model_params
    </sql>

    <select id="selectMdModelParamsList" parameterType="com.ruoyi.interfaces.domain.MdModelParams" resultMap="MdModelParamsResult">
        <include refid="selectMdModelParamsVo"/>
        <where>
            <if test="parName != null  and parName != ''"> and parName like concat('%', #{parName}, '%')</if>
            <if test="parType != null  and parType != ''"> and parType = #{parType}</if>
            <if test="parDataType != null  and parDataType != ''"> and parDataType = #{parDataType}</if>
            <if test="parDataRange != null  and parDataRange != ''"> and parDataRange = #{parDataRange}</if>
            <if test="parDataUnit != null  and parDataUnit != ''"> and parDataUnit = #{parDataUnit}</if>
            <if test="parDataWeight != null  and parDataWeight != ''"> and parDataWeight = #{parDataWeight}</if>
            <if test="parFilePath != null  and parFilePath != ''"> and parFilePath = #{parFilePath}</if>
            <if test="parFileName != null  and parFileName != ''"> and parFileName like concat('%', #{parFileName}, '%')</if>
            <if test="parStatus != null  and parStatus != ''"> and parStatus = #{parStatus}</if>
            <if test="createBy != null "> and createBy = #{createBy}</if>
            <if test="modifyBy != null "> and modifyBy = #{modifyBy}</if>
        </where>
    </select>

    <select id="selectMdModelParamsByParId" parameterType="String" resultMap="MdModelParamsResult">
        <include refid="selectMdModelParamsVo"/>
        where parId = #{parId}
    </select>

    <insert id="insertMdModelParams" parameterType="com.ruoyi.interfaces.domain.MdModelParams">
        insert into md_model_params
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="parId != null">parId,</if>
            <if test="mdid != null">mdid,</if>
            <if test="parName != null">parName,</if>
            <if test="parType != null">parType,</if>
            <if test="parDataType != null">parDataType,</if>
            <if test="parDataRange != null">parDataRange,</if>
            <if test="parDataUnit != null">parDataUnit,</if>
            <if test="parDataWeight != null">parDataWeight,</if>
            <if test="parFilePath != null">parFilePath,</if>
            <if test="parFileName != null">parFileName,</if>
            <if test="parStatus != null">parStatus,</if>
            <if test="createBy != null">createBy,</if>
            <if test="modifyBy != null">modifyBy,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="parId != null">#{parId},</if>
            <if test="mdid != null">#{mdid},</if>
            <if test="parName != null">#{parName},</if>
            <if test="parType != null">#{parType},</if>
            <if test="parDataType != null">#{parDataType},</if>
            <if test="parDataRange != null">#{parDataRange},</if>
            <if test="parDataUnit != null">#{parDataUnit},</if>
            <if test="parDataWeight != null">#{parDataWeight},</if>
            <if test="parFilePath != null">#{parFilePath},</if>
            <if test="parFileName != null">#{parFileName},</if>
            <if test="parStatus != null">#{parStatus},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="modifyBy != null">#{modifyBy},</if>
        </trim>
    </insert>

    <update id="updateMdModelParams" parameterType="com.ruoyi.interfaces.domain.MdModelParams">
        update md_model_params
        <trim prefix="SET" suffixOverrides=",">
            <if test="mdid != null">mdid = #{mdid},</if>
            <if test="parName != null">parName = #{parName},</if>
            <if test="parType != null">parType = #{parType},</if>
            <if test="parDataType != null">parDataType = #{parDataType},</if>
            <if test="parDataRange != null">parDataRange = #{parDataRange},</if>
            <if test="parDataUnit != null">parDataUnit = #{parDataUnit},</if>
            <if test="parDataWeight != null">parDataWeight = #{parDataWeight},</if>
            <if test="parFilePath != null">parFilePath = #{parFilePath},</if>
            <if test="parFileName != null">parFileName = #{parFileName},</if>
            <if test="parStatus != null">parStatus = #{parStatus},</if>
            <if test="createBy != null">createBy = #{createBy},</if>
            <if test="modifyBy != null">modifyBy = #{modifyBy},</if>
        </trim>
        where parId = #{parId}
    </update>

    <delete id="deleteMdModelParamsByParId" parameterType="String">
        delete from md_model_params where parId = #{parId}
    </delete>

    <delete id="deleteMdModelParamsByParIds" parameterType="String">
        delete from md_model_params where parId in
        <foreach item="parId" collection="array" open="(" separator="," close=")">
            #{parId}
        </foreach>
    </delete>
</mapper>