wlzboy
5 天以前 7de1396e315896dbc72a9d54e44f77434ea90f18
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
<?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.ruoyi.system.mapper.DepartmentSyncMapper">
 
    <resultMap type="DepartmentSyncDTO" id="DepartmentSyncResult">
        <result property="departmentId" column="departmentID" />
        <result property="departmentName" column="departmentName" />
        <result property="parentId" column="parentID" />
        <result property="parentName" column="parentName" />
        
    </resultMap>
 
    <select id="selectDepartAddress" resultType="java.util.HashMap">
        <![CDATA[
            select 
                ServiceBranch,
                ServiceAddress,
                ServiceAddress_lat,
                ServiceAddress_lng,
                UnitName,
                UnitShort,
                ServiceMinPrice,
                ServiceUnitPrice,
                ServiceLong
            from IntroducerUnitData 
            where UnitState>0 and ServiceAddress_lat is not null and ServiceAddress_lng is not null and ServiceBranch<>''
        ]]>
    </select>
 
    <!-- 查询合作单位下的所有分公司 -->
    <select id="selectBranchDepartments" resultMap="DepartmentSyncResult">
        <![CDATA[
        SELECT 
            b.departmentID,
            b.departmentName,
            b.parentID,
            a.departmentName AS parentName
        FROM uv_department a 
        INNER JOIN uv_department b  ON a.departmentID = b.parentID 
        WHERE a.departmentName = N'合作单位'
        ORDER BY b.departmentName
        ]]>
    </select>
    
    <!-- 查询转运部下的所有子部门 -->
    <select id="selectTransportDepartments" resultMap="DepartmentSyncResult">
        <![CDATA[
        SELECT 
            b.departmentID,
            b.departmentName,
            b.parentID,
            a.departmentName AS parentName
        FROM uv_department a 
        INNER JOIN uv_department b  ON a.departmentID = b.parentID 
        WHERE a.departmentName = N'转运部'
        ORDER BY b.departmentName
        ]]>
    </select>
 
</mapper>