<?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.zxdmy.excite.system.mapper.cloud.account.CloudDepartmentUserMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.zxdmy.excite.system.entity.cloud.account.CloudDepartmentUser">
        <id column="id" property="id" />
        <result column="department_id" property="departmentId" />
        <result column="user_id" property="userId" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, department_id, user_id
    </sql>

    <select id="selectByCompanyId" resultType="com.zxdmy.excite.system.entity.cloud.account.CloudDepartmentUser" >
        SELECT du.* FROM cloud_department_user du
            INNER JOIN cloud_department d ON du.department_id = d.id
            WHERE d.company_id = #{companyId} AND d.delete_time IS NULL
    </select>

</mapper>
