| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020 |
- <?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.sundot.airport.blocked.mapper.BlockedDashboardMapper">
-
- <resultMap type="java.lang.Integer" id="BlockedCountResult">
- <result property="count" column="total_count"/>
- </resultMap>
- <!-- 查询查堵总数-->
- <select id="selectTotalBlockedCountWithoutBrigade" resultType="java.lang.Integer">
- SELECT COALESCE(SUM(total_blocked_count), 0) as total_count
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- </select>
- <!-- 查询查堵总数-->
- <select id="selectTotalBlockedCountWithBrigade" resultType="java.lang.Integer">
- SELECT COUNT(1) as total_count
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND brigade_id = #{brigadeId}
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- </select>
- <!-- 查询各大队查堵总数(用于柱状图) -->
- <select id="selectBlockedCountByBrigade" resultType="com.sundot.airport.blocked.dto.BlockedBrigadeStatsDTO">
- SELECT
- brigade_id as brigadeId,
- brigade_name as brigadeName,
- COALESCE(SUM(total_blocked_count), 0) as totalBlockedCount
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- GROUP BY brigade_id, brigade_name
- ORDER BY totalBlockedCount DESC
- </select>
- <!-- 查询总查堵万分率(所有大队平均值) -->
- <select id="selectTotalBlockedRate" resultType="java.math.BigDecimal">
- SELECT COALESCE(AVG(daily_block_rate), 0) as totalBlockedRate
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- </select>
- <!-- 查询各大队平均查堵万分率(用于条形图) -->
- <select id="selectBlockedRateByBrigade" resultType="com.sundot.airport.blocked.dto.BlockedBrigadeRateStatsDTO">
- SELECT
- brigade_id as brigadeId,
- brigade_name as brigadeName,
- COALESCE(AVG(daily_block_rate), 0) as avgBlockedRate
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- GROUP BY brigade_id, brigade_name
- ORDER BY avgBlockedRate DESC
- </select>
- <!-- 查询每日查堵合计件数(用于趋势图) -->
- <select id="selectBlockedCountByDate" resultType="com.sundot.airport.blocked.dto.BlockedDailyStatsDTO">
- SELECT
- stat_date as statDate,
- COALESCE(SUM(total_blocked_count), 0) as totalBlockedCount
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- GROUP BY stat_date
- ORDER BY stat_date ASC
- </select>
- <!-- 查询每日各大队查堵合计件数(用于大队对比表) -->
- <select id="selectBlockedCountByDateAndBrigade" resultType="com.sundot.airport.blocked.dto.BlockedDailyBrigadeStatsDTO">
- SELECT
- stat_date as statDate,
- brigade_id as brigadeId,
- brigade_name as brigadeName,
- COALESCE(SUM(total_blocked_count), 0) as totalBlockedCount
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- GROUP BY stat_date, brigade_id, brigade_name
- ORDER BY stat_date ASC, brigade_id ASC
- </select>
- <!-- 查询每日平均查堵万分率(用于趋势图) -->
- <select id="selectBlockedRateByDate" resultType="com.sundot.airport.blocked.dto.BlockedDailyRateStatsDTO">
- SELECT
- stat_date as statDate,
- COALESCE(AVG(daily_block_rate), 0) as avgBlockedRate
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- GROUP BY stat_date
- ORDER BY stat_date ASC
- </select>
- <!-- 查询每日各大队平均查堵万分率(用于大队对比表) -->
- <select id="selectBlockedRateByDateAndBrigade" resultType="com.sundot.airport.blocked.dto.BlockedDailyBrigadeRateStatsDTO">
- SELECT
- stat_date as statDate,
- brigade_id as brigadeId,
- brigade_name as brigadeName,
- COALESCE(AVG(daily_block_rate), 0) as avgBlockedRate
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- GROUP BY stat_date, brigade_id, brigade_name
- ORDER BY stat_date ASC, brigade_id ASC
- </select>
- <!-- 查询每日过检行李合计(用于趋势图) -->
- <select id="selectTotalLuggageCountByDate" resultType="com.sundot.airport.blocked.dto.BlockedDailyLuggageStatsDTO">
- SELECT
- stat_date as statDate,
- COALESCE(SUM(total_luggage_count), 0) as totalLuggageCount
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- GROUP BY stat_date
- ORDER BY stat_date ASC
- </select>
- <!-- 查询每日各大队过检行李合计(用于大队对比表) -->
- <select id="selectTotalLuggageCountByDateAndBrigade" resultType="com.sundot.airport.blocked.dto.BlockedDailyBrigadeLuggageStatsDTO">
- SELECT
- stat_date as statDate,
- brigade_id as brigadeId,
- brigade_name as brigadeName,
- COALESCE(SUM(total_luggage_count), 0) as totalLuggageCount
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- GROUP BY stat_date, brigade_id, brigade_name
- ORDER BY stat_date ASC, brigade_id ASC
- </select>
- <!-- 查询查堵物品分布(用于扇形图) -->
- <select id="selectItemDistribution" resultType="com.sundot.airport.blocked.dto.BlockedItemDistributionDTO">
- SELECT
- miss_check_item as missCheckItem,
- COUNT(1) as count
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND miss_check_item IS NOT NULL
- AND miss_check_item != ''
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY miss_check_item
- ORDER BY count DESC
- </select>
- <!-- 查询区域查堵数据分布-过检行李数(柱状图) -->
- <select id="selectAreaLuggageDistribution" resultType="com.sundot.airport.blocked.dto.BlockedAreaLuggageDTO">
- SELECT
- brigade_name as brigadeName,
- COALESCE(SUM(t1_travel_luggage_count), 0) as t1PassengerLuggageCount,
- COALESCE(SUM(t2_travel_luggage_count), 0) as t2PassengerLuggageCount,
- COALESCE(SUM(t1_walk_luggage_count), 0) as t1CargoLuggageCount,
- COALESCE(SUM(t2_walk_luggage_count), 0) as t2CargoLuggageCount
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- AND brigade_id IS NOT NULL
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- GROUP BY brigade_id, brigade_name
- ORDER BY brigade_id
- </select>
- <!-- 查询区域查堵数据分布-查堵件数(折线图) -->
- <select id="selectAreaBlockedDistribution" resultType="com.sundot.airport.blocked.dto.BlockedAreaBlockedDTO">
- SELECT
- brigade_name as brigadeName,
- COALESCE(SUM(t1_travel_blocked_count), 0) as t1PassengerBlockedCount,
- COALESCE(SUM(t2_travel_blocked_count), 0) as t2PassengerBlockedCount,
- COALESCE(SUM(t1_walk_blocked_count), 0) as t1CargoBlockedCount,
- COALESCE(SUM(t2_walk_blocked_count), 0) as t2CargoBlockedCount
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- AND brigade_id IS NOT NULL
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- GROUP BY brigade_id, brigade_name
- ORDER BY brigade_id
- </select>
- <!-- 查询查堵类型分布(用于分组柱状图) -->
- <select id="selectDiscriminationDistribution" resultType="com.sundot.airport.blocked.dto.BlockedDiscriminationDistributionDTO">
- SELECT
- miss_check_item as missCheckItem,
- discrimination_type as discriminationType,
- COUNT(1) as count
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND miss_check_item IS NOT NULL
- AND miss_check_item != ''
- AND discrimination_type IS NOT NULL
- AND discrimination_type != ''
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY miss_check_item, discrimination_type
- ORDER BY miss_check_item, count DESC
- </select>
- <!-- 查询查堵时间段过检行李数及万分率(用于双轴图表) -->
- <select id="selectTimePeriodStats" resultType="com.sundot.airport.blocked.dto.BlockedTimePeriodStatsDTO">
- SELECT
- time_period as timePeriod,
- COALESCE(SUM(total_luggage_count), 0) as totalLuggageCount,
- COALESCE(SUM(total_blocked_count), 0) as totalBlockedCount,
- COALESCE(AVG(blocked_rate), 0) as blockRate
- FROM blocked_luggage_piece_daily
- WHERE del_flag = '0'
- AND time_period IS NOT NULL
- AND time_period != ''
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- GROUP BY time_period
- ORDER BY MIN(time_period)
- </select>
- <!-- 查询每日过检行李数及万分率(用于双轴图表) -->
- <select id="selectDailyLuggageAndRate" resultType="com.sundot.airport.blocked.dto.BlockedTimePeriodStatsDTO">
- SELECT
- DATE_FORMAT(stat_date, '%Y-%m-%d') as timePeriod,
- COALESCE(SUM(total_luggage_count), 0) as totalLuggageCount,
- COALESCE(SUM(total_blocked_count), 0) as totalBlockedCount,
- COALESCE(AVG(daily_block_rate), 0) as blockRate
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- GROUP BY stat_date
- ORDER BY stat_date ASC
- </select>
- <!-- 查询查堵-AI复查图像总数(用于双系列图表) -->
- <select id="selectAiImageStats" resultType="com.sundot.airport.blocked.dto.BlockedDailyStatsDTO">
- SELECT
- DATE_FORMAT(stat_date, '%Y-%m-%d') as statDate,
- COALESCE(SUM(ai_review_image_total), 0) as totalBlockedCount,
- COALESCE(SUM(ai_mark_total), 0) as dailyBlockedCount
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- GROUP BY stat_date
- ORDER BY stat_date ASC
- </select>
- <!-- 查询查堵-AI漏判图像总数(用于单系列图表) -->
- <select id="selectAiMissImageStats" resultType="com.sundot.airport.blocked.dto.BlockedDailyStatsDTO">
- SELECT
- DATE_FORMAT(stat_date, '%Y-%m-%d') as statDate,
- COALESCE(SUM(ai_miss_image_total), 0) as totalBlockedCount,
- 0 as dailyBlockedCount
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- GROUP BY stat_date
- ORDER BY stat_date ASC
- </select>
- <!-- 查询查堵-AI误判图像总数(用于单系列图表) -->
- <select id="selectAiErrorImageStats" resultType="com.sundot.airport.blocked.dto.BlockedDailyStatsDTO">
- SELECT
- DATE_FORMAT(stat_date, '%Y-%m-%d') as statDate,
- COALESCE(SUM(ai_error_image_total), 0) as totalBlockedCount,
- 0 as dailyBlockedCount
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- GROUP BY stat_date
- ORDER BY stat_date ASC
- </select>
- <!-- 查询查堵-主管排行榜 -->
- <select id="selectSupervisorRanking" resultType="com.sundot.airport.blocked.dto.BlockedRankingDTO">
- SELECT
- supervisor_name as name,
- supervisor_id as id,
- COUNT(1) as totalCount
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND supervisor_name IS NOT NULL
- AND supervisor_name != ''
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY supervisor_id, supervisor_name
- ORDER BY totalCount DESC
- LIMIT 30
- </select>
- <!-- 查询查堵-班组排行榜 -->
- <select id="selectTeamLeaderRanking" resultType="com.sundot.airport.blocked.dto.BlockedRankingDTO">
- SELECT
- team_leader_name as name,
- team_leader_id as id,
- COUNT(1) as totalCount
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND team_leader_name IS NOT NULL
- AND team_leader_name != ''
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY team_leader_id, team_leader_name
- ORDER BY totalCount DESC
- LIMIT 30
- </select>
- <!-- 查询查堵-人员排行榜 -->
- <select id="selectReviewedUserRanking" resultType="com.sundot.airport.blocked.dto.BlockedRankingDTO">
- SELECT
- reviewed_user_name as name,
- reviewed_user_id as id,
- COUNT(1) as totalCount
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND reviewed_user_name IS NOT NULL
- AND reviewed_user_name != ''
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="reviewedUserId != null">
- AND reviewed_user_id = #{reviewedUserId}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY reviewed_user_id, reviewed_user_name
- ORDER BY totalCount DESC
- LIMIT 30
- </select>
- <!-- 查询查堵-物品位置分布(用于扇形图) -->
- <select id="selectItemLocationDistribution" resultType="com.sundot.airport.blocked.dto.BlockedItemLocationDistributionDTO">
- SELECT
- item_location as itemLocation,
- COUNT(1) as count
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND item_location IS NOT NULL
- AND item_location != ''
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="itemLocation != null and itemLocation != ''">
- AND item_location = #{itemLocation}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY item_location
- ORDER BY count DESC
- </select>
- <!-- 查询查堵-原因分类分布(用于扇形图) -->
- <select id="selectMissCheckReasonDistribution" resultType="com.sundot.airport.blocked.dto.BlockedMissCheckReasonDistributionDTO">
- SELECT
- miss_check_reason_category as missCheckReasonCategory,
- COUNT(1) as count
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND area_id IS NOT NULL
- AND miss_check_reason_category IS NOT NULL
- AND miss_check_reason_category != ''
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY miss_check_reason_category
- ORDER BY count DESC
- </select>
- <!-- 查询查堵-图像难易程度分布(用于扇形图) -->
- <select id="selectDifficultyDistribution" resultType="com.sundot.airport.blocked.dto.BlockedDifficultyDistributionDTO">
- SELECT
- difficulty_level as difficultyLevel,
- COUNT(1) as count
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND difficulty_level IS NOT NULL
- AND difficulty_level != ''
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY difficulty_level
- ORDER BY count DESC
- </select>
- <!-- 查询查堵-开机人员持证比例(用于扇形图) -->
- <select id="selectCertificateDistribution" resultType="com.sundot.airport.blocked.dto.BlockedCertificateDistributionDTO">
- SELECT
- u.qualification_level as certificateLevel,
- COUNT(DISTINCT bms.reviewed_user_id) as count
- FROM blocked_miss_check_statistics bms
- INNER JOIN sys_user u ON bms.reviewed_user_id = u.user_id
- WHERE bms.del_flag = '0'
- AND u.del_flag = '0'
- AND u.status = '0'
- AND u.qualification_level IS NOT NULL
- AND u.qualification_level != ''
- <if test="startTime != null and endTime != null">
- AND bms.review_date >= #{startTime}
- AND bms.review_date <= #{endTime}
- </if>
- <if test="brigadeId != null">
- AND bms.brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND bms.terminal_id = #{terminalId}
- </if>
- <if test="supervisorId != null">
- AND bms.supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND bms.team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND bms.miss_check_item = #{missCheckItem}
- </if>
- GROUP BY u.qualification_level
- ORDER BY count DESC
- </select>
- <!-- 查询大队开机人员证书分布(用于柱状图) -->
- <select id="selectBrigadeCertificateDistribution" resultType="com.sundot.airport.blocked.dto.BlockedCertificateLevelDTO">
- SELECT
- d.dept_name as brigadeName,
- d.dept_id as brigadeId,
- COUNT(DISTINCT CASE WHEN u.qualification_level IN ('LEVEL_ONE', 'LEVEL_TWO', 'LEVEL_THREE') THEN u.user_id END) as seniorCount,
- COUNT(DISTINCT CASE WHEN u.qualification_level = 'LEVEL_FOUR' THEN u.user_id END) as middleCount,
- COUNT(DISTINCT CASE WHEN u.qualification_level = 'LEVEL_FIVE' THEN u.user_id END) as juniorCount,
- COUNT(DISTINCT u.user_id) as totalCount
- FROM sys_user u
- INNER JOIN sys_dept d ON u.dept_id = d.dept_id
- WHERE u.del_flag = '0'
- AND u.status = '0'
- AND u.qualification_level IS NOT NULL
- AND u.qualification_level != ''
- AND d.dept_type = 'BRIGADE'
- <if test="terminalId != null">
- AND d.terminal_id = #{terminalId}
- </if>
- GROUP BY d.dept_id, d.dept_name
- ORDER BY totalCount DESC
- </select>
- <!-- 查询两楼每日查堵走势(按大队) -->
- <select id="selectDailyBrigadeTerminalStats" resultType="com.sundot.airport.blocked.dto.BlockedDailyBrigadeTerminalStatsDTO">
- SELECT
- stat_date as statDate,
- COALESCE(SUM(t1_travel_blocked_count), 0) as t1TravelBlockedCount,
- COALESCE(SUM(t2_travel_blocked_count), 0) as t2TravelBlockedCount,
- COALESCE(SUM(t1_walk_blocked_count), 0) as t1WalkBlockedCount,
- COALESCE(SUM(t2_walk_blocked_count), 0) as t2WalkBlockedCount
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- GROUP BY stat_date
- ORDER BY stat_date ASC
- </select>
- <!-- 查询两楼每日过检图像数(按大队) -->
- <select id="selectDailyBrigadeTerminalLuggageStats" resultType="com.sundot.airport.blocked.dto.BlockedDailyBrigadeTerminalLuggageStatsDTO">
- SELECT
- stat_date as statDate,
- COALESCE(SUM(t1_travel_luggage_count), 0) as t1TravelBagCount,
- COALESCE(SUM(t2_travel_luggage_count), 0) as t2TravelBagCount,
- COALESCE(SUM(t1_walk_luggage_count), 0) as t1WalkBagCount,
- COALESCE(SUM(t2_walk_luggage_count), 0) as t2WalkBagCount
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- GROUP BY stat_date
- ORDER BY stat_date ASC
- </select>
- <!-- 查询两楼查堵数(包含行检,按大队) -->
- <select id="selectTerminalBlockedStats" resultType="com.sundot.airport.blocked.dto.BlockedTerminalStatsDTO">
- SELECT
- COUNT(1) as totalBlockedCount,
- COALESCE(SUM(CASE WHEN terminal_id = 1 THEN 1 ELSE 0 END), 0) as t1BlockedCount,
- COALESCE(SUM(CASE WHEN terminal_id = 2 THEN 1 ELSE 0 END), 0) as t2BlockedCount
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- </select>
- <!-- 查询查堵时间段过检行李数(按大队) -->
- <select id="selectTimePeriodLuggageStats" resultType="com.sundot.airport.blocked.dto.BlockedTimePeriodLuggageStatsDTO">
- SELECT
- time_period as timePeriod,
- ROUND(AVG(total_luggage_count), 2) as avgLuggageCount,
- ROUND(AVG(total_blocked_count), 2) as avgBlockedCount
- FROM blocked_luggage_piece_daily
- WHERE del_flag = '0'
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- GROUP BY time_period
- ORDER BY time_period ASC
- </select>
- <!-- 查询两楼每日查堵万分率(按大队) -->
- <select id="selectDailyBrigadeTerminalRateStats" resultType="com.sundot.airport.blocked.dto.BlockedDailyBrigadeTerminalRateStatsDTO">
- SELECT
- stat_date as statDate,
- COALESCE(AVG(t1_travel_block_rate), 0) as t1TravelBlockRate,
- COALESCE(AVG(t2_travel_block_rate), 0) as t2TravelBlockRate,
- COALESCE(AVG(t1_walk_block_rate), 0) as t1WalkBlockRate,
- COALESCE(AVG(t2_walk_block_rate), 0) as t2WalkBlockRate
- FROM blocked_luggage_statistics_daily
- WHERE del_flag = '0'
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="startTime != null and endTime != null">
- AND stat_date >= #{startTime}
- AND stat_date <= #{endTime}
- </if>
- GROUP BY stat_date
- ORDER BY stat_date ASC
- </select>
- <!-- 查询查堵-主管排行榜(大队维度,前10名) -->
- <select id="selectBrigadeSupervisorRanking" resultType="com.sundot.airport.blocked.dto.BlockedRankingDTO">
- SELECT
- supervisor_name as name,
- supervisor_id as id,
- COUNT(1) as totalCount
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND supervisor_name IS NOT NULL
- AND supervisor_name != ''
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY supervisor_id, supervisor_name
- ORDER BY totalCount DESC
- LIMIT 10
- </select>
- <!-- 查询查堵-班组排行榜(大队维度,前10名) -->
- <select id="selectBrigadeTeamLeaderRanking" resultType="com.sundot.airport.blocked.dto.BlockedRankingDTO">
- SELECT
- team_leader_name as name,
- team_leader_id as id,
- COUNT(1) as totalCount
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND team_leader_name IS NOT NULL
- AND team_leader_name != ''
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY team_leader_id, team_leader_name
- ORDER BY totalCount DESC
- LIMIT 10
- </select>
- <!-- 查询查堵-人员排行榜(大队维度,前10名) -->
- <select id="selectBrigadeReviewedUserRanking" resultType="com.sundot.airport.blocked.dto.BlockedRankingDTO">
- SELECT
- reviewed_user_name as name,
- reviewed_user_id as id,
- COUNT(1) as totalCount
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND reviewed_user_name IS NOT NULL
- AND reviewed_user_name != ''
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY reviewed_user_id, reviewed_user_name
- ORDER BY totalCount DESC
- LIMIT 10
- </select>
- <!-- 查询查堵男女比例(按大队) -->
- <select id="selectGenderDistribution" resultType="com.sundot.airport.blocked.dto.BlockedGenderDistributionDTO">
- SELECT
- gender as gender,
- COUNT(1) as count
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND gender IS NOT NULL
- AND gender != ''
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY gender
- ORDER BY count DESC
- </select>
- <!-- 查询查堵人员证书级别分布(按大队) -->
- <select id="selectCertificateLevelDistribution" resultType="com.sundot.airport.blocked.dto.BlockedCertificateLevelDistributionDTO">
- SELECT
- certificate_level as certificateLevel,
- COUNT(1) as count
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND certificate_level IS NOT NULL
- AND certificate_level != ''
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY certificate_level
- ORDER BY count DESC
- </select>
- <!-- 查询证书级别人员基数(分大队统计) -->
- <select id="selectBrigadePersonnelCertificateBase" resultType="com.sundot.airport.blocked.dto.BlockedCertificateLevelDistributionDTO">
- SELECT
- u.qualification_level as certificateLevel,
- COUNT(DISTINCT u.user_id) as count
- FROM sys_user u
- INNER JOIN sys_dept d ON u.dept_id = d.dept_id
- WHERE u.del_flag = '0'
- AND u.status = '0'
- AND u.qualification_level IS NOT NULL
- AND u.qualification_level != ''
- AND d.dept_type = 'BRIGADE'
- <if test="brigadeId != null">
- AND d.dept_id = #{brigadeId}
- </if>
- GROUP BY u.qualification_level
- ORDER BY count DESC
- </select>
- <!-- 查询查堵-主管分管次数分布(用于饼图) -->
- <select id="selectSupervisorDistribution" resultType="com.sundot.airport.blocked.dto.BlockedRankingDTO">
- SELECT
- supervisor_name as name,
- supervisor_id as id,
- COUNT(1) as totalCount
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND supervisor_name IS NOT NULL
- AND supervisor_name != ''
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY supervisor_id, supervisor_name
- ORDER BY totalCount DESC
- </select>
- <!-- 查询查堵人员开机年限分布(用于饼图) -->
- <select id="selectOperatingYearsDistribution" resultType="com.sundot.airport.blocked.dto.BlockedOperatingYearsDistributionDTO">
- SELECT
- machine_operating_years as operatingYears,
- COUNT(1) as count
- FROM blocked_miss_check_statistics
- WHERE del_flag = '0'
- AND machine_operating_years IS NOT NULL
- AND machine_operating_years != ''
- <if test="brigadeId != null">
- AND brigade_id = #{brigadeId}
- </if>
- <if test="terminalId != null">
- AND terminal_id = #{terminalId}
- </if>
- <if test="startTime != null and endTime != null">
- AND review_date >= #{startTime}
- AND review_date <= #{endTime}
- </if>
- <if test="supervisorId != null">
- AND supervisor_id = #{supervisorId}
- </if>
- <if test="teamLeaderId != null">
- AND team_leader_id = #{teamLeaderId}
- </if>
- <if test="missCheckItem != null and missCheckItem != ''">
- AND miss_check_item = #{missCheckItem}
- </if>
- GROUP BY machine_operating_years
- ORDER BY count DESC
- </select>
- </mapper>
|