<?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.house365.ws.dao.mapper.DepartMapper">

    <resultMap id="infoMap" type="com.house365.beans.entity.DepartmentEntity">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="urlPath" column="urlPath"/>
        <result property="type" column="type"/>
        <result property="parentId" column="parentId"/>
        <result property="orderNum" column="orderNum"/>
        <result property="root" column="root"/>
        <result property="hierarchy" column="hierarchy"/>
        <result property="descripition" column="descripition"/>
        <result property="createTime" column="createTime"/>
        <result property="updateTime" column="updateTime"/>
    </resultMap>

    <select id="queryById" resultMap="infoMap" parameterType="int">
        SELECT
         *
	    FROM department
	    WHERE
		   id = #{id}
    </select>

    <select id="queryByConditions" resultMap="infoMap" parameterType="map">
        SELECT *
        FROM department
        where 1 = 1
        <if test="descripition != null and descripition != ''">
            AND descripition = #{descripition}
        </if>
        <if test="name != null and name != ''">
            AND name = #{name}
        </if>
    </select>

</mapper>