<?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.ruoyi.project.patrol.patrol.mapper.TIndexMapper">

    <select id="getDevNumber" resultType="java.lang.Integer">
        select sum(a.num + b.num + c.num + d.num + e.num + f.num + g.num + h.num + i.num + j.num + k.num + l.num +
                   m.num +
                   n.num + o.num + p.num + q.num + r.num + s.num + t.num + u.num + v.num + w.num + x.num + y.num +
                   z.num) num
        from (select count(*) num from T_DEV_ALARM where STATUS = 1 and DEL_FLAG = 0) a,
             (select count(*) num from T_DEV_ANNIHILATOR where STATUS = 1 and DEL_FLAG = 0) b,
             (select count(*) num from T_DEV_BICYCLE where STATUS = 1 and DEL_FLAG = 0) c,
             (select count(*) num from T_DEV_CABINET where STATUS = 1 and DEL_FLAG = 0) d,
             (select count(*) num from T_DEV_CCTV where STATUS = 1 and DEL_FLAG = 0) e,
             (select count(*) num from T_DEV_COFFERDAM where STATUS = 1 and DEL_FLAG = 0) f,
             (select count(*) num from T_DEV_DOOR where STATUS = 1 and DEL_FLAG = 0) g,
             (select count(*) num from T_DEV_DOWNSPOUT where STATUS = 1 and DEL_FLAG = 0) h,
             (select count(*) num from T_DEV_EARPLUG where STATUS = 1 and DEL_FLAG = 0) i,
             (select count(*) num from T_DEV_EYEWASH where STATUS = 1 and DEL_FLAG = 0) j,
             (select count(*) num from T_DEV_GAS_SHIELD where STATUS = 1 and DEL_FLAG = 0) k,
             (select count(*) num from T_DEV_HOSE_BOX where STATUS = 1 and DEL_FLAG = 0) l,
             (select count(*) num from T_DEV_MANHOLE_COVER where STATUS = 1 and DEL_FLAG = 0) m,
             (select count(*) num from T_DEV_MOVEMENT where STATUS = 1 and DEL_FLAG = 0) n,
             (select count(*) num from T_DEV_PAGA where STATUS = 1 and DEL_FLAG = 0) o,
             (select count(*) num from T_DEV_POST_FIRE where STATUS = 1 and DEL_FLAG = 0) p,
             (select count(*) num from T_DEV_SAFETY_BELT where STATUS = 1 and DEL_FLAG = 0) q,
             (select count(*) num from T_DEV_SANDBOX where STATUS = 1 and DEL_FLAG = 0) r,
             (select count(*) num from T_DEV_SPRINKLER where STATUS = 1 and DEL_FLAG = 0) s,
             (select count(*) num from T_DEV_STANDPIPE where STATUS = 1 and DEL_FLAG = 0) t,
             (select count(*) num from T_DEV_STEAM_CURTAIN where STATUS = 1 and DEL_FLAG = 0) u,
             (select count(*) num from T_DEV_TESTER where STATUS = 1 and DEL_FLAG = 0) v,
             (select count(*) num from T_DEV_WALKIE_TALKIE where STATUS = 1 and DEL_FLAG = 0) w,
             (select count(*) num from T_DEV_WATER_CANNON where STATUS = 1 and DEL_FLAG = 0) x,
             (select count(*) num from T_DEV_WATER_PUMP where STATUS = 1 and DEL_FLAG = 0) y,
             (select count(*) num from T_DEV_WEATHERVANE where STATUS = 1 and DEL_FLAG = 0) z
    </select>
    <select id="getUncheckNumber" parameterType="tIndex" resultType="java.lang.Integer">
        select count(*) num
        from T_PATROL_PLAN
        where PLAN_YEAR = #{year}
          and PLAN_QUARTER = #{month}
          and STATUS = 0
          and DEL_FLAG = 0
    </select>
    <select id="getCheckNumber" parameterType="tIndex" resultType="java.lang.Integer">
        select count(*) num
        from T_PATROL_PLAN
        where PLAN_YEAR = #{year}
          and PLAN_QUARTER = #{month}
          and STATUS = 1
          and DEL_FLAG = 0
    </select>
    <select id="getIssueNumber" parameterType="tIndex" resultType="java.lang.Integer">
        select count(*) num
        from T_PATROL_ISSUES
        where to_char(createdate, 'yyyy-MM') = to_char(#{createDate}, 'yyyy-MM')
          and STATUS = 0
          and DEL_FLAG = 0
    </select>


</mapper>
