fuliqi
2024-08-21 9da24a8dfa3766cec565b092fc105f7f006de070
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<?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.ycl.platform.mapper.CheckIndexVideoMapper">
 
    <resultMap type="com.ycl.platform.domain.entity.CheckIndexVideo" id="CheckIndexVideoResult">
        <result property="id"    column="id"    />
        <result property="deptId"    column="dept_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="examineTag"    column="examine_tag"    />
        <result property="platformOnline"    column="platform_online"    />
        <result property="monitorQualification"    column="monitor_qualification"    />
        <result property="monitorRegistration"    column="monitor_registration"    />
        <result property="archivesRate"    column="archives_rate"    />
        <result property="siteOnline"    column="site_online"    />
        <result property="videoAvailable"    column="video_available"    />
        <result property="annotationAccuracy"    column="annotation_accuracy"    />
        <result property="timingAccuracy"    column="timing_accuracy"    />
        <result property="keySiteOnline"    column="key_site_online"    />
        <result property="keyVideoAvailable"    column="key_video_available"    />
        <result property="keyAnnotationAccuracy"    column="key_annotation_accuracy"    />
        <result property="keyTimingAccuracy"    column="key_timing_accuracy"    />
        <result property="keyCommandImageInspection"    column="key_command_image_inspection"    />
        <result property="keyCommandImageDirectoryTree"    column="key_command_image_directory_tree"    />
        <result property="onlineInspectionPlatform"    column="online_inspection_platform"    />
        <result property="videoTransmissionAssetsAccuracy"    column="video_transmission_assets_accuracy"    />
        <result property="videoTransmissionAssetsWeakPasswordScore"    column="video_transmission_assets_weak_password_score"    />
        <result property="videoTransmissionDangerousAssetsScore"    column="video_transmission_dangerous_assets_score"    />
        <result property="videoTransmissionBoundaryIntegrityDetection"    column="video_transmission_boundary_integrity_detection"    />
        <result property="operatingRate"    column="operating_rate"    />
    </resultMap>
 
    <sql id="selectCheckIndexVideoVo">
        select id, dept_id, create_time, examine_tag, platform_online, monitor_qualification, monitor_registration, archives_rate, site_online, video_available, annotation_accuracy, timing_accuracy, key_site_online, key_video_available, key_annotation_accuracy, key_timing_accuracy, key_command_image_inspection, key_command_image_directory_tree, online_inspection_platform, video_transmission_assets_accuracy, video_transmission_assets_weak_password_score, video_transmission_dangerous_assets_score, video_transmission_boundary_integrity_detection, operating_rate from t_check_index_video
    </sql>
 
    <select id="selectCheckIndexVideoList" parameterType="CheckIndexVideo" resultMap="CheckIndexVideoResult">
        select tciv.*,sd.dept_name
        from t_check_index_video tciv left join sys_dept sd on tciv.dept_id = sd.dept_id
        <where>
            <if test="deptId != null "> and tciv.dept_id = #{deptId}</if>
            <if test="examineTag != null "> and examine_tag = #{examineTag}</if>
            <if test="date != null "> and  date_format(tciv.create_time,'%Y-%m') = #{date}</if>
            <if test="day != null "> and  date(tciv.create_time) = #{day}</if>
            <if test="createTime != null "> and  date(tciv.create_time) = #{createTime}</if>
            <if test="platformOnline != null "> and platform_online = #{platformOnline}</if>
            <if test="monitorQualification != null "> and monitor_qualification = #{monitorQualification}</if>
            <if test="monitorRegistration != null "> and monitor_registration = #{monitorRegistration}</if>
            <if test="archivesRate != null "> and archives_rate = #{archivesRate}</if>
            <if test="siteOnline != null "> and site_online = #{siteOnline}</if>
            <if test="videoAvailable != null "> and video_available = #{videoAvailable}</if>
            <if test="annotationAccuracy != null "> and annotation_accuracy = #{annotationAccuracy}</if>
            <if test="timingAccuracy != null "> and timing_accuracy = #{timingAccuracy}</if>
            <if test="keySiteOnline != null "> and key_site_online = #{keySiteOnline}</if>
            <if test="keyVideoAvailable != null "> and key_video_available = #{keyVideoAvailable}</if>
            <if test="keyAnnotationAccuracy != null "> and key_annotation_accuracy = #{keyAnnotationAccuracy}</if>
            <if test="keyTimingAccuracy != null "> and key_timing_accuracy = #{keyTimingAccuracy}</if>
            <if test="keyCommandImageInspection != null "> and key_command_image_inspection = #{keyCommandImageInspection}</if>
            <if test="keyCommandImageDirectoryTree != null "> and key_command_image_directory_tree = #{keyCommandImageDirectoryTree}</if>
            <if test="onlineInspectionPlatform != null "> and online_inspection_platform = #{onlineInspectionPlatform}</if>
            <if test="videoTransmissionAssetsAccuracy != null "> and video_transmission_assets_accuracy = #{videoTransmissionAssetsAccuracy}</if>
            <if test="videoTransmissionAssetsWeakPasswordScore != null "> and video_transmission_assets_weak_password_score = #{videoTransmissionAssetsWeakPasswordScore}</if>
            <if test="videoTransmissionDangerousAssetsScore != null "> and video_transmission_dangerous_assets_score = #{videoTransmissionDangerousAssetsScore}</if>
            <if test="videoTransmissionBoundaryIntegrityDetection != null "> and video_transmission_boundary_integrity_detection = #{videoTransmissionBoundaryIntegrityDetection}</if>
            <if test="operatingRate != null "> and operating_rate = #{operatingRate}</if>
            <if test="deptIds != null ">and tciv.dept_id in
            <foreach collection="deptIds" separator="," open="(" close=")" item="deptId">
                #{deptId}
            </foreach>
            </if>
        </where>
    </select>
 
    <select id="selectCheckIndexVideoById"  resultMap="CheckIndexVideoResult">
        <include refid="selectCheckIndexVideoVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertCheckIndexVideo" useGeneratedKeys="true" keyProperty="id">
        insert into t_check_index_video
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="deptId != null">dept_id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="examineTag != null">examine_tag,</if>
            <if test="platformOnline != null">platform_online,</if>
            <if test="monitorQualification != null">monitor_qualification,</if>
            <if test="monitorRegistration != null">monitor_registration,</if>
            <if test="archivesRate != null">archives_rate,</if>
            <if test="siteOnline != null">site_online,</if>
            <if test="videoAvailable != null">video_available,</if>
            <if test="annotationAccuracy != null">annotation_accuracy,</if>
            <if test="timingAccuracy != null">timing_accuracy,</if>
            <if test="keySiteOnline != null">key_site_online,</if>
            <if test="keyVideoAvailable != null">key_video_available,</if>
            <if test="keyAnnotationAccuracy != null">key_annotation_accuracy,</if>
            <if test="keyTimingAccuracy != null">key_timing_accuracy,</if>
            <if test="keyCommandImageInspection != null">key_command_image_inspection,</if>
            <if test="keyCommandImageDirectoryTree != null">key_command_image_directory_tree,</if>
            <if test="onlineInspectionPlatform != null">online_inspection_platform,</if>
            <if test="videoTransmissionAssetsAccuracy != null">video_transmission_assets_accuracy,</if>
            <if test="videoTransmissionAssetsWeakPasswordScore != null">video_transmission_assets_weak_password_score,</if>
            <if test="videoTransmissionDangerousAssetsScore != null">video_transmission_dangerous_assets_score,</if>
            <if test="videoTransmissionBoundaryIntegrityDetection != null">video_transmission_boundary_integrity_detection,</if>
            <if test="operatingRate != null">operating_rate,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="deptId != null">#{deptId},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="examineTag != null">#{examineTag},</if>
            <if test="platformOnline != null">#{platformOnline},</if>
            <if test="monitorQualification != null">#{monitorQualification},</if>
            <if test="monitorRegistration != null">#{monitorRegistration},</if>
            <if test="archivesRate != null">#{archivesRate},</if>
            <if test="siteOnline != null">#{siteOnline},</if>
            <if test="videoAvailable != null">#{videoAvailable},</if>
            <if test="annotationAccuracy != null">#{annotationAccuracy},</if>
            <if test="timingAccuracy != null">#{timingAccuracy},</if>
            <if test="keySiteOnline != null">#{keySiteOnline},</if>
            <if test="keyVideoAvailable != null">#{keyVideoAvailable},</if>
            <if test="keyAnnotationAccuracy != null">#{keyAnnotationAccuracy},</if>
            <if test="keyTimingAccuracy != null">#{keyTimingAccuracy},</if>
            <if test="keyCommandImageInspection != null">#{keyCommandImageInspection},</if>
            <if test="keyCommandImageDirectoryTree != null">#{keyCommandImageDirectoryTree},</if>
            <if test="onlineInspectionPlatform != null">#{onlineInspectionPlatform},</if>
            <if test="videoTransmissionAssetsAccuracy != null">#{videoTransmissionAssetsAccuracy},</if>
            <if test="videoTransmissionAssetsWeakPasswordScore != null">#{videoTransmissionAssetsWeakPasswordScore},</if>
            <if test="videoTransmissionDangerousAssetsScore != null">#{videoTransmissionDangerousAssetsScore},</if>
            <if test="videoTransmissionBoundaryIntegrityDetection != null">#{videoTransmissionBoundaryIntegrityDetection},</if>
            <if test="operatingRate != null">#{operatingRate},</if>
         </trim>
    </insert>
 
    <update id="updateCheckIndexVideo" >
        update t_check_index_video
        <trim prefix="SET" suffixOverrides=",">
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="examineTag != null">examine_tag = #{examineTag},</if>
            <if test="platformOnline != null">platform_online = #{platformOnline},</if>
            <if test="monitorQualification != null">monitor_qualification = #{monitorQualification},</if>
            <if test="monitorRegistration != null">monitor_registration = #{monitorRegistration},</if>
            <if test="archivesRate != null">archives_rate = #{archivesRate},</if>
            <if test="siteOnline != null">site_online = #{siteOnline},</if>
            <if test="videoAvailable != null">video_available = #{videoAvailable},</if>
            <if test="annotationAccuracy != null">annotation_accuracy = #{annotationAccuracy},</if>
            <if test="timingAccuracy != null">timing_accuracy = #{timingAccuracy},</if>
            <if test="keySiteOnline != null">key_site_online = #{keySiteOnline},</if>
            <if test="keyVideoAvailable != null">key_video_available = #{keyVideoAvailable},</if>
            <if test="keyAnnotationAccuracy != null">key_annotation_accuracy = #{keyAnnotationAccuracy},</if>
            <if test="keyTimingAccuracy != null">key_timing_accuracy = #{keyTimingAccuracy},</if>
            <if test="keyCommandImageInspection != null">key_command_image_inspection = #{keyCommandImageInspection},</if>
            <if test="keyCommandImageDirectoryTree != null">key_command_image_directory_tree = #{keyCommandImageDirectoryTree},</if>
            <if test="onlineInspectionPlatform != null">online_inspection_platform = #{onlineInspectionPlatform},</if>
            <if test="videoTransmissionAssetsAccuracy != null">video_transmission_assets_accuracy = #{videoTransmissionAssetsAccuracy},</if>
            <if test="videoTransmissionAssetsWeakPasswordScore != null">video_transmission_assets_weak_password_score = #{videoTransmissionAssetsWeakPasswordScore},</if>
            <if test="videoTransmissionDangerousAssetsScore != null">video_transmission_dangerous_assets_score = #{videoTransmissionDangerousAssetsScore},</if>
            <if test="videoTransmissionBoundaryIntegrityDetection != null">video_transmission_boundary_integrity_detection = #{videoTransmissionBoundaryIntegrityDetection},</if>
            <if test="operatingRate != null">operating_rate = #{operatingRate},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteCheckIndexVideoById" >
        delete from t_check_index_video where id = #{id}
    </delete>
 
    <delete id="deleteCheckIndexVideoByIds" >
        delete from t_check_index_video where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <select id="selectToday" resultType="com.ycl.platform.domain.entity.CheckIndexVideo">
        select * from t_check_index_video where DATE(create_time) = #{today}
    </select>
 
    <select id="dashboard" resultType="com.ycl.platform.domain.entity.CheckIndexVideo">
        SELECT
        IFNULL(ROUND(AVG(platform_online * 100), 2), 0) AS platform_online,
        IFNULL(ROUND(AVG(monitor_qualification * 100), 2), 0) AS monitor_qualification,
        IFNULL(ROUND(AVG(monitor_registration * 100), 2), 0) AS monitor_registration,
        IFNULL(ROUND(AVG(archives_rate * 100), 2), 0) AS archives_rate,
        IFNULL(ROUND(AVG(site_online * 100), 2), 0) AS site_online,
        IFNULL(ROUND(AVG(video_available * 100), 2), 0) AS video_available,
        IFNULL(ROUND(AVG(annotation_accuracy * 100), 2), 0) AS annotation_accuracy,
        IFNULL(ROUND(AVG(timing_accuracy * 100), 2), 0) AS timing_accuracy,
        IFNULL(ROUND(AVG(key_site_online * 100), 2), 0) AS key_site_online,
        IFNULL(ROUND(AVG(key_video_available * 100), 2), 0) AS key_video_available,
        IFNULL(ROUND(AVG(key_annotation_accuracy * 100), 2), 0) AS key_annotation_accuracy,
        IFNULL(ROUND(AVG(key_timing_accuracy * 100), 2), 0) AS key_timing_accuracy,
        IFNULL(ROUND(AVG(key_command_image_inspection * 100), 2), 0) AS key_command_image_inspection,
        IFNULL(ROUND(AVG(key_command_image_directory_tree * 100), 2), 0) AS key_command_image_directory_tree,
        IFNULL(ROUND(AVG(online_inspection_platform * 100), 2), 0) AS online_inspection_platform,
        IFNULL(ROUND(AVG(video_transmission_assets_accuracy * 100), 2), 0) AS video_transmission_assets_accuracy,
        IFNULL(ROUND(AVG(video_transmission_assets_weak_password_score * 100), 2), 0) AS video_transmission_assets_weak_password_score,
        IFNULL(ROUND(AVG(video_transmission_dangerous_assets_score * 100), 2), 0) AS video_transmission_dangerous_assets_score,
        IFNULL(ROUND(AVG(video_transmission_boundary_integrity_detection * 100), 2), 0) AS video_transmission_boundary_integrity_detection,
        IFNULL(ROUND(AVG(operating_rate * 100), 2), 0) AS operating_rate,
        IFNULL(ROUND(AVG(key_command_image_online * 100), 2), 0) AS key_command_image_online
        FROM
        t_check_index_video
        <where>
            <if test="deptId != null">
                AND dept_id = #{deptId}
            </if>
            <if test="dataScope == 1">
                AND examine_tag = 1
            </if>
        </where>
        ORDER BY
        create_time DESC
        <if test="deptId == null">
            LIMIT 7
        </if>
        <if test="deptId != null">
            LIMIT 1
        </if>
    </select>
</mapper>