<?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="cn.ezhizao.project.system.mapper.SysVersionMenuMapper">

    <resultMap type="cn.ezhizao.project.system.domain.SysVersionMenu" id="SysVersionMenuResult">
        <id column="id" property="id"/>
        <association property="perms" column="menu_id" javaType="java.lang.String" select="getPerms" />
    </resultMap>

    <select id="getPerms" resultType="java.lang.String">
        select perms from sys_menu where menu_id = #{menu_id}
    </select>

    <select id="getList" parameterType="SysVersionMenu" resultMap="SysVersionMenuResult">
        SELECT * FROM sys_version_menu
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
        </trim>
    </select>

    <delete id="physicalDelete">
        DELETE FROM sys_version_menu
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            <if test="id != null">
                id = #{id} AND
            </if>
            <if test="moduleId != null">
                module_id = #{moduleId} AND
            </if>
            <if test="versionId != null">
                version_id = #{versionId} AND
            </if>
       <!-- 删除条件为其他外键可以在这里加 -->
        </trim>
    </delete>
</mapper>
