| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 | <?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.welampiot.dao.WorkManageDao">        <select id="getWorkManageListByVO" resultType="WorkManageDTO" parameterType="WorkManageVO">        select w.id,w.number,w.open_time openTime,w.script,w.location,w.status,               w.level,w.work_name as workName        from work_manage w        left join work_manage_file wmf on w.id = wmf.work_manage_id        left join section s on w.sectionId = s.id        left join global_location gl on s.pid = gl.id        left join global_location gl1 on gl.pid = gl1.id        left join global_location gl2 on gl1.pid = gl2.id        where 1=1        <if test="sectionList != null and !sectionList.isEmpty()">            and w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>        <if test="sectionId != null and sectionId != 0">            and s.id = #{sectionId}        </if>        <if test="areaId != null and areaId != 0">            and gl.id = #{areaId}        </if>        <if test="cityId != null and cityId != 0">            and gl1.id = #{cityId}        </if>        <if test="provinceId != null and provinceId != 0">            and gl2.id = #{provinceId}        </if>        <if test="keyword != null and keyword != ''">            and w.number like '%${keyword}%'        </if>        <choose>            <when test="status == 4">                and w.status = 4            </when>            <when test="status == 3">                and w.status = 3            </when>            <when test="status == 2">                and w.status = 2            </when>            <when test="status == 1">                and w.status = 1            </when>            <otherwise>                and w.status = 0            </otherwise>        </choose>        <if test="page >= 0 and count > 0">            limit #{page},#{count}        </if>    </select>    <!-- 总数 -->    <select id="getWorkManageTotal" resultType="Integer" parameterType="WorkManageVO">        select count(w.id) as total        from work_manage w        left join section s on w.sectionId = s.id        left join global_location gl on s.pid = gl.id        left join global_location gl1 on gl.pid = gl1.id        left join global_location gl2 on gl1.pid = gl2.id        <if test="sectionList != null and !sectionList.isEmpty()">            where w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <!-- 未派发数 -->    <select id="getWorkManageTotal2" resultType="Integer" parameterType="WorkManageVO">        select count(w.id) as total        from work_manage w        left join section s on w.sectionId = s.id        left join global_location gl on s.pid = gl.id        left join global_location gl1 on gl.pid = gl1.id        left join global_location gl2 on gl1.pid = gl2.id        where w.status = 0        <if test="sectionList != null and !sectionList.isEmpty()">            and w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <!-- 处理中数 -->    <select id="getWorkManageTotal3" resultType="Integer" parameterType="WorkManageVO">        select count(w.id) as total        from work_manage w        left join section s on w.sectionId = s.id        left join global_location gl on s.pid = gl.id        left join global_location gl1 on gl.pid = gl1.id        left join global_location gl2 on gl1.pid = gl2.id        where w.status = 1        <if test="sectionList != null and !sectionList.isEmpty()">            and w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <!-- 复核数 -->    <select id="getWorkManageTotal4" resultType="Integer" parameterType="WorkManageVO">        select count(w.id) as total        from work_manage w        left join section s on w.sectionId = s.id        left join global_location gl on s.pid = gl.id        left join global_location gl1 on gl.pid = gl1.id        left join global_location gl2 on gl1.pid = gl2.id        where w.status = 2        <if test="sectionList != null and !sectionList.isEmpty()">            and w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <!-- 结案数 -->    <select id="getWorkManageTotal5" resultType="Integer" parameterType="WorkManageVO">        select count(w.id) as total        from work_manage w        left join section s on w.sectionId = s.id        left join global_location gl on s.pid = gl.id        left join global_location gl1 on gl.pid = gl1.id        left join global_location gl2 on gl1.pid = gl2.id        where w.status = 3        <if test="sectionList != null and !sectionList.isEmpty()">            and w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <!-- 归档数 -->    <select id="getWorkManageTotal6" resultType="Integer" parameterType="WorkManageVO">        select count(w.id) as total        from work_manage w        left join section s on w.sectionId = s.id        left join global_location gl on s.pid = gl.id        left join global_location gl1 on gl.pid = gl1.id        left join global_location gl2 on gl1.pid = gl2.id        where w.status = 4        <if test="sectionList != null and !sectionList.isEmpty()">            and w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>        <!-- 工单详情 -->    <select id="getWorkManageInfoById" resultType="WorkManageDTO">        select w.id,w.number,w.open_time openTime,w.script,               w.level,w.location,w.longitude,w.latitude        from work_manage w        where w.id = #{id}    </select>    <insert id="addWorkManageData" parameterType="WorkManageDTO" keyProperty="id" useGeneratedKeys="true">        insert into work_manage(sectionId,open_time,location,dev_type,`level`,                                dev_name,script,longitude,latitude,alarm_id,                                create_time,user_id)        values            (#{sectionId},#{openTime},#{location},#{devType},#{level},             #{devName},#{script},#{longitude},#{latitude},#{alarmId},             #{createTime},#{userid})    </insert>    <update id="updateWorkManageData" parameterType="WorkManageDTO">        update work_manage w        set            w.sectionId = #{sectionId},            w.open_time = #{openTime},            w.location = #{location},            w.dev_type = #{devType},            w.dev_name = #{devName},            w.script = #{script},            w.longitude = #{longitude},            w.latitude = #{latitude},            w.alarm_id = #{alarmId}        where w.id = #{id}    </update>    <!-- 更新工单状态 -->    <update id="updateWorkStatus" parameterType="WorkManageDTO">        update work_manage w        set            w.status = #{status}        where w.id = #{id}    </update>    <select id="getAlarmIdAndUseridById" resultType="WorkManageDTO">        select w.alarm_id as alarmId,w.user_id as userid        from work_manage w        where w.id = #{id}    </select>    <!-- 运维概览工单数 -->    <select id="getWorkManageCount" resultType="Integer">        select count(w.id)        from work_manage w        where date(w.create_time) <![CDATA[ <= ]]> #{endDate}        <if test="startDate != null and startDate != ''">            and date(w.create_time) <![CDATA[ >= ]]> #{startDate}        </if>        <if test="sectionList != null and !sectionList.isEmpty()">            and w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <!-- 运维概览工单数,前30天内的数据数量 -->    <select id="getWorkManageCountOnMonth" resultType="WorkManageDTO">        select count(*) as dayCount,date(w.create_time) as createTime        from work_manage w        where w.create_time <![CDATA[ >= ]]> curdate() - interval 30 day        and w.create_time <![CDATA[ <= ]]> now()        <if test="sectionList != null and !sectionList.isEmpty()">            and w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>        group by date(w.create_time)        order by date(w.create_time) desc    </select>    <!-- 运维概览工单未派发数,当月当年全部具体月份的数据数量 -->    <select id="getWorkManageUndistributedCount" resultType="Integer">        select count(*) as dayCount        from work_manage w        where w.status = 0        and date(w.create_time) <![CDATA[ <= ]]> #{endDate}        <if test="startDate != null and startDate != ''">            and date(w.create_time) <![CDATA[ >= ]]> #{startDate}        </if>        <if test="sectionList != null and !sectionList.isEmpty()">            and w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <!-- 运维概览工单处理中数,当月当年全部具体月份的数据数量 -->    <select id="getWorkManageHandlingCount" resultType="Integer">        select count(*) as dayCount        from work_manage w        where w.status = 1        and date(w.create_time) <![CDATA[ <= ]]> #{endDate}        <if test="startDate != null and startDate != ''">            and date(w.create_time) <![CDATA[ >= ]]> #{startDate}        </if>        <if test="sectionList != null and !sectionList.isEmpty()">            and w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <!-- 运维概览工单复核数,当月当年全部具体月份的数据数量 -->    <select id="getWorkManageRecheckCount" resultType="Integer">        select count(*) as dayCount        from work_manage w        where w.status = 2        and date(w.create_time) <![CDATA[ <= ]]> #{endDate}        <if test="startDate != null and startDate != ''">            and date(w.create_time) <![CDATA[ >= ]]> #{startDate}        </if>        <if test="sectionList != null and !sectionList.isEmpty()">            and w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <!-- 运维概览工单结案数,当月当年全部具体月份的数据数量 -->    <select id="getWorkManageCloseCaseCount" resultType="Integer">        select count(*) as dayCount        from work_manage w        where w.status = 3        and date(w.create_time) <![CDATA[ <= ]]> #{endDate}        <if test="startDate != null and startDate != ''">            and date(w.create_time) <![CDATA[ >= ]]> #{startDate}        </if>        <if test="sectionList != null and !sectionList.isEmpty()">            and w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select>    <!-- 运维概览工单归档数,当月当年全部具体月份的数据数量 -->    <select id="getWorkManageArchiveCount" resultType="Integer">        select count(*) as dayCount        from work_manage w        where w.status = 4        and date(w.create_time) <![CDATA[ <= ]]> #{endDate}        <if test="startDate != null and startDate != ''">            and date(w.create_time) <![CDATA[ >= ]]> #{startDate}        </if>        <if test="sectionList != null and !sectionList.isEmpty()">            and w.sectionId in            <foreach collection="sectionList" item="item" open="(" separator="," close=")">                #{item}            </foreach>        </if>    </select></mapper>
 |