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

    <resultMap type="cn.ezhizao.project.system.domain.SysModule" id="SysModuleResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="SysModule" resultMap="SysModuleResult">
        SELECT * FROM sys_module
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="moduleName != null  and moduleName != ''"> AND module_name like concat('%', #{moduleName}, '%')</if>
            <if test="homePage != null  and homePage != ''"> AND home_page = #{homePage}</if>
            <if test="id != null">AND id = #{id}</if>
            <if test="ids != null and ids.size() > 0">
                AND id IN
                <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
                    #{item,jdbcType=BIGINT}
                </foreach>
            </if>
        </trim>
        order by sort
    </select>

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