<?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="cn.cordys.crm.system.mapper.ExtUserExtendMapper">

    <delete id="deleteUser">
        DELETE FROM sys_user_extend WHERE id in
        <foreach collection="ids" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <select id="groupByScopeIds" resultType="cn.cordys.crm.system.dto.ScopeNameDTO">
        select id, name, 'DEPARTMENT' as scope from sys_department where id in
        <foreach collection="ids" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
        union all
        select id, name, 'ROLE' as scope from sys_role where id in
        <foreach collection="ids" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
        union all
        select id, name, 'USER' as scope from sys_user where id in
        <foreach collection="ids" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>
</mapper>