cjl
2024-06-17 34d9307df9870510f9204659ddf9f5389012cd4d
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
<?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.moral.api.mapper.ResponsibilityUnitMapper">
 
 
    <select id="selectResultList" resultType="java.lang.Integer">
        select c.unit_id
        from responsibility_unit c where c.area_code in (
 
            SELECT area_code from sys_area where area_code = (select area_code from responsibility_unit where unit_id = #{id})
            union
            SELECT
                area_code
            FROM
                (
                    SELECT
                        t1.area_code,t1.area_name,
                        IF(FIND_IN_SET(parent_code,@pids), @pids := concat(@pids, ',', area_code), 0) as ischild
                    FROM
                        (
                            SELECT
                                area_code, parent_code, area_name
                            FROM
                                sys_area
                            ORDER BY area_code
                        )t1,
                        (SELECT @pids := (select area_code from responsibility_unit where unit_id = #{id})  ) t2
                )t3 where ischild != 0
 
    )
    </select>
 
    <select id="selectCodeList" resultType="java.lang.Integer">
        select t.id from sys_dict_type t
        left join sys_dict_data t1 on t1.dict_type_id = t.id
 
        where t.is_delete = 0 and t.name = #{code} and t1.dataKey = #{id} and t1.is_delete = 0
 
 
    </select>
    <select id="selectAreaCode" resultType="java.lang.String">
        select area_code from responsibility_unit t where unit_id = #{id}
    </select>
 
    <select id="selectResponsibilityUnitList" resultType="com.moral.api.pojo.ext.responsibility.ResponsibilityUnitExt">
        select area_code,parent_code from responsibility_unit t where unit_id = #{id}
    </select>
 
    <select id="selectName" resultType="java.lang.String">
        select t1.dataValue from sys_dict_type t
                             left join sys_dict_data t1 on t1.dict_type_id = t.id
 
        where t.is_delete = 0 and t.name = #{code} and t1.dataKey = #{id} and t1.is_delete = 0
 
 
    </select>
 
</mapper>