<?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.zcloud.basic.info.persistence.mapper.sync.SyncDepartmentMapper">
    <select id="listPageSyncDepartment" resultType="com.zcloud.basic.info.persistence.dataobject.sync.SyncDepartmentDO">
        select
            d.id,
            d.name,
            d.parent_id
        from department d
        <where>
            and d.delete_enum = 'FALSE'
            and d.corpinfo_id = #{params.corpinfoId}
            <if test="params.name != null and params.name != ''">
                and d.name like concat('%',#{params.name},'%')
            </if>
            <if test="params.parentId != null">
                and d.parent_id = #{params.parentId}
            </if>

        </where>
        order by d.parent_id,d.id
    </select>

</mapper>

