<?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.domain.persistence.mapper.DomainDepartmentUserMapper">
    <select id="getListByDomainDepartmentId" resultType="com.zcloud.domain.persistence.dataobject.DomainDepartmentUserDO">
        select ddu.*, d.name as departmentname, u.name as username,c.corp_name as corpinfoName,c.id as corpinfoId
        from domain_department_user ddu
                 left join department d on ddu.department_id = d.id
                 left join corp_info c on d.corpinfo_id = c.id
                 left join user u on ddu.user_id = u.id
        where ddu.delete_enum = 'false'
          and ddu.domain_department_id = #{domainDepartmentId}
        order by ddu.create_time desc
    </select>

    <select id="listPage" resultType="com.zcloud.domain.persistence.dataobject.DomainDepartmentUserDO">
        select ddu.*, d.name as departmentname, u.name as username,c.corp_name as corpinfoName,c.id as corpinfoId
        from domain_department_user ddu
                 left join department d on ddu.department_id = d.id
                 left join corp_info c on d.corpinfo_id = c.id
                 left join user u on ddu.user_id = u.id
        where ddu.delete_enum = 'false'
          and ddu.domain_department_id = #{params.domainDepartmentId}
        order by ddu.create_time desc
    </select>
</mapper>

