| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041 |
- <?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.daju.mix.dao.mapper.CimHomeMapper">
- <!--通过区域获取近30日内投诉和问题情况-->
- <select id="selectComplaintsInfoByRegion" resultType="java.util.Map">
- SELECT DATE_FORMAT(last30Day.tempDay, '%c.%e') AS xDay,
- (
- SELECT COUNT(1)
- FROM t_b_complaint AS plain
- WHERE DATEDIFF(
- last30Day.tempDay,
- plain.complaint_date
- ) = 0
- <if test="areaRegion != null and areaRegion != ''">
- AND plain.area = ${areaRegion}
- </if>
- AND plain.`status` = 4
- ) AS finishCount,
- (
- SELECT COUNT(1)
- FROM t_b_complaint AS plain
- WHERE DATEDIFF(
- last30Day.tempDay,
- plain.complaint_date
- ) = 0
- <if test="areaRegion != null and areaRegion != ''">
- AND plain.area = #{areaRegion}
- </if>
- ) AS totalCount
- FROM (SELECT ADDDATE(NOW(), INTERVAL -i DAY) AS tempDay
- FROM (
- SELECT @xi := @xi + 1 as i
- FROM (SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) xc1,
- (SELECT 1
- UNION
- SELECT 2
- UNION
- SELECT 3
- UNION
- SELECT 4
- UNION
- SELECT 5
- UNION
- SELECT 6) xc2,
- (SELECT @xi := -1) xc0
- ) xc
- ORDER BY tempDay DESC LIMIT 5) last30Day
- ORDER BY last30Day.tempDay ASC LIMIT 5
- </select>
- <select id="selectComplaintsInfoByRegion1" resultType="java.util.Map">
- SELECT DATE_FORMAT(last30Day.tempDay, '%c.%e') AS xDay,
- (
- SELECT COUNT(1)
- FROM t_b_complaint AS plain
- WHERE DATEDIFF(
- last30Day.tempDay,
- plain.complaint_date
- ) = 0
- <if test="areaRegion != null and areaRegion != ''">
- AND plain.area = ${areaRegion}
- </if>
- AND plain.`status` = 4
- ) AS finishCount,
- (
- SELECT COUNT(1)
- FROM t_b_complaint AS plain
- WHERE DATEDIFF(
- last30Day.tempDay,
- plain.complaint_date
- ) = 0
- <if test="areaRegion != null and areaRegion != ''">
- AND plain.area = #{areaRegion}
- </if>
- ) AS totalCount
- FROM (SELECT ADDDATE(NOW(), INTERVAL -i DAY) AS tempDay
- FROM (
- SELECT @xi := @xi + 1 as i
- FROM (SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) xc1,
- (SELECT 1
- UNION
- SELECT 2
- UNION
- SELECT 3
- UNION
- SELECT 4
- UNION
- SELECT 5
- UNION
- SELECT 6) xc2,
- (SELECT @xi := -1) xc0
- ) xc
- ORDER BY tempDay DESC LIMIT 1) last30Day
- ORDER BY last30Day.tempDay ASC LIMIT 1
- </select>
- <select id="selectInspectorLastFive" resultType="java.util.Map">
- SELECT DATE_FORMAT(last30Day.tempDay, '%c.%e') AS xDay,
- (
- SELECT COUNT(1)
- FROM t_b_schedule_superivse AS super
- WHERE DATEDIFF(
- last30Day.tempDay,
- super.supervise_date
- ) = 0
- <if test="areaRegion != null and areaRegion != ''">
- AND plain.area in ${areaRegion}
- </if>
- AND super.`status` = 3
- ) AS finishCount,
- (
- SELECT COUNT(1)
- FROM t_b_schedule_superivse AS super
- WHERE DATEDIFF(
- last30Day.tempDay,
- super.supervise_date
- ) = 0
- <if test="areaRegion != null and areaRegion != ''">
- AND super.area in ${areaRegion}
- </if>
- ) AS totalCount
- FROM (SELECT ADDDATE(NOW(), INTERVAL -i DAY) AS tempDay
- FROM (
- SELECT @xi := @xi + 1 as i
- FROM (SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) xc1,
- (SELECT 1
- UNION
- SELECT 2
- UNION
- SELECT 3
- UNION
- SELECT 4
- UNION
- SELECT 5
- UNION
- SELECT 6) xc2,
- (SELECT @xi := -1) xc0
- ) xc
- ORDER BY tempDay DESC LIMIT 5) last30Day
- ORDER BY last30Day.tempDay ASC LIMIT 5
- </select>
- <select id="selectInspectorLastOne" resultType="java.util.Map">
- SELECT DATE_FORMAT(last30Day.tempDay, '%c.%e') AS xDay,
- (
- SELECT COUNT(1)
- FROM t_b_schedule_superivse AS super
- WHERE DATEDIFF(
- last30Day.tempDay,
- super.supervise_date
- ) = 0
- <if test="areaRegion != null and areaRegion != ''">
- AND super.area in ${areaRegion}
- </if>
- AND super.`status` = 3
- ) AS finishCount,
- (
- SELECT COUNT(1)
- FROM t_b_schedule_superivse AS super
- WHERE DATEDIFF(
- last30Day.tempDay,
- super.supervise_date
- ) = 0
- <if test="areaRegion != null and areaRegion != ''">
- AND super.area in ${areaRegion}
- </if>
- ) AS totalCount
- FROM (SELECT ADDDATE(NOW(), INTERVAL -i DAY) AS tempDay
- FROM (
- SELECT @xi := @xi + 1 as i
- FROM (SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) xc1,
- (SELECT 1
- UNION
- SELECT 2
- UNION
- SELECT 3
- UNION
- SELECT 4
- UNION
- SELECT 5
- UNION
- SELECT 6) xc2,
- (SELECT @xi := -1) xc0
- ) xc
- ORDER BY tempDay DESC LIMIT 1) last30Day
- ORDER BY last30Day.tempDay ASC LIMIT 1
- </select>
- <!--通过区域获取近30日内垃圾排放量变化趋势-->
- <select id="selectRubbishesInfoByRegion" resultType="java.util.Map">
- SELECT DATE_FORMAT(last30Day.tempDay, '%c.%e') AS xDay,
- (
- SELECT IFNULL(SUM(gw.amount_weight), 0)
- FROM t_b_garbage_weight AS gw
- WHERE DATEDIFF(
- last30Day.tempDay,
- gw.weigh_time
- ) = 0
- AND gw.garbage_type = 2
- <if test="areaRegion != null and areaRegion != ''">
- AND gw.area_region = #{areaRegion}
- </if>
- ) AS wetWaste,
- (
- SELECT IFNULL(SUM(gw.amount_weight), 0)
- FROM t_b_garbage_weight AS gw
- WHERE DATEDIFF(
- last30Day.tempDay,
- gw.weigh_time
- ) = 0
- AND gw.garbage_type = 1
- <if test="areaRegion != null and areaRegion != ''">
- AND gw.area_region = #{areaRegion}
- </if>
- ) AS dryGarbage
- FROM (SELECT ADDDATE(NOW(), INTERVAL -i DAY) AS tempDay
- FROM (
- SELECT @xi := @xi + 1 as i
- FROM (SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) xc1,
- (SELECT 1
- UNION
- SELECT 2
- UNION
- SELECT 3
- UNION
- SELECT 4
- UNION
- SELECT 5
- UNION
- SELECT 6) xc2,
- (SELECT @xi := -1) xc0
- ) xc
- ORDER BY tempDay) last30Day
- ORDER BY last30Day.tempDay
- </select>
- <!--通过区域获取近30日内清洁指数变化趋势,0914 改 5日内-->
- <select id="selectClearingIndexByRegion" resultType="java.util.Map">
- SELECT DATE_FORMAT(last30Day.tempDay, '%c.%e') AS xDay,
- (
- SELECT SUM(tbcsc.done_count)/100
- FROM t_b_car_schedule_task_detail AS tbcstd
- left join t_b_car_schedule_count tbcsc on tbcsc.schedule_date = CONCAT(tbcstd.yearmonth,"-",tbcstd.code_day) and tbcsc.car_id = tbcstd.carid
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = tbcstd.pid
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE DATEDIFF(
- last30Day.tempDay,
- CONCAT(tbcstd.yearmonth,"-",tbcstd.code_day)
- ) = 0
- <if test="businessType != null and businessType != ''">
- AND cst.assignment_style = #{businessType}
- </if>
- <if test="areaRegionOld != null and areaRegionOld != ''">
- AND route.area_region = #{areaRegionOld}
- </if>
- ) AS completeCount,
- (
- SELECT COUNT(DISTINCT CONCAT(tbcstd.yearmonth,tbcstd.code_day,tbcstd.carid)) totalCount
- FROM t_b_car_schedule_task_detail AS tbcstd
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = tbcstd.pid
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE DATEDIFF(last30Day.tempDay, CONCAT(tbcstd.yearmonth,"-",tbcstd.code_day)) = 0
- <if test="businessType != null and businessType != ''">
- AND cst.assignment_style = #{businessType}
- </if>
- <if test="areaRegionOld != null and areaRegionOld != ''">
- AND route.area_region = #{areaRegionOld}
- </if>
- ) AS totalCount,
- (
- SELECT COUNT(1)
- FROM t_b_schedule_superivse AS super
- WHERE DATEDIFF(last30Day.tempDay, super.confirm_date) = 0 and super.status = '1'
- <if test="businessType != null and businessType != ''">
- AND super.type = #{businessType}
- </if>
- <if test="areaRegion != null and areaRegion != ''">
- AND super.area in ${areaRegion}
- </if>
- ) AS inspectCount,
- (
- SELECT COUNT(1)
- FROM t_b_complaint AS cpt
- WHERE DATEDIFF(last30Day.tempDay, cpt.complaint_date) = 0 and cpt.status = '1'
- <if test="businessType != null and businessType != ''">
- AND cpt.business_type = #{businessType}
- </if>
- <if test="areaRegionOld != null and areaRegionOld != ''">
- AND cpt.area = #{areaRegionOld}
- </if>
- ) AS complaintCount
- FROM (SELECT ADDDATE(NOW(), INTERVAL -i DAY) AS tempDay
- FROM (
- SELECT @xi := @xi + 1 AS i
- FROM (SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) xc1,
- (SELECT 1
- UNION
- SELECT 2
- UNION
- SELECT 3
- UNION
- SELECT 4
- UNION
- SELECT 5
- UNION
- SELECT 6) xc2,
- (SELECT 1
- UNION
- SELECT 2
- UNION
- SELECT 3
- UNION
- SELECT 4
- UNION
- SELECT 5
- UNION
- SELECT 6) xc3,
- (SELECT @xi := -1) xc0
- ) xc
- ORDER BY tempDay DESC
- LIMIT 5
- ) last30Day
- ORDER BY last30Day.tempDay ASC LIMIT 5
- </select>
- <!--进博 通过区域获取近30日内清洁指数变化趋势 -->
- <select id="selectClearingIndexByRegionJinBo" resultType="java.util.Map">
- SELECT DATE_FORMAT(last30Day.tempDay, '%c.%e') AS xDay,
- (
- SELECT COUNT(1)
- FROM t_b_car_schedule_task_arrange AS csta
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = csta.arrange_id
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE DATEDIFF(
- last30Day.tempDay,
- csta.date
- ) = 0
- <if test="businessType != null and businessType != ''">
- AND cst.assignment_style = #{businessType}
- </if>
- <if test="areaRegion != null and areaRegion != ''">
- AND route.area_region = #{areaRegion}
- </if>
- AND cst.STATUS = '2'
- ) AS completeCount,
- (
- SELECT COUNT(1)
- FROM t_b_car_schedule_task_arrange AS csta
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = csta.arrange_id
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE DATEDIFF(last30Day.tempDay, csta.date) = 0
- <if test="businessType != null and businessType != ''">
- AND cst.assignment_style = #{businessType}
- </if>
- <if test="areaRegion != null and areaRegion != ''">
- AND route.area_region = #{areaRegion}
- </if>
- ) AS totalCount,
- (
- SELECT COUNT(1)
- FROM t_b_schedule_superivse AS super
- WHERE DATEDIFF(last30Day.tempDay, super.confirm_date) = 0 and super.status = '3'
- <if test="businessType != null and businessType != ''">
- AND super.type = #{businessType}
- </if>
- <if test="areaRegion != null and areaRegion != ''">
- AND super.area = #{areaRegion}
- </if>
- ) AS inspectCount,
- (
- SELECT COUNT(1)
- FROM t_b_complaint AS cpt
- WHERE DATEDIFF(last30Day.tempDay, cpt.complaint_date) = 0 and cpt.status = '3'
- <if test="businessType != null and businessType != ''">
- AND cpt.business_type = #{businessType}
- </if>
- <if test="areaRegion != null and areaRegion != ''">
- AND cpt.area = #{areaRegion}
- </if>
- ) AS complaintCount
- FROM (SELECT ADDDATE(NOW(), INTERVAL -i DAY) AS tempDay
- FROM (
- SELECT @xi := @xi + 1 AS i
- FROM (SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) xc1,
- (SELECT 1
- UNION
- SELECT 2
- UNION
- SELECT 3
- UNION
- SELECT 4
- UNION
- SELECT 5
- UNION
- SELECT 6) xc2,
- (SELECT 1
- UNION
- SELECT 2
- UNION
- SELECT 3
- UNION
- SELECT 4
- UNION
- SELECT 5
- UNION
- SELECT 6) xc3,
- (SELECT @xi := -1) xc0
- ) xc
- ORDER BY tempDay DESC
- LIMIT 30
- ) last30Day
- ORDER BY last30Day.tempDay ASC LIMIT 30
- </select>
- <!--通过区域获取近5日内清洁指数-->
- <select id="selectLast5DayClearingIndexByRegion" resultType="java.util.Map">
- SELECT SUM(completeCount) AS completeCount,
- SUM(totalCount) AS totalCount,
- SUM(inspectCount) AS inspectCount,
- SUM(complaintCount) AS complaintCount
- FROM (
- SELECT DATE_FORMAT(last5Day.tempDay, '%c.%e') AS xDay,
- (
- SELECT
- SELECT SUM(tbcsc.done_count)/100 completeCount
- FROM t_b_car_schedule_task_detail AS tbcstd
- left join t_b_car_schedule_count tbcsc on tbcsc.schedule_date = CONCAT(tbcstd.yearmonth,"-",tbcstd.code_day) and tbcsc.car_id = tbcstd.carid
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = tbcstd.pid
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE DATEDIFF(
- last5Day.tempDay,
- CONCAT(tbcstd.yearmonth,"-",tbcstd.code_day)
- ) = 0
- <if test="businessType != null and businessType != ''">
- AND cst.assignment_style = #{businessType}
- </if>
- <if test="areaRegion != null and areaRegion != ''">
- AND route.area_region = #{areaRegion}
- </if>
- AND cst.STATUS = '2'
- ) AS completeCount,
- (
- SELECT COUNT(DISTINCT CONCAT(tbcstd.yearmonth,tbcstd.code_day,tbcstd.carid)) totalCount
- FROM t_b_car_schedule_task_detail AS tbcstd
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = tbcstd.pid
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE DATEDIFF(last5Day.tempDay, CONCAT(tbcstd.yearmonth,"-",tbcstd.code_day)) = 0
- <if test="businessType != null and businessType != ''">
- AND cst.assignment_style = #{businessType}
- </if>
- <if test="areaRegion != null and areaRegion != ''">
- AND route.area_region = #{areaRegion}
- </if>
- ) AS totalCount,
- (
- SELECT COUNT(1)
- FROM t_b_schedule_superivse AS super
- WHERE DATEDIFF(last5Day.tempDay, super.confirm_date) = 0
- <if test="businessType != null and businessType != ''">
- AND super.type = #{businessType}
- </if>
- <if test="areaRegion != null and areaRegion != ''">
- AND super.area in ${areaRegion}
- </if>
- ) AS inspectCount,
- (
- SELECT COUNT(1)
- FROM t_b_complaint AS cpt
- WHERE DATEDIFF(last5Day.tempDay, cpt.complaint_date) = 0
- <if test="businessType != null and businessType != ''">
- AND cpt.business_type = #{businessType}
- </if>
- <if test="areaRegion != null and areaRegion != ''">
- AND cpt.area = #{areaRegion}
- </if>
- ) AS complaintCount
- FROM (SELECT ADDDATE(NOW(), INTERVAL -i DAY) AS tempDay
- FROM (
- SELECT @xi := @xi + 1 AS i
- FROM (SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) xc1,
- (SELECT @xi := -1) xc0
- ) xc
- ORDER BY tempDay DESC
- ) last5Day
- ORDER BY last5Day.tempDay DESC
- ) as a
- </select>
- <!--1920通过区域获取近1日内清洁指数-->
- <select id="selectOneDayClearingIndexByRegion1920" resultType="java.util.Map">
- select * from (
- SELECT SUM(tbcsc.done_count)/100 completeCount
- FROM t_b_car_schedule_task_detail AS tbcstd
- left join t_b_car_schedule_count tbcsc on tbcsc.schedule_date = CONCAT(tbcstd.yearmonth,"-",tbcstd.code_day) and tbcsc.car_id = tbcstd.carid
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = tbcstd.pid
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE CONCAT(tbcstd.yearmonth,"-",tbcstd.code_day) = CURRENT_DATE()
- <if test="regionCode != null and regionCode != ''">
- AND route.area_region = #{regionCode}
- </if>
- ) AS a,
- (
- SELECT COUNT(DISTINCT CONCAT(tbcstd.yearmonth,tbcstd.code_day,tbcstd.carid)) totalCount
- FROM t_b_car_schedule_task_detail AS tbcstd
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = tbcstd.pid
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE CONCAT(tbcstd.yearmonth,"-",tbcstd.code_day) = CURRENT_DATE()
- <if test="regionCode != null and regionCode != ''">
- AND route.area_region = #{regionCode}
- </if>
- ) AS b,
- (
- SELECT COUNT(1) inspectCount
- FROM t_b_schedule_superivse AS super
- WHERE super.supervise_date = CURRENT_DATE()
- <if test="r1 != null and r1 != ''">
- AND super.area = #{r1}
- </if>
- <if test="r2 != null and r2 != ''">
- or super.area = #{r2}
- </if>
- <if test="r3 != null and r3 != ''">
- or super.area = #{r3}
- </if>
- ) AS c,
- (
- SELECT COUNT(1) completeInspectCount
- FROM t_b_schedule_superivse AS super
- WHERE super.supervise_date = CURRENT_DATE()
- <if test="r1 != null and r1 != ''">
- AND super.area = #{r1}
- </if>
- <if test="r2 != null and r2 != ''">
- or super.area = #{r2}
- </if>
- <if test="r3 != null and r3 != ''">
- or super.area = #{r3}
- </if>
- AND super.status = '1'
- ) AS d,
- (
- SELECT COUNT(1) complaintCount
- FROM t_b_complaint AS cpt
- WHERE DATEDIFF(CURDATE(), cpt.complaint_date) = 0
- <if test="regionCode != null and regionCode != ''">
- AND cpt.area = #{regionCode}
- </if>
- ) AS e,
- (
- SELECT COUNT(1) completeComplaintCount
- FROM t_b_complaint AS cpt
- WHERE DATEDIFF(CURDATE(), cpt.complaint_date) = 0
- <if test="regionCode != null and regionCode != ''">
- AND cpt.area = #{regionCode}
- </if>
- AND cpt.status = '1'
- ) AS f
- </select>
- <!--3840通过区域获取近1日内清洁指数-->
- <select id="selectOneDayClearingIndexByRegion" resultType="java.util.Map">
- select *
- from (
- SELECT SUM(tbcsc.done_count)/100 completeCount
- FROM t_b_car_schedule_task_detail AS tbcstd
- left join t_b_car_schedule_count tbcsc on tbcsc.schedule_date = CONCAT(tbcstd.yearmonth,"-",tbcstd.code_day) and tbcsc.car_id = tbcstd.carid
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = tbcstd.pid
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE CONCAT(tbcstd.yearmonth,"-",tbcstd.code_day) = CURRENT_DATE()
- AND route.area_region = 1
- ) AS a,
- (
- SELECT COUNT(DISTINCT CONCAT(tbcstd.yearmonth,tbcstd.code_day,tbcstd.carid)) totalCount
- FROM t_b_car_schedule_task_detail AS tbcstd
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = tbcstd.pid
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE CONCAT(tbcstd.yearmonth,"-",tbcstd.code_day) = CURRENT_DATE()
- AND route.area_region = 1
- ) AS b,
- (
- SELECT COUNT(1) inspectCount
- FROM t_b_schedule_superivse AS super
- WHERE TO_DAYS(super.supervise_date) = TO_DAYS(NOW())
- AND super.area in (5,6,7)
- ) AS c,
- (
- SELECT COUNT(1) completeInspectCount
- FROM t_b_schedule_superivse AS super
- WHERE DATEDIFF(CURDATE(), super.supervise_date) = 0
- AND super.area in (5,6,7)
- AND super.status = 1
- ) AS d,
- (
- SELECT COUNT(1) complaintCount
- FROM t_b_complaint AS cpt
- WHERE DATEDIFF(CURDATE(), cpt.complaint_date) = 0
- AND cpt.area = 1
- ) AS e,
- (
- SELECT COUNT(1) completeComplaintCount
- FROM t_b_complaint AS cpt
- WHERE DATEDIFF(CURDATE(), cpt.complaint_date) = 0
- AND cpt.area = 1
- AND cpt.status = 3
- ) AS f
- </select>
- <!-- 3840 当日督查问题 -->
- <select id="todayInspectInfo" resultType="com.daju.mix.dto.TodayProblemSummaryDto">
- SELECT create_date time, context info, status state
- FROM t_b_schedule_superivse
- WHERE TO_DAYS(supervise_date) = TO_DAYS(NOW())
- </select>
- <select id="inspectInfoKy" resultType="com.daju.mix.dto.ProblemKy">
- SELECT code code, context content, status status
- FROM t_b_schedule_superivse
- WHERE TO_DAYS(supervise_date) = TO_DAYS(NOW())
- </select>
- <!-- 3840 当日投诉问题 -->
- <select id="todayComplainInfo" resultType="com.daju.mix.dto.TodayProblemSummaryDto">
- SELECT complaint_date time, complaint_context info, status status
- FROM t_b_complaint
- WHERE TO_DAYS(complaint_date) = TO_DAYS(NOW())
- AND status = 3
- </select>
- <select id="complainInfoKy" resultType="com.daju.mix.dto.ProblemKy">
- SELECT code code, complaint_context content, status state
- FROM t_b_complaint
- WHERE TO_DAYS(complaint_date) = TO_DAYS(NOW())
- AND status = 3
- </select>
- <!-- 3840 当日警报问题 -->
- <select id="todayWorkingAlertInfo" resultType="com.daju.mix.dto.AlarmDto">
- SELECT tba.alarm_time time, tba.context info
- FROM t_b_car_schedule_task_arrange AS csta
- LEFT JOIN t_b_car_schedule_task AS cst
- ON cst.id = csta.arrange_id
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- LEFT JOIN t_b_alarm AS tba ON csta.user_id = tba.alarm_user
- WHERE csta.create_date = TO_DAYS(CURDATE())
- AND tba.alarm_time = TO_DAYS(CURDATE())
- AND route.area_region = 3
- </select>
- <!-- to ky 当日人员/车辆排班 -->
- <select id="todayPersonScheduler" resultType="com.daju.mix.dto.TodaySchedulerDto">
- select td.username name, ts.type jobTask, ts.work_time time
- from t_b_car_schedule_task_detail td
- left join t_b_car_schedule_task ts
- on td.pid = ts.id
- left join t_personnel_real_position trp on td.user_id = trp.person_id
- where TO_DAYS(CONCAT(td.yearmonth
- , '-'
- , td.code_day)) = TO_DAYS(NOW())
- and td.username != ''
- and TO_DAYS(trp.gps_time) = TO_DAYS(NOW())
- </select>
- <select id="todayCarScheduler" resultType="com.daju.mix.dto.TodaySchedulerDto">
- select tc.plate name, ts.type jobTask, ts.work_time time
- from t_b_car_schedule_task_detail td
- left join t_b_car_schedule_task ts
- on td.pid = ts.id
- left join t_b_car tc on tc.id = td.carid
- left join t_b_car_now tn on tn.carid = td.carid
- where TO_DAYS(CONCAT(td.yearmonth
- , '-'
- , td.code_day)) = TO_DAYS(NOW())
- and tc.plate != ''
- and TO_DAYS(tn.gps_time) = TO_DAYS(NOW())
- </select>
- <!-- 1920 近六个月碳排放量变化趋势 -->
- <select id="getOilSix" resultType="com.daju.mix.dto.OilSixDTO">
- SELECT DATE_FORMAT(
- last6Month.tempMonth,
- '%c月'
- ) AS xLabels,
- IFNULL(
- (
- SELECT SUM(gas.quantity)
- FROM
- t_b_car_gas_refuel AS gas
- RIGHT JOIN (
- SELECT route.area_region,
- csta.carid carid,
- CONCAT(csta.yearmonth,'-',csta.code_day) date
- FROM t_b_car_schedule_task_detail AS csta
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = csta.pid
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE csta.carid IS NOT NULL
- <if test="areaRegion != null and areaRegion != ''">
- AND route.area_region = #{areaRegion}
- </if>
- GROUP BY csta.carid,
- CONCAT(csta.yearmonth,'-',csta.code_day)
- ) AS areaCar
- ON (
- areaCar.carid = gas.car_id
- AND DATEDIFF(areaCar.date, gas.refuel_date) = 0
- )
- WHERE DATE_FORMAT(
- last6Month.tempMonth, '%Y.%m') = DATE_FORMAT(gas.refuel_date, '%Y.%m')),0
- ) AS chartValues
- FROM (
- SELECT ADDDATE(NOW(), INTERVAL - i MONTH) AS tempMonth
- FROM (
- SELECT 0 as i
- UNION
- SELECT 1
- UNION
- SELECT 2
- UNION
- SELECT 3
- UNION
- SELECT 4
- UNION
- SELECT 5
- UNION
- SELECT 6) xc
- ORDER BY tempMonth DESC
- ) last6Month
- ORDER BY last6Month.tempMonth asc LIMIT 6
- </select>
- <!-- 获取近6月环卫车辆排放变化趋势信息-->
- <select id="selectCarCEmissionByRegion" resultType="java.util.Map">
- SELECT DATE_FORMAT(
- last6Month.tempMonth,
- '%c月'
- ) AS xMonth,
- IFNULL(
- (
- SELECT SUM(gas.total_oil)
- FROM
- t_b_car_gas_statistics AS gas
- RIGHT JOIN (
- SELECT route.area_region,
- csta.carid,
- CONCAT(csta.yearmonth,'-',csta.code_day) date
- FROM t_b_car_schedule_task_detail AS csta
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = csta.pid
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE csta.carid IS NOT NULL
- <if test="areaRegion != null and areaRegion != ''">
- AND route.area_region = #{areaRegion}
- </if>
- GROUP BY csta.carid,
- CONCAT(csta.yearmonth,'-',csta.code_day)
- ) AS areaCar ON (
- areaCar.carid = gas.car_id
- AND DATEDIFF(areaCar.date, gas.end_date) = 0
- )
- WHERE DATE_FORMAT(
- last6Month.tempMonth,
- '%Y.%m'
- ) = DATE_FORMAT(gas.end_date, '%Y.%m')
- ),
- 0
- ) AS thisYearTotalOil,
- IFNULL(
- (
- SELECT SUM(m.mileage)
- FROM
- t_b_car_mileage_day AS m
- RIGHT JOIN (
- SELECT route.area_region,
- csta.carid,
- CONCAT(csta.yearmonth,'-',csta.code_day) date
- FROM t_b_car_schedule_task_detail AS csta
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = csta.pid
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE csta.carid IS NOT NULL
- <if test="areaRegion != null and areaRegion != ''">
- AND route.area_region = #{areaRegion}
- </if>
- GROUP BY csta.carid,
- CONCAT(csta.yearmonth,'-',csta.code_day)
- ) AS areaCar ON (
- areaCar.carid = m.car_id
- AND DATEDIFF(areaCar.date, m.date) = 0
- )
- WHERE DATE_FORMAT(
- last6Month.tempMonth,
- '%Y.%m'
- ) = DATE_FORMAT(m.date, '%Y.%m')
- ),
- 0
- ) AS thisYearMileage,
- IFNULL(
- (
- SELECT SUM(gas.total_oil)
- FROM
- t_b_car_gas_statistics AS gas
- RIGHT JOIN (
- SELECT route.area_region,
- csta.carid,
- CONCAT(csta.yearmonth,'-',csta.code_day) date
- FROM t_b_car_schedule_task_detail AS csta
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = csta.pid
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE csta.carid IS NOT NULL
- <if test="areaRegion != null and areaRegion != ''">
- AND route.area_region = #{areaRegion}
- </if>
- GROUP BY csta.carid,
- CONCAT(csta.yearmonth,'-',csta.code_day)
- ) AS areaCar ON (
- areaCar.carid = gas.car_id
- AND DATEDIFF(areaCar.date, gas.end_date) = 0
- )
- WHERE DATE_FORMAT(
- ADDDATE(
- last6Month.tempMonth,
- INTERVAL - 1 YEAR
- ),
- '%Y.%m'
- ) = DATE_FORMAT(gas.start_date, '%Y.%m')
- ),
- 0
- ) AS lastYearTotalOil,
- IFNULL(
- (
- SELECT SUM(m.mileage)
- FROM
- t_b_car_mileage_day AS m
- RIGHT JOIN (
- SELECT route.area_region,
- csta.carid,
- CONCAT(csta.yearmonth,'-',csta.code_day) date
- FROM t_b_car_schedule_task_detail AS csta
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = csta.pid
- LEFT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE csta.carid IS NOT NULL
- <if test="areaRegion != null and areaRegion != ''">
- AND route.area_region = #{areaRegion}
- </if>
- GROUP BY csta.carid,
- CONCAT(csta.yearmonth,'-',csta.code_day)
- ) AS areaCar ON (
- areaCar.carid = m.car_id
- AND DATEDIFF(areaCar.date, m.date) = 0
- )
- WHERE DATE_FORMAT(
- ADDDATE(
- last6Month.tempMonth,
- INTERVAL - 1 YEAR
- ),
- '%Y.%m'
- ) = DATE_FORMAT(m.date, '%Y.%m')
- ),
- 0
- ) AS lastYearMileage
- FROM (
- SELECT ADDDATE(NOW(), INTERVAL - i MONTH) AS tempMonth
- FROM (
- SELECT 0 as i
- UNION
- SELECT 1
- UNION
- SELECT 2
- UNION
- SELECT 3
- UNION
- SELECT 4
- UNION
- SELECT 5
- UNION
- SELECT 6) xc
- ORDER BY tempMonth DESC
- ) last6Month
- ORDER BY last6Month.tempMonth asc LIMIT 6
- </select>
- <!--通过区域获取近5日内投诉和问题总数-->
- <select id="selectLast5DayComplainCount" resultType="java.util.Map">
- SELECT * FROM
- (
- SELECT COUNT(1) AS totalCount
- FROM t_b_complaint AS a
- WHERE a.complaint_date >= DATE_ADD(NOW(),INTERVAL -5 DAY)
- <if test="areaRegion != null and areaRegion != ''">
- AND a.area = #{areaRegion}
- </if>
- ) a
- ,
- (
- SELECT COUNT(1) AS solveCount
- FROM t_b_complaint AS a
- WHERE a.complaint_date >= DATE_ADD(NOW(),INTERVAL -5 DAY)
- AND a.`status` = 4
- <if test="areaRegion != null and areaRegion != ''">
- AND a.area = #{areaRegion}
- </if>
- ) b
- </select>
- <!--根据id获取投诉详情-->
- <select id="selectComplainById" resultType="java.util.Map">
- SELECT
- complaint_date complaintDate,
- complaint_context complaintContext,
- complaint_location complaintLocation,
- depart_id departName,
- IFNULL(img_url,photos) imgUrl,
- videos videoUrlList,
- (
- SELECT
- typename
- FROM
- t_s_type
- WHERE
- typegroupid IN (
- SELECT
- id
- FROM
- t_s_typegroup
- WHERE
- typegroupcode = "complaintFrom"
- )
- AND typecode = tbc.complaint_from
- ) complaintFromName,
- (
- SELECT
- typename
- FROM
- t_s_type
- WHERE
- typegroupid IN (
- SELECT
- id
- FROM
- t_s_typegroup
- WHERE
- typegroupcode = "complainType"
- )
- AND typecode = tbc.type
- ) complaintType,
- (
- SELECT
- typename
- FROM
- t_s_type
- WHERE
- typegroupid IN (
- SELECT
- id
- FROM
- t_s_typegroup
- WHERE
- typegroupcode = "complaintCorrectionState"
- )
- AND typecode = tbc.`status`
- ) complaintStatus
- FROM
- t_b_complaint tbc
- WHERE
- tbc.id = #{id}
- </select>
- <!--根据id获取投诉整改详情-->
- <select id="selectComplainRecordById" resultType="java.util.Map">
- SELECT img_url imgUrl,complaint_date complaintDate,remark
- FROM t_b_complaint_record
- WHERE complaint_id = #{id}
- </select>
- <!--根据id获取督查详情-->
- <select id="selectInspectorById" resultType="java.util.Map">
- SELECT
- supervise_date superviseDate,
- img_url imgUrl,
- videos videoUrlList,
- result_url resultUrl,
- (select realname from t_s_base_user where id = user_id LIMIT 1) superviseUserName,
- (select typename from t_s_type where typegroupid in (select id from t_s_typegroup where typegroupcode = "complaintFrom") and typecode = type) type,
- (select typename from t_s_type where typegroupid in (select id from t_s_typegroup where typegroupcode = "complainType") and typecode = source) source,
- (select typename from t_s_type where typegroupid in (select id from t_s_typegroup where typegroupcode = "superivseArea") and typecode = area) area,
- location,
- context,
- (select realname from t_s_base_user where id = responsible_user_id LIMIT 1) responsibleUserName,
- (select realname from t_s_base_user where id = leader_user_id LIMIT 1) leaderUserName,
- (select typename from t_s_type where typegroupid in (select id from t_s_typegroup where typegroupcode = "superivseStatus") and typecode = `status`) superviseStatus
- FROM
- t_b_schedule_superivse
- WHERE id = #{id}
- </select>
- <!--根据id获取督查整改详情-->
- <select id="selectInspectorRecordById" resultType="java.util.Map">
- SELECT
- deal_date dealDate,
- img_url imgUrl
- FROM
- t_b_schedule_superivse_record
- WHERE supervise_id = #{id}
- </select>
- <!--通过区域获取近5日内督查问题总数-->
- <select id="selectLast5DayInspectorCount" resultType="java.util.Map">
- SELECT * FROM
- (
- SELECT COUNT(1) AS totalCount
- FROM t_b_schedule_superivse AS s
- WHERE s.supervise_date >= DATE_ADD(NOW(),INTERVAL -5 DAY)
- <if test="areaRegion != null and areaRegion != ''">
- AND s.area in ${areaRegion}
- </if>
- ) a
- ,
- (
- SELECT COUNT(1) AS finishCount
- FROM t_b_schedule_superivse AS s
- WHERE s.supervise_date >= DATE_ADD(NOW(),INTERVAL -5 DAY)
- AND s.status = 5
- <if test="areaRegion != null and areaRegion != ''">
- AND s.area in ${areaRegion}
- </if>
- ) b
- </select>
- <!--通过作业类型获取近5日内投诉和问题总数-->
- <select id="selectLast5DayComplainCountByBusinessType" resultType="java.util.Map">
- SELECT (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'complainType'
- AND c.type = type.typecode
- ) AS complainType,
- COUNT(1) AS indexData,
- (
- SELECT COUNT(1)
- FROM t_b_complaint AS a
- WHERE a.complaint_date >= DATE_ADD(NOW(),INTERVAL -5 DAY)
- AND a.`status` = 4
- <if test="businessType != null and businessType != ''">
- AND a.type = #{businessType}
- </if>
- <if test="regionType != null and regionType != ''">
- AND a.area = #{regionType}
- </if>
- AND a.type = c.type
- ) AS solveCount
- FROM t_b_complaint AS c
- WHERE c.complaint_date >= DATE_ADD(NOW(),INTERVAL -5 DAY)
- <if test="businessType != null and businessType != ''">
- AND c.type = #{businessType}
- </if>
- <if test="regionType != null and regionType != ''">
- AND c.area = #{regionType}
- </if>
- GROUP BY c.type
- </select>
- <!--3840通过作业类型获取近5日内投诉和问题总数-->
- <select id="selectLast5DayComplainCountByBusinessType3840" resultType="java.util.Map">
- select tst.typename complainType, ifnull(sas.indexData, 0) indexData, ifnull(sas.solveCount, 0) solveCount
- from (SELECT (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'complainType'
- AND c.type = type.typecode
- ) AS complainType,
- COUNT(1) AS indexData,
- (
- SELECT COUNT(1)
- FROM t_b_complaint AS a
- WHERE a.complaint_date >= DATE_ADD(NOW(), INTERVAL - #{num} DAY)
- AND a.status = 4
- AND a.area = 3
- AND a.type = c.type
- ) AS solveCount
- FROM t_b_complaint AS c
- WHERE c.complaint_date >= DATE_ADD(NOW(), INTERVAL - #{num} DAY)
- AND c.area = 3
- GROUP BY c.type) sas
- right join (select typename from t_s_type where typegroupid = 'ff8080817b3a196e017b428f6c130016') tst
- on tst.typename = sas.complainType
- </select>
- <!-- 获取近 5 日督查问题类型统计信息 -->
- <select id="selectLast5DayInspectorTypeCount" resultType="java.util.Map">
- SELECT (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'complainType'
- AND superivse.source = type.typecode
- ) AS superivseType,
- COUNT(1) AS totalCount,
- (
- SELECT COUNT(1)
- FROM t_b_schedule_superivse AS ss
- WHERE ss.supervise_date >= DATE_ADD(NOW(), INTERVAL - #{num} DAY)
- AND ss.`status` = 3
- AND ss.source = superivse.source
- ) AS solveCount
- FROM t_b_schedule_superivse AS superivse
- WHERE superivse.supervise_date >= DATE_ADD(NOW(), INTERVAL - #{num} DAY)
- GROUP BY superivse.type
- </select>
- <!-- 3840获取近 5 日督查问题类型统计信息 -->
- <select id="selectLast5DayInspectorTypeCount3840" resultType="java.util.Map">
- select tst.typename superivseType, ifnull(sas.totalCount, 0) totalCount, ifnull(sas.solveCount, 0) solveCount
- from (SELECT (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'complainType'
- AND superivse.source = type.typecode
- ) AS superivseType,
- COUNT(1) AS totalCount,
- (
- SELECT COUNT(1)
- FROM t_b_schedule_superivse AS ss
- WHERE ss.supervise_date >= DATE_ADD(NOW(), INTERVAL - #{num} DAY)
- AND ss.`status` = 3
- AND ss.source = superivse.source
- ) AS solveCount
- FROM t_b_schedule_superivse AS superivse
- WHERE superivse.supervise_date >= DATE_ADD(NOW(), INTERVAL - #{num} DAY)
- GROUP BY superivse.source) sas
- right join (select typename from t_s_type where typegroupid = 'ff8080817b3a196e017b428f6c130016') tst
- on tst.typename = sas.superivseType
- </select>
- <!--通过作业区域获取近5日内督查问题总数-->
- <select id="selectSuperivseCountLast5Day" resultType="java.util.Map">
- SELECT (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'superivseArea'
- AND superivse.area = type.typecode
- ) AS superivseArea,
- COUNT(1) AS totalCount,
- (
- SELECT COUNT(1)
- FROM t_b_schedule_superivse AS ss
- WHERE DATEDIFF(ss.supervise_date, NOW()) <![CDATA[<]]> 5
- AND ss.`status` = 2
- <if test="businessType != null and businessType != ''">
- AND ss.type = #{businessType}
- </if>
- AND ss.area = superivse.area
- ) AS solveCount
- FROM t_b_schedule_superivse AS superivse
- WHERE DATEDIFF(superivse.supervise_date, NOW()) <![CDATA[<]]> 5
- <if test="businessType != null and businessType != ''">
- AND superivse.type = #{businessType}
- </if>
- <if test="regionType != null and regionType != ''">
- AND superivse.area in ${regionType}
- </if>
- GROUP BY ceil((superivse.area - 1) / 3)
- </select>
- <!--通过区域获取近5日内投诉和问题明细-->
- <select id="selectLast5DayComplainList" resultType="com.daju.mix.dto.CimLast5ComplainDto">
- SELECT p.id,
- p.complaint_context AS complainContent,
- (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'complaintFrom'
- AND p.complaint_from = type.typecode
- ) AS complainSource,
- IFNULL(
- DATE_FORMAT(p.deal_date, '%Y.%m.%d'),
- '未解决'
- ) AS solveTime
- FROM t_b_complaint AS p
- WHERE p.complaint_date >= DATE_ADD(NOW(),INTERVAL -5 DAY)
- <if test="areaRegion != null and areaRegion != ''">
- AND p.area = #{areaRegion}
- </if>
- </select>
- <!--通过区域获取近5日内督查问题明细-->
- <select id="selectLast5DayInspectorList" resultType="com.daju.mix.dto.CimLast5InspectorDto">
- SELECT superivse.id,
- superivse.location AS problemLocation,
- DATE_FORMAT(superivse.supervise_date, '%Y.%m.%d') AS reportTime,
- IFNULL(
- DATE_FORMAT(superivse.deal_date, '%Y.%m.%d'),
- '未解决'
- ) AS solveTime
- FROM t_b_schedule_superivse AS superivse
- WHERE superivse.supervise_date >= DATE_ADD(NOW(),INTERVAL -5 DAY)
- <if test="areaRegion != null and areaRegion != ''">
- AND superivse.area in ${areaRegion}
- </if>
- </select>
- <!--通过类型获取近5日内投诉和问题明细-->
- <select id="selectLast5DayComplainListByBusinessType" resultType="com.daju.mix.dto.CimLast5ComplainTypeDto">
- SELECT p.id,
- p.`code` AS complaintCode,
- (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'complainType'
- AND p.type = type.typecode
- ) AS complaintType,
- p.complaint_context AS complainContent,
- DATE_FORMAT(
- p.complaint_date,
- '%Y.%m.%d'
- ) AS complaintTime,
- IFNULL(
- DATE_FORMAT(p.deal_date, '%Y.%m.%d'),
- ''
- ) AS dealDate,
- IFNULL(
- DATE_FORMAT(p.confirm_date, '%Y.%m.%d'),
- ''
- ) AS confirmDate,
- CASE p.`status`
- WHEN '1' THEN
- '整改中'
- WHEN '2' THEN
- '待确认'
- WHEN '3' THEN
- '已整改'
- ELSE
- '整改中'
- END AS solveState
- FROM t_b_complaint AS p
- WHERE DATEDIFF(p.complaint_date, NOW()) <![CDATA[<]]> 5
- <if test="businessType != null and businessType != ''">
- AND p.type = #{businessType}
- </if>
- <if test="regionType != null and regionType != ''">
- AND p.area = #{regionType}
- </if>
- </select>
- <!--通过类型作业区域分组获取近5日内督查问题明细-->
- <select id="selectSuperviseLast5DayList" resultType="com.daju.mix.dto.CimLast5SuperivseTypeDto">
- SELECT ss.id,
- ss.`code` AS inspectorCode,
- ss.location AS regionName,
- (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'superivseType'
- AND ss.type = type.typecode
- ) AS problemType,
- CASE ss.`status`
- WHEN '1' THEN
- '整改中'
- WHEN '2' THEN
- '待确认'
- WHEN '3' THEN
- '已整改'
- ELSE
- '整改中'
- END AS solveState
- FROM t_b_schedule_superivse AS ss
- WHERE DATEDIFF(ss.supervise_date, NOW()) <![CDATA[<]]> 5
- <if test="businessType != null and businessType != ''">
- AND ss.type = #{businessType}
- </if>
- <if test="regionType != null and regionType != ''">
- AND ss.area in ${regionType}
- </if>
- </select>
- <!--获取今日作业车辆行驶距离-->
- <select id="getTodayDrivingDistance" resultType="double">
- SELECT IFNULL(SUM(m.mileage), 0) AS todayDrivingDistance
- FROM
- t_b_car_mileage_day AS m
- <if test="areaRegion != null and areaRegion != ''">
- RIGHT JOIN (
- SELECT csta.carid
- FROM t_b_car_schedule_task_detail AS csta
- LEFT JOIN t_b_car_schedule_task AS cst ON cst.id = csta.pid
- RIGHT JOIN t_b_work_route AS route ON route.id = cst.work_route
- WHERE CONCAT(csta.yearmonth,'-',csta.code_day) = CURRENT_DATE()
- AND route.area_region = #{areaRegion}
- GROUP BY csta.carid
- ) AS car ON m.car_id = car.carid
- </if>
- WHERE DATEDIFF(m.date, NOW()) = 0
- </select>
- <!--1920获取今日作业指定车辆信息-->
- <select id="getVehiclesInfoByCarid1920" resultType="java.util.Map">
- SELECT car.id id,
- IF(car.image IS NULL OR car.image = "","",CONCAT('http://47.100.210.233/',car.image)) photo,
- car.plate plateNum,
- (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'cartype'
- AND car.type = type.typecode
- ) AS vehicleType,
- (
- select count(1) from t_b_alarm where alarm_car = #{userId} and TO_DAYS(NOW()) = TO_DAYS(alarm_time)
- ) AS alertCount,
- gas.hundred_km_oil AS oilConsumption,
- tc.work_route AS workingLine,
- ifnull(car.video_provider, "未录入") AS videoProvider
- FROM t_b_car AS car
- LEFT JOIN t_b_car_gas_statistics AS gas ON gas.car_id = car.id
- LEFT JOIN t_b_car_schedule AS tc ON tc.carid = car.id
- WHERE car.id = #{userId} limit 1
- </select>
- <!--1920获取今日作业指定车辆信息-->
- <!--<select id="getVehiclesInfoByCarid1920" resultType="java.util.Map">
- SELECT car.id id, car.plate plateNum,
- (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'cartype'
- AND car.type = type.typecode
- ) AS vehicleType,
- (
- SELECT COUNT(1)
- FROM t_b_alarm AS a
- WHERE DATEDIFF(now(), a.alarm_time) = 0
- ) AS alertCount,
- gas.hundred_km_oil AS oilConsumption,
- ts.work_route AS workingLine
- FROM t_b_car AS car
- LEFT JOIN t_b_car_gas_statistics AS gas ON gas.car_id = car.id
- LEFT JOIN t_b_car_schedule AS ts ON ts.carid = car.id
- WHERE car.id = #{userId}
- </select>-->
- <!--获取今日作业指定车辆信息-->
- <select id="getVehiclesInfoByCarid" resultType="java.util.Map">
- SELECT car.id id,
- ifnull(CONCAT('http://47.100.210.233/', car.image), "") photo,
- car.plate plateNum,
- (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'cartype'
- AND car.type = type.typecode
- ) AS vehicleType,
- (
- SELECT COUNT(1)
- FROM t_b_alarm AS a
- WHERE DATEDIFF(now(), a.alarm_time) = 0
- ) AS alertCount,
- gas.hundred_km_oil AS oilConsumption,
- ts.work_route AS workingLine,
- ifnull(car.video_provider, "未录入") AS videoProvider
- FROM t_b_car AS car
- LEFT JOIN t_b_car_gas_statistics AS gas ON gas.car_id = car.id
- LEFT JOIN t_b_car_schedule AS ts ON ts.carid = car.id
- WHERE car.id = #{userId}
- </select>
- <select id="getElementGpsInCarData" resultType="java.util.Map">
- SELECT
- tbc.id id,
- tbc.plate `name`,
- '2' elementType,
- tbc.area_region regionCode,
- tbcn.lng longitude,
- tbcn.lat latitude,
- tbcn.gps_time gpsTime
- FROM
- t_b_car_now tbcn
- LEFT JOIN t_b_car tbc ON tbc.id = tbcn.carid
- WHERE
- tbc.id IS NOT NULL
- <if test="areaRegion != null and areaRegion != ''">
- AND tbc.area_region = #{areaRegion}
- </if>
- ORDER BY
- tbc.area_region,
- tbcn.gps_time DESC;
- </select>
- <select id="getElementGpsInUserData" resultType="java.util.Map">
- SELECT
- tsbu.id id,
- tsbu.realname `name`,
- '1' elementType,
- tsu.area_region regionCode,
- tprp.longitude_wgs84 longitude,
- tprp.latitude_wgs84 latitude,
- tprp.gps_time gpsTime
- FROM
- t_personnel_real_position tprp
- LEFT JOIN t_s_base_user tsbu ON tsbu.id = tprp.person_id
- LEFT JOIN t_s_user tsu ON tsu.id = tsbu.id
- WHERE
- tsbu.id IS NOT NULL
- <if test="areaRegion != null and areaRegion != ''">
- AND tsu.area_region = #{areaRegion}
- </if>
- ORDER BY
- tsu.area_region,
- tprp.gps_time DESC;
- </select>
- <!--获取今日作业指定人员信息-->
- <select id="getWorkersInfoByUserid" resultType="com.daju.mix.dto.CimWorkersInfoDto">
- SELECT up.userid AS id,
- ur.realname AS `name`,
- ifnull(CONCAT('http://47.100.210.233/', tu.image), "") AS photo,
- ur.username AS telPhone,
- d.duties_name AS jobTitle,
- (
- SELECT COUNT(1)
- FROM t_b_alarm AS alm
- WHERE DATEDIFF(NOW(), alm.alarm_time) = 0
- AND alm.alarm_user = up.userid
- ) AS todayAlertCount,
- ta.work_route_name AS todayWorkingLine,
- concat(
- DATE_FORMAT(NOW(), '%Y-%m-%d '),
- ta.`start`,
- ':00'
- ) AS workingStartTime,
- concat(
- DATE_FORMAT(NOW(), '%Y-%m-%d '),
- ta.`end`,
- ':00'
- ) AS workingEndTime,
- ts.work_route AS workingRegion
- FROM t_bus_user_personnel AS up
- LEFT JOIN t_bus_duties AS d ON up.belong_dutiesid = d.id
- LEFT JOIN t_s_base_user AS ur ON ur.id = up.userid
- LEFT JOIN t_b_car_schedule_task_detail AS de ON de.username = ur.realname
- LEFT JOIN t_b_car_schedule_task AS ta ON ta.id = de.pid
- LEFT JOIN t_b_car_schedule AS ts ON ts.id = ta.schedule_id
- LEFT JOIN t_b_archives_area AS ba ON ba.manage_man = ur.realname
- LEFT JOIN t_s_user AS tu ON tu.mobilePhone = ur.username
- WHERE up.userid = #{userId} LIMIT 1
- </select>
- <!--1920获取今日作业指定人员信息-->
- <select id="getWorkersInfoByUserid2" resultType="com.daju.mix.dto.CimWorkersInfoDto2">
- SELECT up.userid AS id,
- ur.realname AS `name`,
- ifnull(CONCAT('http://47.100.210.233/', tu.image), "") AS photo,
- ur.username AS telPhone,
- d.duties_name AS jobTitle,
- (
- SELECT COUNT(1)
- FROM t_b_alarm AS alm
- WHERE DATEDIFF(NOW(), alm.alarm_time) = 0
- AND alm.alarm_user = #{userId}
- ) AS todayAlertCount,
- ta.work_route_name AS todayWorkingLine,
- concat(
- DATE_FORMAT(NOW(), '%Y-%m-%d '),
- ta.`start`,
- ':00'
- ) AS workingStartTime,
- concat(
- DATE_FORMAT(NOW(), '%Y-%m-%d '),
- ta.`end`,
- ':00'
- ) AS workingEndTime,
- ts.work_route AS workingRegion
- FROM t_bus_user_personnel AS up
- LEFT JOIN t_bus_duties AS d ON up.belong_dutiesid = d.id
- LEFT JOIN t_s_base_user AS ur ON ur.id = up.userid
- LEFT JOIN t_b_car_schedule_task_detail AS de ON de.user_id = ur.id
- LEFT JOIN t_b_car_schedule_task AS ta ON ta.id = de.pid
- LEFT JOIN t_b_car_schedule AS ts ON ts.id = ta.schedule_id
- LEFT JOIN t_b_archives_area AS ba ON ba.manage_man = ur.realname
- LEFT JOIN t_s_user AS tu ON tu.mobilePhone = ur.username
- WHERE up.userid = #{userId} LIMIT 1
- </select>
- <!--cim home 近5日报警情况-->
- <select id="getLast5AlarmDataList" resultType="com.daju.mix.dto.CimLast5AlarmDataDto">
- SELECT a.id,
- (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'alarmType'
- AND a.alarm_type = type.typecode
- ) AS alertType,
- a.context AS alertContent,
- (
- SELECT u.realname
- FROM t_s_base_user AS u
- WHERE u.id = a.alarm_recevier
- ) AS leader,
- a.alarm_time AS alertTime
- FROM
- t_b_alarm AS a
- <if test="regionType != null and regionType != ''">
- RIGHT JOIN t_b_archives_place AS place on a.archives_code = place.`code`
- </if>
- WHERE a.alarm_time <![CDATA[<=]]> date_format(NOW(), '%Y-%m-%d')
- <if test="scheduleType != null and scheduleType != ''">
- AND a.schedule_assignment_style = #{scheduleType}
- </if>
- <if test="regionType != null and regionType != ''">
- AND place.area_region = #{regionType}
- </if>
- AND a.alarm_time >= date_format(
- DATE_ADD(NOW(), INTERVAL - 5 DAY),
- '%Y-%m-%d'
- )
- </select>
- <!--3840近5日报警情况-->
- <select id="getLast5AlarmDataList3840" resultType="java.util.Map">
- select tst.typename alertType, ifnull(count(c.alertType), 0) num
- from (SELECT a.id,
- (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'alarmFrom'
- AND a.alarm_from = type.typecode
- ) AS alertType,
- a.context AS alertContent,
- (
- SELECT u.realname
- FROM t_s_base_user AS u
- WHERE u.id = a.alarm_recevier
- ) AS leader,
- a.alarm_time AS alertTime
- FROM t_b_alarm AS a
- WHERE a.alarm_time <= date_format(NOW(), '%Y-%m-%d')
- AND a.alarm_time >= date_format(
- DATE_ADD(NOW(), INTERVAL - 5 DAY),
- '%Y-%m-%d'
- )) c
- RIGHT JOIN (select typename from t_s_type where typegroupid = 'ff8080817ae6b8cb017b0b62e8670023') tst
- ON tst.typename = c.alertType
- where tst.typename = '洒水作业'
- or tst.typename = '洗扫作业'
- or tst.typename = '路面养护作业'
- or tst.typename = '巡回保洁作业'
- or tst.typename = '机扫作业'
- group by tst.typename
- </select>
- <!--3840近5日报警情况-->
- <select id="getLast5AlarmDataList3840JinBo" resultType="java.util.Map">
- select tst.typename alertType, ifnull(count(c.alertType), 0) num
- from (SELECT a.id,
- (
- SELECT type.typename
- FROM t_s_typegroup AS typeg
- LEFT JOIN t_s_type AS type ON typeg.ID = type.typegroupid
- WHERE typeg.typegroupcode = 'alarmType'
- AND a.alarm_type = type.typecode
- ) AS alertType,
- a.context AS alertContent,
- (
- SELECT u.realname
- FROM t_s_base_user AS u
- WHERE u.id = a.alarm_recevier
- ) AS leader,
- a.alarm_time AS alertTime
- FROM t_b_alarm AS a
- WHERE a.alarm_time <= date_format(NOW(), '%Y-%m-%d')
- AND a.alarm_time >= date_format(
- DATE_ADD(NOW(), INTERVAL - 1 DAY),
- '%Y-%m-%d'
- )) c
- RIGHT JOIN (select typename from t_s_type where typegroupid = 'ff8080817ae6b8cb017b0b64ead0002b') tst
- ON tst.typename = c.alertType
- where tst.typename = '车辆超速'
- or tst.typename = '视频存储空间不足'
- or tst.typename = '停驻超时'
- or tst.typename = '迟到'
- or tst.typename = '作业未按时完成'
- group by tst.typename
- </select>
- <!--今日作业区域人的位置以及职位-->
- <select id="selectHumRegionAndDuties" resultType="com.daju.mix.dto.AllElementDto">
- SELECT DISTINCT tu.id as id,
- '1' as elementType,
- tu.gender as elementProperty,
- tu.area_region as regionCode,
- prp.longitude_wgs84 as longitude,
- prp.latitude_wgs84 as latitude,
- prp.gps_time as gpsTime
- FROM t_s_user as tu
- LEFT JOIN t_personnel_real_position as prp on prp.person_id = tu.id
- where
- tu.area_region is not null
- <if test="regionType != null and regionType != ''">
- AND tu.area_region = #{regionType}
- </if>
- group by tu.id
- </select>
- <!--3840今日作业区域人的位置以及职位-->
- <select id="selectHumRegionAndDuties3840" resultType="com.daju.mix.dto.AllElement3840Dto">
- SELECT DISTINCT tu.id as id,
- '1' as elementType,
- tu.gender as elementProperty,
- tu.area_region as regionCode,
- prp.longitude_wgs84 as longitude,
- prp.latitude_wgs84 as latitude,
- prp.gps_time as gpsTime
- FROM t_s_user as tu
- LEFT JOIN t_personnel_real_position as prp on prp.person_id = tu.id
- where
- tu.area_region = 3
- group by tu.id
- </select>
- <!-- 巡回保洁车作业区域车的位置 -->
- <select id="selectCarRegionAndDutiesItinerant" resultType="com.daju.mix.dto.AllElementDto">
- SELECT DISTINCT bc.id AS id,
- ifnull(bc.type,0) AS elementType,
- ifnull(bc.energy_type,0) AS elementProperty,
- ifnull(bc.area_region,1) AS regionCode,
- bcn.longitude_wgs84 AS longitude,
- bcn.latitude_wgs84 AS latitude,
- bcn.gps_time AS gpsTime,
- bcn.velocity AS velocity
- FROM t_car_itinerant_clean_real_pos AS bcn
- LEFT JOIN t_b_car AS bc ON bc.id = bcn.card_id
- WHERE
- TO_DAYS(NOW()) = TO_DAYS(bcn.gps_time)
- AND bc.id is NOT NULL
- AND bc.id != ''
- AND bc.type = 'cleancyclic'
- <if test="regionType != null and regionType != ''">
- AND bc.area_region = #{regionType}
- </if>
- group by bc.id
- </select>
- <!--1920今日作业区域车的位置-->
- <select id="selectCarRegionAndDuties" resultType="com.daju.mix.dto.AllElementDto">
- SELECT DISTINCT bc.id AS id,
- ifnull(bc.type, 0) AS elementType,
- ifnull(bc.energy_type, 0) AS elementProperty,
- bc.area_region AS regionCode,
- bcn.lng AS longitude,
- bcn.lat AS latitude,
- bcn.gps_time AS gpsTime,
- bcn.speed AS velocity
- FROM t_b_car bc
- LEFT JOIN t_b_car_now AS bcn ON bcn.carid = bc.id
- WHERE
- bc.id is NOT NULL
- AND bc.id != ''
- AND bc.area_region is not null
- AND bc.type != 'cleancyclic'
- <if test="regionType != null and regionType != ''">
- AND bc.area_region = #{regionType}
- </if>
- group by bc.id
- </select>
- <!--3840今日作业区域车的位置-->
- <select id="selectCarRegionAndDuties3840" resultType="com.daju.mix.dto.AllElement3840Dto">
- SELECT DISTINCT bc.id AS id,
- ifnull(bc.type, 0) AS elementType,
- ifnull(bc.energy_type, 0) AS elementProperty,
- bc.area_region AS regionCode,
- bcn.lng AS longitude,
- bcn.lat AS latitude,
- bcn.gps_time AS gpsTime,
- bcn.speed AS velocity
- FROM t_b_car bc
- LEFT JOIN t_b_car_now AS bcn ON bcn.carid = bc.id
- WHERE
- bc.id is NOT NULL
- AND bc.id != ''
- AND bc.area_region = 3
- group by bc.id
- </select>
- <!--今日作业区域清运点-->
- <select id="selectCleanRegionAndDuties" resultType="com.daju.mix.dto.AllElementDto">
- SELECT DISTINCT
- bap.id AS id,
- ifnull(bap.type,0) AS elementType,
- ifnull(bap.area_region,1) AS regionCode,
- bap.longitude AS longitude,
- bap.latitude AS latitude
- FROM
- t_b_archives_place AS bap
- WHERE
- bap.id != ''
- <if test="regionType != null and regionType != ''">
- AND bap.area_region = #{regionType}
- </if>
- </select>
- <!--3840今日作业区域清运点-->
- <select id="selectCleanRegionAndDuties3840" resultType="com.daju.mix.dto.AllElement3840Dto">
- SELECT DISTINCT bap.id AS id,
- ifnull(bap.type, 0) AS elementType,
- '作业地点' AS elementProperty,
- bap.longitude AS longitude,
- bap.latitude AS latitude
- FROM t_b_archives_place AS bap
- WHERE bap.area_region = 3
- </select>
- <select id="selectItCarRegionAndDuties" resultType="com.daju.mix.dto.AllElementDto">
- SELECT sta.car_id AS id,
- '21' AS elementType,
- '1' AS regionCode,
- '' AS type,
- crp.longitude_wgs84 AS longitude,
- crp.latitude_wgs84 AS latitude
- FROM t_b_car AS sta
- LEFT JOIN t_car_Itinerant_clean_real_pos AS crp ON sta.id = crp.card_id
- WHERE sta.date = DATE_FORMAT(NOW(), '%Y-%m-%d')
- AND sta.id IS not NULL
- AND sta.id != ''
- AND crp.longitude_wgs84 IS not NULL
- AND crp.latitude_wgs84 IS not NULL
- </select>
- <select id="selectItCarRegionAndDuties3840" resultType="com.daju.mix.dto.AllElement3840Dto">
- SELECT sta.car_id AS id,
- '21' AS elementType,
- '' AS type,
- crp.longitude_wgs84 AS longitude,
- crp.latitude_wgs84 AS latitude
- FROM t_b_car_schedule_task_arrange AS sta
- LEFT JOIN t_b_car_schedule_task AS st ON sta.arrange_id = st.id
- LEFT JOIN t_car_Itinerant_clean_real_pos AS crp ON sta.car_id = crp.card_id
- WHERE sta.date = DATE_FORMAT(NOW(), '%Y-%m-%d')
- AND sta.car_id IS not NULL
- AND sta.car_id != ''
- AND crp.longitude_wgs84 IS not NULL
- AND crp.latitude_wgs84 IS not NULL
- </select>
- <select id="getCompletionRate" resultType="com.daju.mix.dto.CompletionRateDto">
- SELECT DISTINCT
- sta.carid AS id,
- tbcru.user_id as infoUserId,
- sta.user_id as userId,
- bc.plate AS plate,
- bc.type AS carType,
- tsbu.realname AS userName,
- st.work_route AS routeId,
- st.type AS workType,
- IF(st.type not in ("16","23","24","25"),bcn.lng,IF(st.type in ("16","23","25"),tprp.longitude_wgs84,tcicr.longitude_wgs84)) AS longitude,
- IF(st.type not in ("16","23","24","25"),bcn.lat,IF(st.type in ("16","23","25"),tprp.latitude_wgs84,tcicr.latitude_wgs84)) AS latitude,
- IF(st.type not in ("16","23","24","25"),bcn.gps_time,IF(st.type in ("16","23","25"),tprp.gps_time,tcicr.gps_time)) AS gpsTime,
- IFNULL(bcn.mileage,0) AS mileage,
- CONCAT(sta.yearmonth, '-', sta.code_day) AS date,
- CONCAT(sta.yearmonth,'-',sta.code_day,' ',st.`start`,':00') AS startTime,
- CONCAT(sta.yearmonth,'-',sta.code_day,' ', st.end, ':00') AS endTime
- FROM t_b_car_schedule_task_detail AS sta
- LEFT JOIN t_b_car_schedule_task AS st ON sta.pid = st.id
- LEFT JOIN t_bus_user_personnel tbup on tbup.userid = SUBSTRING_INDEX(sta.user_id,',',1)
- LEFT JOIN t_b_work_route AS wr ON st.work_route = wr.id
- LEFT JOIN t_b_car AS bc ON sta.carid = bc.id
- LEFT JOIN t_b_car_now AS bcn ON sta.carid = bcn.carid
- LEFT JOIN t_b_car_schedule tbcs on tbcs.id = st.schedule_id
- LEFT JOIN t_bus_post tbp on tbp.id = tbup.in_postid
- LEFT JOIN t_b_car_schedule_type tbcst on tbcst.business_type = tbcs.assignment_style and tbcst.car_type = bc.type and tbcst.user_type = tbp.id
- LEFT JOIN t_b_car_receiver_user tbcru on tbcru.business_type = tbcs.assignment_style and tbcru.area_region = wr.area_region and tbcru.msg_type = '5' and tbcru.schedule_type_id = tbcst.id
- LEFT JOIN t_personnel_real_position tprp on tprp.person_id = sta.user_id
- LEFT JOIN t_s_base_user tsbu on tsbu.id = sta.user_id
- LEFT JOIN t_car_Itinerant_clean_real_pos tcicr on tcicr.card_id = sta.carid
- WHERE CONCAT(sta.yearmonth
- , '-'
- , sta.code_day) = CURDATE() GROUP BY CONCAT(sta.carid,tbcst.business_type,tbcst.car_type,sta.id);
- </select>
- <select id="getCompletionRateRouteListByCarId" resultType="int">
- SELECT
- COUNT(id)
- FROM
- t_b_work_route_list
- WHERE
- route_id IN (
- SELECT
- st.work_route
- FROM
- t_b_car_schedule_task_detail AS sta
- LEFT JOIN t_b_car_schedule_task AS st ON sta.pid = st.id
- LEFT JOIN t_bus_user_personnel tbup ON tbup.userid = SUBSTRING_INDEX(sta.user_id, ',', 1)
- LEFT JOIN t_b_work_route AS wr ON st.work_route = wr.id
- LEFT JOIN t_b_car AS bc ON sta.carid = bc.id
- LEFT JOIN t_b_car_now AS bcn ON sta.carid = bcn.carid
- LEFT JOIN t_b_car_schedule tbcs ON tbcs.id = st.schedule_id
- LEFT JOIN t_bus_post tbp ON tbp.id = tbup.in_postid
- LEFT JOIN t_b_car_schedule_type tbcst ON tbcst.business_type = tbcs.assignment_style
- AND tbcst.car_type = bc.type
- AND tbcst.user_type = tbp.id
- LEFT JOIN t_b_car_receiver_user tbcru ON tbcru.business_type = tbcs.assignment_style
- AND tbcru.area_region = wr.area_region
- AND tbcru.msg_type = '5'
- AND tbcru.schedule_type_id = tbcst.id
- WHERE
- CONCAT(
- sta.yearmonth,
- '-',
- sta.code_day
- ) = CURDATE()
- <if test="carId != null and carId != ''">
- AND sta.carid = #{carId}
- </if>
- <if test="userId != null and userId != ''">
- AND sta.user_id = #{userId}
- </if>
- GROUP BY st.work_route
- );
- </select>
- <select id="getTypeByReglas" resultType="com.daju.api.hardware.dao.entity.TBCarShootReglas">
- select *
- from t_b_car_shoot_reglas
- where
- 1 = 1
- <if test="time != null and time != ''">
- and by_time = 1
- </if>
- <if test="area != null and area != ''">
- and by_area = 1
- </if>
- <if test="status != null and status != ''">
- and by_state = 1
- </if>
- </select>
- <select id="getReglasCarId" resultType="com.daju.api.hardware.dto.ReglasCarIdDto">
- SELECT DISTINCT sta.carid AS id,
- bcn.plate AS plate,
- st.work_route AS routeId,
- bcn.lng AS longitude,
- bcn.lat AS latitude,
- CONCAT(sta.yearmonth, '-', sta.code_day) AS date,
- bc.video_provider AS videoProvider
- FROM t_b_car_schedule_task_detail AS sta
- LEFT JOIN t_b_car_schedule_task AS st
- ON sta.pid = st.id
- LEFT JOIN t_b_work_route AS wr ON st.work_route = wr.id
- LEFT JOIN t_b_car AS bc ON sta.carid = bc.id
- LEFT JOIN t_b_car_now AS bcn ON sta.carid = bcn.carid
- WHERE TO_DAYS(CONCAT(sta.yearmonth
- , '-'
- , sta.code_day)) = TO_DAYS(NOW())
- AND TO_DAYS(NOW()) = TO_DAYS(bcn.gps_time)
- AND sta.carid is NOT NULL
- AND sta.carid != ''
- <if test="type != null and type != ''">
- AND bc.type = #{type}
- </if>
- group by sta.carid
- </select>
- <select id="getCarIdAndPlate" resultType="java.util.Map">
- SELECT
- tbc.id,
- tbc.plate AS NAME,
- tbc.`type` AS carType,
- tst.typename as carTypeName
- FROM
- t_b_car tbc
- LEFT JOIN (
- SELECT
- *
- FROM
- t_s_type
- WHERE
- typegroupid = (
- SELECT
- ID
- FROM
- t_s_typegroup
- WHERE
- typegroupcode = 'cartype'
- )
- ) tst on tst.typecode = tbc.type
- WHERE
- tbc.type not in ('other','pickup','forklift','administration','wash','cleancyclic')
- </select>
- <select id="getAllPeoples" resultType="com.daju.api.hardware.dto.GcbPeoplesDTO">
- SELECT
- ts.id id,
- ts.userNum userNum,
- tb.realname name,
- ts.mobilePhone mobilePhone,
- ts.gender gender,
- ts.nation nation,
- ts.idcard idcard,
- ts.birthday birthday,
- ts.hkaddress hkadress,
- ts.address address,
- td2.departname company,
- td.departname depart,
- tbd.duties_name duties,
- tp.post_name post,
- ts.email email,
- ts.employment_date employmentDate
- FROM
- t_s_user ts
- LEFT JOIN t_s_base_user tb ON tb.id = ts.id
- LEFT JOIN t_s_depart td ON td.id = tb.departid
- LEFT JOIN t_s_depart td2 on td2.id = td.parentdepartid
- LEFT JOIN t_bus_user_personnel tbu ON tbu.userid = ts.id
- LEFT JOIN t_bus_post tp ON tp.id = tbu.in_postid
- LEFT JOIN t_bus_duties tbd ON tbd.id = tbu.belong_dutiesid
- ${ew.customSqlSegment}
- </select>
- <select id="getPeopleSchedule" resultType="com.daju.api.hardware.dto.GcbPeoScheduleDTO">
- SELECT
- ts.userNum userNum,
- ta.username name,
- ts.mobilePhone mobilePhone,
- td2.departname company,
- td.departname depart,
- tbd.duties_name duties,
- tp.post_name post,
- CONCAT(ta.yearmonth,'-',ta.code_day) date,
- tt.work_route_name workRouteName
- FROM
- t_b_car_schedule_task_detail ta
- left join t_s_user ts on ts.id = ta.user_id
- LEFT JOIN t_s_base_user tb ON tb.id = ts.id
- LEFT JOIN t_s_depart td ON td.id = tb.departid
- LEFT JOIN t_s_depart td2 on td2.id = td.parentdepartid
- LEFT JOIN t_bus_user_personnel tbu ON tbu.userid = ts.id
- LEFT JOIN t_bus_post tp ON tp.id = tbu.in_postid
- LEFT JOIN t_bus_duties tbd ON tbd.id = tbu.belong_dutiesid
- LEFT JOIN t_b_car_schedule_task tt ON ta.pid = tt.id
- ${ew.customSqlSegment}
- </select>
- <select id="getToilets" resultType="com.daju.api.hardware.dto.GcbToiletsDTO">
- SELECT
- tp.id id,
- tp.code code,
- tp.name name,
- tu.realname manager,
- tp.mobile_phone mobilePhone,
- tp.position position,
- tp.longitude longitude,
- tp.latitude latitude,
- tp.height height,
- tp.manage_content manageContent,
- tp.vehicle_no01 vehicleNo01,
- tp.vehicle_no02 vehicleNo02,
- tp.vehicle_no03 vehicleNo03,
- tp.channel_no channelNo,
- tp.signing_time signingTime,
- tt.typename areaRegion
- FROM
- t_b_archives_place tp
- LEFT JOIN t_s_base_user tu ON tu.id = tp.manager_id
- LEFT JOIN (select * from t_s_type where typegroupid = 'ff8080817a842ec0017a84a6154f000c') tt ON tt.typecode = tp.area_region
- ${ew.customSqlSegment}
- </select>
- <select id="getBRoom" resultType="com.daju.api.hardware.dto.GcbBRoomDTO">
- SELECT
- tp.id id,
- tp.code code,
- tp.name name,
- tu.realname manager,
- tp.mobile_phone mobilePhone,
- tp.position position,
- tp.longitude longitude,
- tp.latitude latitude,
- tp.height height,
- tp.manage_content manageContent,
- tp.vehicle_no01 vehicleNo01,
- tp.vehicle_no02 vehicleNo02,
- tp.vehicle_no03 vehicleNo03,
- tp.channel_no channelNo,
- tp.signing_time signingTime,
- tt.typename areaRegion
- FROM
- t_b_archives_place tp
- LEFT JOIN t_s_base_user tu ON tu.id = tp.manager_id
- LEFT JOIN (select * from t_s_type where typegroupid = 'ff8080817a842ec0017a84a6154f000c') tt ON tt.typecode = tp.area_region
- ${ew.customSqlSegment}
- </select>
- <select id="getGcbTCo" resultType="com.daju.api.hardware.dto.GcbTCoDTO">
- SELECT
- tbth.toilet_id toiletId,
- tba.name toiletName,
- tba.area_location toiletLocation,
- tt.typename toiletRegion,
- MIN( tbth.time ) minTime,
- MAX( tbth.time ) maxTime,
- SUM( tbth.water_consumption ) waterConsumption,
- SUM( tbth.electricity_consumption ) electricityConsumption,
- SUM( tbth.liquid_soap ) liquidSoap,
- SUM( tbth.disinfectant ) disinfectant,
- SUM( tbth.tissue ) tissue,
- SUM( tbth.cleaning ) cleaning
- FROM
- t_b_toilet_history tbth
- LEFT JOIN t_b_archives_area tba ON tba.id = tbth.toilet_id
- LEFT JOIN (select * from t_s_type where typegroupid = 'ff8080817a842ec0017a84a6154f000c') tt ON tt.typecode = tba.area_region
- ${ew.customSqlSegment}
- </select>
- </mapper>
|