<?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.MdModelAclMapper">

    <resultMap type="com.ruoyi.interfaces.domain.MdModelAcl" id="MdModelAclResult">
        <result property="aclid"    column="aclid"    />
        <result property="mdid"    column="mdid"    />
        <result property="permission"    column="permission"    />
        <result property="userid"    column="userid"    />
    </resultMap>

    <sql id="selectMdModelAclVo">
        select aclid, mdid, permission, userid from md_model_acl
    </sql>

    <select id="selectMdModelAclList" parameterType="com.ruoyi.interfaces.domain.MdModelAcl" resultMap="MdModelAclResult">
        <include refid="selectMdModelAclVo"/>
        <where>
            <if test="permission != null  and permission != ''"> and permission = #{permission}</if>
            <if test="userid != null  and userid != ''"> and userid = #{userid}</if>
        </where>
    </select>

    <select id="selectMdModelAclByAclid" parameterType="String" resultMap="MdModelAclResult">
        <include refid="selectMdModelAclVo"/>
        where aclid = #{aclid}
    </select>

    <insert id="insertMdModelAcl" parameterType="com.ruoyi.interfaces.domain.MdModelAcl">
        insert into md_model_acl
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="aclid != null">aclid,</if>
            <if test="mdid != null">mdid,</if>
            <if test="permission != null">permission,</if>
            <if test="userid != null">userid,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="aclid != null">#{aclid},</if>
            <if test="mdid != null">#{mdid},</if>
            <if test="permission != null">#{permission},</if>
            <if test="userid != null">#{userid},</if>
        </trim>
    </insert>

    <update id="updateMdModelAcl" parameterType="com.ruoyi.interfaces.domain.MdModelAcl">
        update md_model_acl
        <trim prefix="SET" suffixOverrides=",">
            <if test="mdid != null">mdid = #{mdid},</if>
            <if test="permission != null">permission = #{permission},</if>
            <if test="userid != null">userid = #{userid},</if>
        </trim>
        where aclid = #{aclid}
    </update>

    <delete id="deleteMdModelAclByAclid" parameterType="String">
        delete from md_model_acl where aclid = #{aclid}
    </delete>

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