yangys
2025-09-07 56f5157ae8dba22eb30fb6c7cb132f80b7161932
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?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="org.springblade.mdm.basesetting.producedivision.mapper.MdmUserMapper">
 
 
    <select id="selectByRoleIds" resultType="org.springblade.mdm.basesetting.producedivision.entity.MdmUser">
        SELECT id,account,name,real_name,role_id,dept_id FROM blade_user
        <where>
            is_deleted=0
            <if test="idList != null and idList.size() > 0">
                and (1=2 or
                <foreach collection="idList" item="item" separator=" OR ">
                    <bind name="pattern" value="'%' + item + '%'"/>
                    role_id like '%${item}%'
                </foreach>
                )
            </if>
            <!-- 如果列表为空,可以加一个永假条件避免全表扫描,例如:-->
            <if test="idList == null or idList.size() == 0">
                AND 1 = 0
            </if>
        </where>
    </select>
</mapper>