<?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.DomainGroupUserMapper">
    <select id="getListByGroupId" resultType="com.zcloud.domain.persistence.dataobject.DomainGroupUserDO">
        select dgu.*, d.name as departmentname, u.name as username
        from domain_group_user dgu
                 left join department d on dgu.department_id = d.id and d.delete_enum = 'false'
                 left join user u on dgu.user_id = u.id and u.delete_enum = 'false'
        where dgu.delete_enum = 'false'
          and dgu.domain_group_id = #{domainGroupId}
        group by dgu.id
        order by dgu.create_time desc
    </select>

    <select id="listPage" resultType="com.zcloud.domain.persistence.dataobject.DomainGroupUserDO">
        select dgu.*, d.name as departmentname, u.name as username
        from domain_group_user dgu
                 left join department d on dgu.department_id = d.id and d.delete_enum = 'false'
                 left join user u on dgu.user_id = u.id and u.delete_enum = 'false'
        where dgu.delete_enum = 'false'
          and dgu.domain_group_id = #{params.domainGroupId}
        group by dgu.id
        order by dgu.create_time desc
    </select>
</mapper>

