| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894 |
- <?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.check.mapper.CheckLargeScreenMapper">
- <select id="planOverview" resultType="com.sundot.airport.check.domain.CheckLargeScreenPlanOverviewDto">
- select date_format(ct.check_start_time, '%Y-%m-%d') date,
- ct.check_category type,
- ct.check_category_desc typeDesc,
- count(ct.id) total
- from check_task ct
- where 1 = 1
- <if test="isSelfCheck != null">
- and ct.is_self_check=#{isSelfCheck}
- </if>
- <if test="createId != null">
- and ct.create_id=#{createId}
- </if>
- <if test="deptId != null">
- and ct.self_check_dept_id=#{deptId}
- </if>
- <if test="startDate != null and endDate != null">
- and (ct.check_start_time >= #{startDate}
- and ct.check_start_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- group by date_format(ct.check_start_time, '%Y-%m-%d'), ct.check_category, ct.check_category_desc
- </select>
- <select id="planDistribution" resultType="com.sundot.airport.check.domain.CheckLargeScreenCommonDto">
- select cpi.category_code_one code, category_name_one name, count(cpi.id) total
- from check_task ct
- inner join check_project_item cpi on (cpi.source_id = ct.id and cpi.type = 'CHECK_TASK')
- where 1 = 1
- <if test="isSelfCheck != null">
- and ct.is_self_check=#{isSelfCheck}
- </if>
- <if test="createId != null">
- and ct.create_id=#{createId}
- </if>
- <if test="deptId != null">
- and ct.self_check_dept_id=#{deptId}
- </if>
- <if test="startDate != null and endDate != null">
- and (ct.check_start_time >= #{startDate}
- and ct.check_start_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- group by cpi.category_code_one, cpi.category_name_one
- order by total desc
- </select>
- <select id="planStatistics" resultType="com.sundot.airport.check.domain.CheckTask">
- select ct.*
- from check_task ct
- where 1 = 1
- <if test="isSelfCheck != null">
- and ct.is_self_check=#{isSelfCheck}
- </if>
- <if test="createId != null">
- and ct.create_id=#{createId}
- </if>
- <if test="deptId != null">
- and ct.self_check_dept_id=#{deptId}
- </if>
- <if test="startDate != null and endDate != null">
- and (ct.check_start_time >= #{startDate}
- and ct.check_start_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- order by ct.check_start_time desc
- </select>
- <select id="problemDistribution" resultType="com.sundot.airport.check.domain.CheckLargeScreenProblemDto">
- select cpi.category_code_one code, cpi.category_name_one name, count(cpi.id) total
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- group by cpi.category_code_one, cpi.category_name_one
- order by total desc
- </select>
- <select id="problemComparisonBrigade" resultType="com.sundot.airport.check.domain.CheckLargeScreenProblemDto">
- select cc.checked_brigade_id deptId,
- cc.checked_brigade_name deptName,
- cpi.category_code_one code,
- cpi.category_name_one name,
- count(cpi.id) total
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- group by cc.checked_brigade_id, cc.checked_brigade_name, cpi.category_code_one, cpi.category_name_one
- order by total desc
- </select>
- <select id="problemComparison" resultType="com.sundot.airport.check.domain.CheckLargeScreenProblemDto">
- select cc.checked_department_id deptId,
- cc.checked_department_name deptName,
- cpi.category_code_one code,
- cpi.category_name_one name,
- count(cpi.id) total
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- group by cc.checked_department_id, cc.checked_department_name, cpi.category_code_one, cpi.category_name_one
- order by total desc
- </select>
- <select id="problemComparisonTwoBrigade" resultType="com.sundot.airport.check.domain.CheckLargeScreenProblemDto">
- select cc.checked_brigade_id deptId,
- cc.checked_brigade_name deptName,
- cpi.category_code_two code,
- cpi.category_name_two name,
- count(cpi.id) total
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="categoryCodeOne != null and categoryCodeOne != ''">
- and cpi.category_code_one=#{categoryCodeOne}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- group by cc.checked_brigade_id, cc.checked_brigade_name, cpi.category_code_two, cpi.category_name_two
- order by total desc
- </select>
- <select id="problemComparisonTwo" resultType="com.sundot.airport.check.domain.CheckLargeScreenProblemDto">
- select cc.checked_department_id deptId,
- cc.checked_department_name deptName,
- cpi.category_code_two code,
- cpi.category_name_two name,
- count(cpi.id) total
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="categoryCodeOne != null and categoryCodeOne != ''">
- and cpi.category_code_one=#{categoryCodeOne}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- group by cc.checked_department_id, cc.checked_department_name, cpi.category_code_two, cpi.category_name_two
- order by total desc
- </select>
- <select id="problemComparisonBanZu" resultType="com.sundot.airport.check.domain.CheckLargeScreenProblemDto">
- select cc.checked_team_id deptId,
- cc.checked_team_name deptName,
- cpi.category_code_one code,
- cpi.category_name_one name,
- count(cpi.id) total
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- group by cc.checked_team_id, cc.checked_team_name, cpi.category_code_one, cpi.category_name_one
- order by total desc
- </select>
- <select id="problemComparisonTwoBanZu" resultType="com.sundot.airport.check.domain.CheckLargeScreenProblemDto">
- select cc.checked_team_id deptId,
- cc.checked_team_name deptName,
- cpi.category_code_two code,
- cpi.category_name_two name,
- count(cpi.id) total
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="categoryCodeOne != null and categoryCodeOne != ''">
- and cpi.category_code_one=#{categoryCodeOne}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- group by cc.checked_team_id, cc.checked_team_name, cpi.category_code_two, cpi.category_name_two
- order by total desc
- </select>
- <select id="problemTrendBrigade" resultType="com.sundot.airport.check.domain.CheckLargeScreenProblemTrendDto">
- select date_format(cc.check_time, '%Y-%m-%d') date,
- cc.checked_brigade_id id,
- cc.checked_brigade_name name,
- count(cpi.id) total
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="categoryCodeOne != null and categoryCodeOne != ''">
- and cpi.category_code_one=#{categoryCodeOne}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- group by date_format(cc.check_time, '%Y-%m-%d'), cc.checked_brigade_id, cc.checked_brigade_name
- order by total desc
- </select>
- <select id="problemTrend" resultType="com.sundot.airport.check.domain.CheckLargeScreenProblemTrendDto">
- select date_format(cc.check_time, '%Y-%m-%d') date,
- cc.checked_department_id id,
- cc.checked_department_name name,
- count(cpi.id) total
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="categoryCodeOne != null and categoryCodeOne != ''">
- and cpi.category_code_one=#{categoryCodeOne}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- group by date_format(cc.check_time, '%Y-%m-%d'), cc.checked_department_id, cc.checked_department_name
- order by total desc
- </select>
- <select id="problemTrendBanZu" resultType="com.sundot.airport.check.domain.CheckLargeScreenProblemTrendDto">
- select date_format(cc.check_time, '%Y-%m-%d') date,
- cc.checked_team_id id,
- cc.checked_team_name name,
- count(cpi.id) total
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="categoryCodeOne != null and categoryCodeOne != ''">
- and cpi.category_code_one=#{categoryCodeOne}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- group by date_format(cc.check_time, '%Y-%m-%d'), cc.checked_team_id, cc.checked_team_name
- order by total desc
- </select>
- <select id="correction" resultType="com.sundot.airport.check.domain.CheckLargeScreenCorrectionAssistDto">
- select cc.checked_brigade_id brigadeId,
- cc.checked_brigade_name brigadeName,
- cc.checked_department_id departmentId,
- cc.checked_department_name departmentName,
- cc.checked_team_id teamId,
- cc.checked_team_name teamName,
- case
- when cc.status = 'RECTIFIED' and cc.rectification_deadline >= cc.completion_time
- then 'ON_TIME_COMPLETED'
- when cc.status = 'RECTIFIED' and cc.rectification_deadline <![CDATA[ < ]]> cc.completion_time
- then 'OVER_TIME_COMPLETED'
- when cc.status = 'UNDER_RECTIFICATION' and CURRENT_DATE() <![CDATA[ <= ]]> cc.rectification_deadline
- then 'ON_TIME_UNFINISHED'
- when cc.status = 'UNDER_RECTIFICATION' and CURRENT_DATE() > cc.rectification_deadline
- then 'OVER_TIME_UNFINISHED'
- else 'OTHER' end type
- from check_correction cc
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- </select>
- <select id="correctionDistributionBrigade"
- resultType="com.sundot.airport.check.domain.CheckLargeScreenCorrectionDto">
- select temp.deptId deptId,
- temp.deptName deptName,
- ifnull(sum(case when temp.type = 'ON_TIME_COMPLETED' then 1 else 0 end), 0) onTimeCompletedCount,
- ifnull(sum(case when temp.type = 'OVER_TIME_COMPLETED' then 1 else 0 end), 0) overTimeCompletedCount,
- ifnull(sum(case when temp.type = 'ON_TIME_UNFINISHED' then 1 else 0 end), 0) onTimeUnfinishedCount,
- ifnull(sum(case when temp.type = 'OVER_TIME_UNFINISHED' then 1 else 0 end), 0) overTimeUnfinishedCount,
- ifnull(sum(case when temp.type = 'OTHER' then 1 else 0 end), 0) otherCount
- from (select cc.checked_brigade_id deptId,
- cc.checked_brigade_name deptName,
- case
- when cc.status = 'RECTIFIED' and cc.rectification_deadline >= cc.completion_time
- then 'ON_TIME_COMPLETED'
- when cc.status = 'RECTIFIED' and cc.rectification_deadline <![CDATA[ < ]]> cc.completion_time
- then 'OVER_TIME_COMPLETED'
- when cc.status = 'UNDER_RECTIFICATION' and CURRENT_DATE() <![CDATA[ <= ]]> cc.rectification_deadline
- then 'ON_TIME_UNFINISHED'
- when cc.status = 'UNDER_RECTIFICATION' and CURRENT_DATE() > cc.rectification_deadline
- then 'OVER_TIME_UNFINISHED'
- else 'OTHER' end type
- from check_correction cc
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>) temp
- group by temp.deptId, temp.deptName
- </select>
- <select id="correctionDistribution" resultType="com.sundot.airport.check.domain.CheckLargeScreenCorrectionDto">
- select temp.deptId deptId,
- temp.deptName deptName,
- ifnull(sum(case when temp.type = 'ON_TIME_COMPLETED' then 1 else 0 end), 0) onTimeCompletedCount,
- ifnull(sum(case when temp.type = 'OVER_TIME_COMPLETED' then 1 else 0 end), 0) overTimeCompletedCount,
- ifnull(sum(case when temp.type = 'ON_TIME_UNFINISHED' then 1 else 0 end), 0) onTimeUnfinishedCount,
- ifnull(sum(case when temp.type = 'OVER_TIME_UNFINISHED' then 1 else 0 end), 0) overTimeUnfinishedCount,
- ifnull(sum(case when temp.type = 'OTHER' then 1 else 0 end), 0) otherCount
- from (select cc.checked_department_id deptId,
- cc.checked_department_name deptName,
- case
- when cc.status = 'RECTIFIED' and cc.rectification_deadline >= cc.completion_time
- then 'ON_TIME_COMPLETED'
- when cc.status = 'RECTIFIED' and cc.rectification_deadline <![CDATA[ < ]]> cc.completion_time
- then 'OVER_TIME_COMPLETED'
- when cc.status = 'UNDER_RECTIFICATION' and CURRENT_DATE() <![CDATA[ <= ]]> cc.rectification_deadline
- then 'ON_TIME_UNFINISHED'
- when cc.status = 'UNDER_RECTIFICATION' and CURRENT_DATE() > cc.rectification_deadline
- then 'OVER_TIME_UNFINISHED'
- else 'OTHER' end type
- from check_correction cc
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>) temp
- group by temp.deptId, temp.deptName
- </select>
- <select id="correctionDistributionBanZu" resultType="com.sundot.airport.check.domain.CheckLargeScreenCorrectionDto">
- select temp.deptId deptId,
- temp.deptName deptName,
- ifnull(sum(case when temp.type = 'ON_TIME_COMPLETED' then 1 else 0 end), 0) onTimeCompletedCount,
- ifnull(sum(case when temp.type = 'OVER_TIME_COMPLETED' then 1 else 0 end), 0) overTimeCompletedCount,
- ifnull(sum(case when temp.type = 'ON_TIME_UNFINISHED' then 1 else 0 end), 0) onTimeUnfinishedCount,
- ifnull(sum(case when temp.type = 'OVER_TIME_UNFINISHED' then 1 else 0 end), 0) overTimeUnfinishedCount,
- ifnull(sum(case when temp.type = 'OTHER' then 1 else 0 end), 0) otherCount
- from (select cc.checked_team_id deptId,
- cc.checked_team_name deptName,
- case
- when cc.status = 'RECTIFIED' and cc.rectification_deadline >= cc.completion_time
- then 'ON_TIME_COMPLETED'
- when cc.status = 'RECTIFIED' and cc.rectification_deadline <![CDATA[ < ]]> cc.completion_time
- then 'OVER_TIME_COMPLETED'
- when cc.status = 'UNDER_RECTIFICATION' and CURRENT_DATE() <![CDATA[ <= ]]> cc.rectification_deadline
- then 'ON_TIME_UNFINISHED'
- when cc.status = 'UNDER_RECTIFICATION' and CURRENT_DATE() > cc.rectification_deadline
- then 'OVER_TIME_UNFINISHED'
- else 'OTHER' end type
- from check_correction cc
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>) temp
- group by temp.deptId, temp.deptName
- </select>
- <select id="inspectionExecute" resultType="com.sundot.airport.check.domain.CheckLargeScreenInspectionExecuteDto">
- select ct.id taskId,
- ct.task_code taskCode,
- ct.task_name taskName,
- ct.check_level checkLevel,
- ct.check_level_desc checkLevelDesc,
- ct.rule_type_num ruleTypeNum,
- ct.check_start_time checkStartTime,
- ct.check_end_time checkEndTime
- from check_task ct
- where 1 = 1
- and current_date() between ct.check_start_time and ct.check_end_time
- </select>
- <select id="inspectionExecuteItem"
- resultType="com.sundot.airport.check.domain.CheckLargeScreenInspectionExecuteItemDto">
- select cr.task_code taskCode,
- cr.checker_id userId,
- cr.checker_name userName,
- count(distinct cr.id) checkOrderCount,
- count(distinct cc.id) rectificationOrderCount,
- count(distinct cpi.id) unqualifiedProjectCount
- from check_record cr
- left join check_correction cc on cc.check_record_id = cr.id
- left join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- and cr.task_code in
- <foreach item="item" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- and (cr.check_time
- between concat(curdate(), ' 00:00:00') and concat(date_add(curdate(), interval 1 day), ' 00:00:00'))
- group by cr.task_code, cr.checker_id, cr.checker_name
- </select>
- <select id="inspectionExecuteUser"
- resultType="com.sundot.airport.check.domain.CheckLargeScreenInspectionExecuteUserDto">
- select su.user_id,
- su.user_name,
- su.nick_name,
- su.dept_id,
- sr.role_id,
- sr.role_name,
- sr.role_key
- from sys_user su
- inner join sys_user_role sur on su.user_id = sur.user_id
- inner join sys_role sr on sr.role_id = sur.role_id
- where 1 = 1
- and su.del_flag = '0'
- and sr.del_flag = '0'
- and su.user_id in
- <foreach item="item" collection="list" open="(" separator="," close=")">
- #{item}
- </foreach>
- </select>
- <select id="getProblemBrigade" resultType="com.sundot.airport.check.domain.CheckLargeScreenProblemDto">
- select distinct cc.checked_brigade_id deptId,
- cc.checked_brigade_name deptName
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- </select>
- <select id="getProblemDepartment" resultType="com.sundot.airport.check.domain.CheckLargeScreenProblemDto">
- select distinct cc.checked_department_id deptId,
- cc.checked_department_name deptName
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- </select>
- <select id="getProblemTeam" resultType="com.sundot.airport.check.domain.CheckLargeScreenProblemDto">
- select distinct cc.checked_team_id deptId,
- cc.checked_team_name deptName
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- </select>
- <select id="portrait" resultType="com.sundot.airport.check.domain.CheckLargeScreenCorrectionPortraitSqlDto">
- select cc.id id,
- cc.checked_brigade_id checkedBrigadeId,
- cc.checked_brigade_name checkedBrigadeName,
- cc.checked_department_id checkedDepartmentId,
- cc.checked_department_name checkedDepartmentName,
- cc.checked_team_id checkedTeamId,
- cc.checked_team_name checkedTeamName,
- cpi.category_code_one categoryCodeOne,
- cpi.category_name_one categoryNameOne,
- cpi.category_code_two categoryCodeTwo,
- cpi.category_name_two categoryNameTwo,
- cu.user_id userId,
- cu.user_name userName,
- case
- when cc.status = 'RECTIFIED' and cc.rectification_deadline >= cc.completion_time
- then 'ON_TIME_COMPLETED'
- when cc.status = 'RECTIFIED' and cc.rectification_deadline <![CDATA[ < ]]> cc.completion_time
- then 'OVER_TIME_COMPLETED'
- when cc.status = 'UNDER_RECTIFICATION' and CURRENT_DATE() <![CDATA[ <= ]]> cc.rectification_deadline
- then 'ON_TIME_UNFINISHED'
- when cc.status = 'UNDER_RECTIFICATION' and CURRENT_DATE() > cc.rectification_deadline
- then 'OVER_TIME_UNFINISHED'
- else 'OTHER' end correctionType
- from check_correction cc
- inner join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- inner join check_user cu
- on (cu.source_id = cpi.id and cu.type = 'PROBLEM_RECTIFICATION_INSPECTION_ITEM_DETAILS')
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="processStatus != null">
- and cc.process_status=#{processStatus}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="checkedUserId != null">
- and cu.user_id=#{checkedUserId}
- </if>
- <if test="specifiedDate != null and specifiedDate != null">
- and DATE(cc.check_time) = DATE(#{specifiedDate})
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- </select>
- <select id="managementPromotionRecord" resultType="com.sundot.airport.check.domain.CheckLargeScreenPlanOverviewDto">
- select date_format(cr.check_time, '%Y-%m-%d') date,
- ct.check_category type,
- ct.check_category_desc typeDesc,
- count(cr.id) total
- from check_task ct
- inner join check_record cr on cr.task_code = ct.task_code
- where 1 = 1
- <if test="isSelfCheck != null">
- and ct.is_self_check=#{isSelfCheck}
- </if>
- <if test="checkedBrigadeId != null">
- and cr.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cr.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cr.checked_team_id=#{checkedTeamId}
- </if>
- <if test="startDate != null and endDate != null">
- and (cr.check_time >= #{startDate}
- and cr.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- group by date_format(cr.check_time, '%Y-%m-%d'), ct.check_category, ct.check_category_desc
- order by date desc
- </select>
- <select id="managementPromotionCorrection"
- resultType="com.sundot.airport.check.domain.CheckLargeScreenCorrectionDto">
- select ifnull(sum(case when temp.type = 'ON_TIME_COMPLETED' then 1 else 0 end), 0) onTimeCompletedCount,
- ifnull(sum(case when temp.type = 'OVER_TIME_COMPLETED' then 1 else 0 end), 0) overTimeCompletedCount,
- ifnull(sum(case when temp.type = 'ON_TIME_UNFINISHED' then 1 else 0 end), 0) onTimeUnfinishedCount,
- ifnull(sum(case when temp.type = 'OVER_TIME_UNFINISHED' then 1 else 0 end), 0) overTimeUnfinishedCount,
- ifnull(sum(case when temp.type = 'OTHER' then 1 else 0 end), 0) otherCount
- from (select
- case
- when cc.status = 'RECTIFIED' and cc.rectification_deadline >= cc.completion_time
- then 'ON_TIME_COMPLETED'
- when cc.status = 'RECTIFIED' and cc.rectification_deadline <![CDATA[ < ]]> cc.completion_time
- then 'OVER_TIME_COMPLETED'
- when cc.status = 'UNDER_RECTIFICATION' and CURRENT_DATE() <![CDATA[ <= ]]> cc.rectification_deadline
- then 'ON_TIME_UNFINISHED'
- when cc.status = 'UNDER_RECTIFICATION' and CURRENT_DATE() > cc.rectification_deadline
- then 'OVER_TIME_UNFINISHED'
- else 'OTHER' end type
- from check_correction cc
- where 1 = 1
- <if test="isSelfCheck != null">
- and cc.is_self_check=#{isSelfCheck}
- </if>
- <if test="processStatus != null">
- and cc.process_status=#{processStatus}
- </if>
- <if test="checkedBrigadeId != null">
- and cc.checked_brigade_id=#{checkedBrigadeId}
- </if>
- <if test="checkedDepartmentId != null">
- and cc.checked_department_id=#{checkedDepartmentId}
- </if>
- <if test="checkedTeamId != null">
- and cc.checked_team_id=#{checkedTeamId}
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>) temp
- </select>
- <select id="homePageCheckRecord"
- resultType="com.sundot.airport.check.domain.CheckLargeScreenHomePageCheckRecordSqlDto">
- select cr.id id,
- cr.document_code documentCode,
- cr.document_name documentName,
- cr.checker_id checkerId,
- cr.checker_name checkerName,
- date_format(cr.check_time, '%Y-%m-%d %H:%i:%s') checkTime,
- cr.check_level checkLevel,
- cr.check_level_desc checkLevelDesc,
- cr.checked_level checkedLevel,
- cr.checked_level_desc checkedLevelDesc,
- cr.checked_brigade_id checkedBrigadeId,
- cr.checked_brigade_name checkedBrigadeName,
- cr.checked_department_id checkedDepartmentId,
- cr.checked_department_name checkedDepartmentName,
- cr.checked_team_id checkedTeamId,
- cr.checked_team_name checkedTeamName,
- cr.checked_personnel_id checkedPersonnelId,
- cr.checked_personnel_name checkedPersonnelName,
- cr.checked_dept_id checkedDeptId,
- cr.checked_dept_name checkedDeptName,
- cr.responsible_user_id responsibleUserId,
- cr.responsible_user_name responsibleUserName,
- cr.check_result checkResult,
- cr.check_result_desc checkResultDesc,
- cpi.score_level scoreLevel,
- cpi.score_level_desc scoreLevelDesc,
- cr.check_record_status checkRecordStatus,
- cr.check_record_status_desc checkRecordStatusDesc,
- cu.user_id userId,
- cu.user_name userName
- from check_record cr
- left join check_project_item cpi on (cpi.source_id = cr.id and cpi.type = 'CHECK_RECORDS')
- left join check_user cu on (cu.source_id = cpi.id and cu.type = 'INSPECT_RECORDS_INSPECTION_ITEM_DETAILS')
- where 1 = 1
- <if test="specifiedDate != null">
- and cr.check_time >= #{specifiedDate}
- and cr.check_time <![CDATA[ < ]]> DATE_ADD(#{specifiedDate}, INTERVAL 1 DAY)
- </if>
- <if test="startDate != null and endDate != null">
- and (cr.check_time >= #{startDate}
- and cr.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- </select>
- <select id="homePageCheckCorrection"
- resultType="com.sundot.airport.check.domain.CheckLargeScreenHomePageCheckCorrectionSqlDto">
- select cc.id id,
- cc.document_code documentCode,
- cc.document_name documentName,
- cc.checker_id checkerId,
- cc.checker_name checkerName,
- date_format(cc.check_time, '%Y-%m-%d %H:%i:%s') checkTime,
- cc.check_level checkLevel,
- cc.check_level_desc checkLevelDesc,
- cc.checked_level checkedLevel,
- cc.checked_level_desc checkedLevelDesc,
- cc.checked_brigade_id checkedBrigadeId,
- cc.checked_brigade_name checkedBrigadeName,
- cc.checked_department_id checkedDepartmentId,
- cc.checked_department_name checkedDepartmentName,
- cc.checked_team_id checkedTeamId,
- cc.checked_team_name checkedTeamName,
- cc.checked_personnel_id checkedPersonnelId,
- cc.checked_personnel_name checkedPersonnelName,
- cc.checked_dept_id checkedDeptId,
- cc.checked_dept_name checkedDeptName,
- cc.responsible_user_id responsibleUserId,
- cc.responsible_user_name responsibleUserName,
- cc.process_status processStatus,
- cc.process_status_desc processStatusDesc,
- cc.instance_id instanceId,
- date_format(cc.completion_time, '%Y-%m-%d %H:%i:%s') completionTime,
- cu.user_id userId,
- cu.user_name userName
- from check_correction cc
- left join check_project_item cpi on (cpi.source_id = cc.id and cpi.type = 'CHECK_CORRECTION')
- left join check_user cu
- on (cu.source_id = cpi.id and cu.type = 'PROBLEM_RECTIFICATION_INSPECTION_ITEM_DETAILS')
- where 1 = 1
- <if test="specifiedDate != null">
- and DATE(cc.check_time) = DATE(#{specifiedDate})
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- </select>
- <select id="checkCorrectionCount"
- resultType="java.lang.Integer">
- select count(1)
- from check_correction cc
- where 1 = 1
- <if test="userId != null">
- and cc.checker_id = #{userId}
- </if>
- <if test="specifiedDate != null">
- and DATE(cc.check_time) = DATE(#{specifiedDate})
- </if>
- <if test="startDate != null and endDate != null">
- and (cc.check_time >= #{startDate}
- and cc.check_time <![CDATA[ < ]]> date_add(#{endDate} , interval 1 day))
- </if>
- </select>
- </mapper>
|