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

    <resultMap type="cn.ezhizao.project.system.domain.SysVersion" id="SysVersionResult">
        <id column="id" property="id"/>
<!--        <association property="moduleName" column="module_id" javaType="java.lang.String" select="getModuleName" />-->
<!--        <association property="moduleRemark" column="module_id" javaType="java.lang.String" select="getModuleRemark" />-->
    </resultMap>


    <select id="getList" parameterType="SysVersion" resultMap="SysVersionResult">
        SELECT * FROM sys_version
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="name != null  and name != ''"> AND name like concat('%', #{name}, '%')</if>
            <if test="remark != null  and remark != ''"> AND remark like concat('%', #{remark}, '%')</if>
        </trim>
    </select>

<!--    <select id="getById" parameterType="SysVersionMenu" resultMap="SysVersionResult">-->
<!--        SELECT * FROM sys_version-->
<!--        WHERE deleted = 0-->
<!--          AND id = #{id}-->
<!--    </select>-->

    <select id="getModuleName" resultType="java.lang.String">
        select remark from sys_module where id = #{module_id}
    </select>

    <select id="getModuleRemark" resultType="java.lang.String">
        select module_name from sys_module where id = #{module_id}
    </select>


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