wzy
2022-08-14 b141df9bf9764db8567efebed48006e12ab1f657
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?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.xzx.gc.role.mapper.CoreOrgMapper">
    <select id="queryAllOrgCode" parameterType="java.util.List" resultType="java.lang.String">
        select code from core_org where id in
        <foreach collection="orgIds" index="index" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>
    <select id="getRoot" resultType="com.xzx.gc.entity.CoreOrg">
        select *
        from core_org
        where parent_org_id is null
    </select>
    <select id="queryOrgByUser" resultType="com.xzx.gc.entity.CoreOrg">
        select *
        from core_org
        where id in
              (select org_id
               from core_user_role
               where user_id = #{userId}
               group by org_id) and del_flag = 0
        order by id desc
    </select>
    <select id="queryByCondtion" resultType="com.xzx.gc.entity.CoreOrg">
        select
        o.*
        from core_org o where 1=1 and del_flag = 0
        <if test="code != null and code != ''">
            and  o.code like concat("%",#{code},"%")
        </if>
        <if test="name != null and name != ''">
            and  o.name like concat("%",#{name},"%")
        </if>
        <if test="type != null and type != ''">
            and  o.name like concat("%",#{type},"%")
        </if>
        <if test="parentOrgId != null and parentOrgId != ''">
            and  o.parent_org_id = concat("%",#{parentOrgId},"%")
        </if>
    </select>
</mapper>