双重预防项目-国泰新华二开定制版
heheng
2025-06-24 e98eeaaa5766511fdb8e6d5e412eb1c59d1f07ce
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
<?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.project.tr.dataStatistics.mapper.DataStatisticsMapper">
    <resultMap type="DataStatistics" id="companyMap">
        <id property="companyId" column="company_id"/>
        <result property="companyName" column="company_name"/>
        <result property="companyRegion" column="company_region"/>
        <result property="companyIndustry" column="company_industry"/>
        <result property="companySubIndustry" column="company_sub_industry"/>
        <collection property="dangers" ofType="DangerData" resultMap="dangers"/>
        <collection property="risks" ofType="RiskData" resultMap="risks"/>
    </resultMap>
 
    <resultMap id="dangers" type="DangerData">
        <id property="checkId" column="check_id"></id>
        <result property="dangerLevel" column="danger_level"/>
        <result property="createTime" column="create_time"/>
        <result property="rectifyStatus" column="rectify_status"/>
        <result property="whetherDanger" column="whether_danger"/>
    </resultMap>
 
    <resultMap id="risks" type="RiskData">
        <id property="checkPointId" column="check_point_id"></id>
        <result property="riskColor" column="risk_color"/>
        <result property="reviewStatus" column="review_status"/>
    </resultMap>
 
    <select id="selectCompanyDangers" parameterType="DataStatistics" resultMap="companyMap">
        SELECT
        sc.company_id,
        sc.company_name,
        sc.company_region,
        sc.company_industry,
        sc.company_sub_industry,
        thdcp.id as check_id,
        thdcp.danger_level,
        DATE_FORMAT(thdcp.register_create_time , '%Y-%m') create_time,
        thdcp.rectify_status,
        thdcp.whether_danger
        FROM
        (select sc.company_id,sc.company_name,sc.company_region,sc.company_industry,sc.company_sub_industry from
        sys_company sc
        <where>
            <if test="companyName != null  and companyName != ''">and sc.company_name like concat('%', #{companyName},
                '%')
            </if>
            <if test="companyRegion != null  and companyRegion != ''">and sc.company_region = #{companyRegion}</if>
            <if test="companyId != null  and companyId != ''">and sc.company_id = #{companyId}</if>
            <if test="selectAllCompanyHasRegion != null  and selectAllCompanyHasRegion != ''">and (sc.company_region
                ="源汇区"
                or sc.company_region ="郾城区"
                or sc.company_region ="召陵区"
                or sc.company_region ="舞阳县"
                or sc.company_region ="临颍县"
                or sc.company_region ="开发区"
                or sc.company_region = "西城区"
                or sc.company_region = "市直")
            </if>
            <if test="null != companyIdList  and companyIdList.size() > 0">
                and (sc.company_id in
                <foreach collection="companyIdList" item="companyId" open="(" separator="," close=")">
                    #{companyId}
                </foreach>)
            </if>
            <if test="companyIndustry != null  and companyIndustry != ''">and sc.company_industry = #{companyIndustry}
            </if>
            <if test="companySubIndustry != null  and companySubIndustry != ''">and sc.company_sub_industry =
                #{companySubIndustry}
            </if>
        </where>
        )sc
        LEFT JOIN
        (SELECT `id`, `danger_level`, `register_create_time`, `rectify_status`, `whether_danger`,`company_id`
        from
        tr_hidden_danger_check_point
        where rectify_status is not null)thdcp
        ON
        sc.company_id = thdcp.company_id
    </select>
 
    <select id="selectCompanyRisks" parameterType="DataStatistics" resultMap="companyMap">
        SELECT
        sc.company_id,
        sc.company_name,
        sc.company_region,
        sc.company_industry,
        sc.company_sub_industry,
        trcp.check_point_id,
        trcp.review_status,
        trcp.evaluation_after_fengxianse risk_color
        FROM
        (select sc.company_id,sc.company_name,sc.company_region,sc.company_industry,sc.company_sub_industry from
        sys_company sc
        <where>
            <if test="companyName != null  and companyName != ''">and sc.company_name like concat('%', #{companyName},
                '%')
            </if>
            <if test="companyRegion != null  and companyRegion != ''">and sc.company_region = #{companyRegion}</if>
            <if test="companyId != null  and companyId != ''">and sc.company_id = #{companyId}</if>
            <if test="selectAllCompanyHasRegion != null  and selectAllCompanyHasRegion != ''">and (sc.company_region
                ="源汇区"
                or sc.company_region ="郾城区"
                or sc.company_region ="召陵区"
                or sc.company_region ="舞阳县"
                or sc.company_region ="临颍县"
                or sc.company_region ="开发区"
                or sc.company_region = "西城区"
                or sc.company_region = "市直")
            </if>
            <if test="null != companyIdList  and companyIdList.size() > 0">
                and (sc.company_id in
                <foreach collection="companyIdList" item="companyId" open="(" separator="," close=")">
                    #{companyId}
                </foreach>)
            </if>
            <if test="companyIndustry != null  and companyIndustry != ''">and sc.company_industry = #{companyIndustry}
            </if>
            <if test="companySubIndustry != null  and companySubIndustry != ''">and sc.company_sub_industry =
                #{companySubIndustry}
            </if>
        </where>
        )sc
        LEFT JOIN
        tr_risk_check_point trcp
        ON
        sc.company_id = trcp.company_id
 
    </select>
 
</mapper>