xiangpei
2024-08-26 3f10aa699267f13d8575b92a9634f2c037c1f183
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
<?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="keyCommandImageOnline"    column="key_command_image_online"    />
        <result property="imageResourceSecurity"    column="image_resource_security"    />
    </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_online,image_resource_security 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="keyCommandImageOnline != null "> and key_command_image_online = #{keyCommandImageOnline}</if>
            <if test="imageResourceSecurity != null "> and image_resource_security = #{imageResourceSecurity}</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="keyCommandImageOnline != null">key_command_image_online,</if>
            <if test="imageResourceSecurity != null">image_resource_security,</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="keyCommandImageOnline != null">#{keyCommandImageOnline},</if>
            <if test="imageResourceSecurity != null">#{imageResourceSecurity},</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="keyCommandImageOnline != null">key_command_image_online = #{keyCommandImageOnline},</if>
            <if test="imageResourceSecurity != null">image_resource_security = #{imageResourceSecurity},</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), 0), 0) AS platform_online,
        IFNULL(ROUND(AVG(monitor_qualification * 100), 0), 0) AS monitor_qualification,
        IFNULL(ROUND(AVG(monitor_registration * 100), 0), 0) AS monitor_registration,
        IFNULL(ROUND(AVG(archives_rate * 100), 0), 0) AS archives_rate,
        IFNULL(ROUND(AVG(site_online * 100), 0), 0) AS site_online,
        IFNULL(ROUND(AVG(video_available * 100), 0), 0) AS video_available,
        IFNULL(ROUND(AVG(annotation_accuracy * 100), 0), 0) AS annotation_accuracy,
        IFNULL(ROUND(AVG(timing_accuracy * 100), 0), 0) AS timing_accuracy,
        IFNULL(ROUND(AVG(key_site_online * 100), 0), 0) AS key_site_online,
        IFNULL(ROUND(AVG(key_video_available * 100), 0), 0) AS key_video_available,
        IFNULL(ROUND(AVG(key_annotation_accuracy * 100), 0), 0) AS key_annotation_accuracy,
        IFNULL(ROUND(AVG(key_timing_accuracy * 100), 0), 0) AS key_timing_accuracy,
        IFNULL(ROUND(AVG(key_command_image_online * 100), 0), 0) AS key_command_image_online,
        IFNULL(ROUND(AVG(image_resource_security * 100), 0), 0) AS image_resource_security
        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>