| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?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.PatrolManageDao">
- <select id="getPatrolManageList" resultType="PatrolManageDTO">
- select p.number,p.count,p.id
- from patrol_manage p
- left join section s on p.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 p.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="sectionId != null and sectionId != 0">
- and p.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 p.number like '%${keyword}%'
- </if>
- <if test="page >= 0 and count > 0">
- limit #{page},#{count}
- </if>
- </select>
- <select id="getPatrolManageCount" resultType="Integer">
- select count(p.id) as total
- from patrol_manage p
- <if test="sectionList != null and !sectionList.isEmpty()">
- where p.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="getPatrolDownList" resultType="PatrolManageDTO">
- select p.id,p.number
- from patrol_manage p
- where p.user_id = #{userid}
- </select>
-
- <insert id="addPatrolManageData" parameterType="PatrolManageDTO" useGeneratedKeys="true" keyProperty="id">
- insert into patrol_manage(sectionId,`count`,plan_start_time,plan_end_time,user_id,create_time)
- values (#{sectionId},#{count},#{planStartTime},#{planEndTime},#{userid},#{createTime})
- </insert>
- <update id="updatePatrolManageData" parameterType="PatrolManageDTO">
- update patrol_manage p
- set p.sectionId = #{sectionId},
- p.`count` = #{count},
- p.plan_start_time = #{planStartTime},
- p.plan_end_time = #{planEndTime}
- where p.id = #{id}
- </update>
- <!-- 运维概览巡视数 -->
- <select id="getPatrolManageCount1" resultType="Integer">
- select count(p.id)
- from patrol_manage p
- where date(p.create_time) <![CDATA[ <= ]]> #{endDate}
- <if test="startDate != null and startDate != ''">
- and date(p.create_time) <![CDATA[ >= ]]> #{startDate}
- </if>
- <if test="sectionList != null and !sectionList.isEmpty()">
- and p.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <!-- 运维概览巡视数,前30天内的数据数量 -->
- <select id="getPatrolManageCountOnMonth" resultType="PatrolManageDTO">
- select count(*) as dayCount,date(p.create_time) as createTime
- from patrol_manage p
- where p.create_time <![CDATA[ >= ]]> curdate() - interval 30 day
- and p.create_time <![CDATA[ <= ]]> now()
- <if test="sectionList != null and !sectionList.isEmpty()">
- and p.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- group by date(p.create_time)
- order by date(p.create_time) desc
- </select>
- </mapper>
|