<?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="parCate"    column="PAR_CATE"    />
        <result property="parGroup"    column="PAR_GROUP"    />
        <result property="parName"    column="PAR_NAME"    />
        <result property="parEnname"    column="PAR_ENNAME"    />
        <result property="parNote"    column="PAR_NOTE"    />
        <result property="parType"    column="PAR_TYPE"    />
        <result property="parLine"    column="PAR_LINE"    />
        <result property="parDimen"    column="PAR_DIMEN"    />
        <result property="parDidenSort"    column="PAR_DIDEN_SORT"    />
        <result property="parExpr"    column="PAR_EXPR"    />
        <result property="parDefVal"    column="PAR_DEF_VAL"    />
        <result property="parUnit"    column="PAR_UNIT"    />
        <result property="parRange"    column="PAR_RANGE"    />
        <result property="parVersion"    column="PAR_VERSION"    />
        <result property="parStatus"    column="PAR_STATUS"    />
        <result property="createby"    column="CREATEBY"    />
        <result property="modifyby"    column="MODIFYBY"    />
    </resultMap>

    <sql id="selectMdModelParamsVo">
        select PARID, MDID, PAR_CATE, PAR_GROUP, PAR_NAME, PAR_ENNAME, PAR_NOTE, PAR_TYPE, PAR_LINE, PAR_DIMEN, PAR_DIDEN_SORT, PAR_EXPR, PAR_DEF_VAL, PAR_UNIT, PAR_RANGE, PAR_VERSION, PAR_STATUS, CREATEBY, MODIFYBY from md_model_params
    </sql>

    <select id="selectMdModelParamsList" parameterType="com.ruoyi.interfaces.domain.MdModelParams" resultMap="MdModelParamsResult">
        <include refid="selectMdModelParamsVo"/>
        <where>
            <if test="mdid != null  and mdid != ''"> and MDID = #{mdid}</if>
            <if test="parCate != null  and parCate != ''"> and PAR_CATE = #{parCate}</if>
            <if test="parGroup != null  and parGroup != ''"> and PAR_GROUP = #{parGroup}</if>
            <if test="parName != null  and parName != ''"> and PAR_NAME like concat('%', #{parName}, '%')</if>
            <if test="parEnname != null  and parEnname != ''"> and PAR_ENNAME like concat('%', #{parEnname}, '%')</if>
            <if test="parNote != null  and parNote != ''"> and PAR_NOTE = #{parNote}</if>
            <if test="parType != null  and parType != ''"> and PAR_TYPE = #{parType}</if>
            <if test="parLine != null "> and PAR_LINE = #{parLine}</if>
            <if test="parDimen != null  and parDimen != ''"> and PAR_DIMEN = #{parDimen}</if>
            <if test="parDidenSort != null  and parDidenSort != ''"> and PAR_DIDEN_SORT = #{parDidenSort}</if>
            <if test="parExpr != null  and parExpr != ''"> and PAR_EXPR = #{parExpr}</if>
            <if test="parDefVal != null  and parDefVal != ''"> and PAR_DEF_VAL = #{parDefVal}</if>
            <if test="parUnit != null  and parUnit != ''"> and PAR_UNIT = #{parUnit}</if>
            <if test="parRange != null  and parRange != ''"> and PAR_RANGE = #{parRange}</if>
            <if test="parVersion != null  and parVersion != ''"> and PAR_VERSION = #{parVersion}</if>
            <if test="parStatus != null  and parStatus != ''"> and PAR_STATUS = #{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="parCate != null and parCate != ''">PAR_CATE,</if>
            <if test="parGroup != null and parGroup != ''">PAR_GROUP,</if>
            <if test="parName != null and parName != ''">PAR_NAME,</if>
            <if test="parEnname != null and parEnname != ''">PAR_ENNAME,</if>
            <if test="parNote != null">PAR_NOTE,</if>
            <if test="parType != null">PAR_TYPE,</if>
            <if test="parLine != null">PAR_LINE,</if>
            <if test="parDimen != null">PAR_DIMEN,</if>
            <if test="parDidenSort != null">PAR_DIDEN_SORT,</if>
            <if test="parExpr != null">PAR_EXPR,</if>
            <if test="parDefVal != null">PAR_DEF_VAL,</if>
            <if test="parUnit != null">PAR_UNIT,</if>
            <if test="parRange != null">PAR_RANGE,</if>
            <if test="parVersion != null">PAR_VERSION,</if>
            <if test="parStatus != null">PAR_STATUS,</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="parCate != null and parCate != ''">#{parCate},</if>
            <if test="parGroup != null and parGroup != ''">#{parGroup},</if>
            <if test="parName != null and parName != ''">#{parName},</if>
            <if test="parEnname != null and parEnname != ''">#{parEnname},</if>
            <if test="parNote != null">#{parNote},</if>
            <if test="parType != null">#{parType},</if>
            <if test="parLine != null">#{parLine},</if>
            <if test="parDimen != null">#{parDimen},</if>
            <if test="parDidenSort != null">#{parDidenSort},</if>
            <if test="parExpr != null">#{parExpr},</if>
            <if test="parDefVal != null">#{parDefVal},</if>
            <if test="parUnit != null">#{parUnit},</if>
            <if test="parRange != null">#{parRange},</if>
            <if test="parVersion != null">#{parVersion},</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="parCate != null and parCate != ''">PAR_CATE = #{parCate},</if>
            <if test="parGroup != null and parGroup != ''">PAR_GROUP = #{parGroup},</if>
            <if test="parName != null and parName != ''">PAR_NAME = #{parName},</if>
            <if test="parEnname != null and parEnname != ''">PAR_ENNAME = #{parEnname},</if>
            <if test="parNote != null">PAR_NOTE = #{parNote},</if>
            <if test="parType != null">PAR_TYPE = #{parType},</if>
            <if test="parLine != null">PAR_LINE = #{parLine},</if>
            <if test="parDimen != null">PAR_DIMEN = #{parDimen},</if>
            <if test="parDidenSort != null">PAR_DIDEN_SORT = #{parDidenSort},</if>
            <if test="parExpr != null">PAR_EXPR = #{parExpr},</if>
            <if test="parDefVal != null">PAR_DEF_VAL = #{parDefVal},</if>
            <if test="parUnit != null">PAR_UNIT = #{parUnit},</if>
            <if test="parRange != null">PAR_RANGE = #{parRange},</if>
            <if test="parVersion != null">PAR_VERSION = #{parVersion},</if>
            <if test="parStatus != null">PAR_STATUS = #{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>
    <delete id="deleteMdModelParamsByMdid">
        delete from md_model_params where MDID = #{mdid}
    </delete>
</mapper>