jar
jinlin
2025-03-10 f0aae4b39afbcbb18fb5a0b32e3ca689662c5ca7
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<?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.example.server.teamGroup.dao.SysTeamGroupClassDao">
 
    <select id="getAll" resultType="com.example.server.teamGroup.model.SysTeamGroupClass">
        SELECT
        a.*
        FROM
        DJ_SYS_TEAMGROUP_CLASS a
        WHERE
        a.is_delete = 0
        <if test="localArea!=null and (localArea=='sy' or localArea=='qd' or localArea=='hld')">
            and a.area=#{localArea}
        </if>
        ORDER BY
        a.area desc, a.sort
    </select>
 
    <select id="getMapAll" resultType="com.example.client.entity.MapData">
        SELECT
        a.id,a.name
        FROM
        DJ_SYS_TEAMGROUP_CLASS a
        WHERE
        a.is_delete = 0
        <if test="localArea!=null and (localArea=='sy' or localArea=='qd')">
            and a.area=#{localArea}
        </if>
        ORDER BY
        a.area desc, a.sort
    </select>
    <select id="getAllByCriteria" resultType="com.example.server.teamGroup.model.SysTeamGroupClass">
        SELECT
        a.*,c.name AS productName
        from
        DJ_SYS_TEAMGROUP_CLASS a
        left join view_zt_boat_tree c on concat(a.product_id) = c.product_id
        WHERE
        a.is_delete = 0
        <if test="dictType!=null and dictType!=''">
            and a.dict_type=#{dictType}
        </if>
        <if test="model!=null and model!=''">
            and a.product_id=#{model}
        </if>
        <if test="localArea!=null and (localArea=='sy' or localArea=='qd')">
            and a.area=#{localArea}
        </if>
        ORDER BY
        a.area desc, a.sort
    </select>
 
    <select id="getTeamGroupIdByNames" resultType="java.lang.Long">
        SELECT a.id FROM DJ_SYS_TEAMGROUP_CLASS a WHERE a.is_delete=0 AND a.name IN
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
        <if test="localArea!=null and (localArea=='sy' or localArea=='qd')">
            and a.area=#{localArea}
        </if>
    </select>
 
    <select id="getTeamGroupIdByName" resultType="java.lang.Long">
        SELECT a.id FROM DJ_SYS_TEAMGROUP_CLASS a WHERE a.is_delete=0 AND a.name = #{name}
        <if test="localArea!=null and (localArea=='sy' or localArea=='qd')">
            and a.area=#{localArea}
        </if>
    </select>
    <select id="getBzTeamGroupIdByName" resultType="java.lang.Long">
        SELECT a.id FROM DJ_SYS_TEAMGROUP_CLASS a WHERE a.is_delete=0 AND a.name = #{name}
        <if test="localArea!=null and (localArea=='sy' or localArea=='qd')">
            and a.area=#{localArea}
        </if>
    </select>
 
    <select id="getTeamGroupClassList" resultType="com.example.server.teamGroup.model.SysTeamGroupClass">
        SELECT a.id,
               a.name
        FROM DJ_SYS_TEAMGROUP_CLASS a
        WHERE a.is_delete = 0
          and area = 'sy'
          and pid != 0
        order by sort
    </select>
    <select id="getList" resultType="com.example.client.dto.JComboBoxItem">
        SELECT a.id,
               CASE
                   WHEN a.pid != 0 THEN b.name || '/' || a.name
                   ELSE a.name
                   END AS name
        FROM DJ_SYS_TEAMGROUP_CLASS a
                 LEFT JOIN
             DJ_SYS_TEAMGROUP_CLASS b ON a.pid = b.id
        WHERE a.is_delete = 0
          AND a.pid != 0
        ORDER BY a.sort;
    </select>
    <select id="getTeamList" resultType="com.example.client.dto.JComboBoxItem">
        SELECT
        a.id,
        a.name,
        a.sort
        FROM
        DJ_SYS_TEAMGROUP_CLASS a
        WHERE
        a.is_delete = 0
        AND a.pid != 0
        <if test="pid!=null">
            AND a.pid = ${pid}
        </if>
        UNION ALL
        SELECT
        null AS id,
        '' AS name ,
        0 AS sort
        ORDER BY
        sort;
    </select>
    <select id="getDeptList" resultType="com.example.client.dto.JComboBoxItem">
        SELECT a.id,
               a.name,
               a.sort
        FROM DJ_SYS_TEAMGROUP_CLASS a
        WHERE a.is_delete = 0
          AND a.pid = 0
        UNION ALL
        SELECT null AS id,
               ''   AS name,
               0    AS sort
        ORDER BY sort
    </select>
    <select id="getListByTree" resultType="com.example.server.teamGroup.model.SysTeamGroupClass">
        SELECT a.id,
               a.pid,
               CASE
                   WHEN a.pid = 0 THEN
                       a.NAME
                   ELSE '    ' || a.NAME
                   END AS name,
               CASE
                   WHEN a.pid = 0 THEN
                       '部门'
                   ELSE '专业'
                   END AS type,
               CASE
 
                   WHEN a.pid = 0 THEN
                       '' || a.id
                   ELSE '' || a.pid || a.SORT
                   END AS sort2
        FROM dj_sys_teamgroup_class a
        WHERE a.AREA = 'hld'
          AND a.IS_DELETE = 0
        ORDER BY sort2
    </select>
    <select id="getSortMax" resultType="java.lang.Integer">
        select max(sort)
        FROM dj_sys_teamgroup_class
        WHERE AREA = 'hld'
          AND IS_DELETE = 0
          and pid = ${pid}
    </select>
</mapper>