|
@@ -2,138 +2,127 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
<mapper namespace="com.ozs.service.mapper.MsgWebPushMapper">
|
|
|
|
|
|
- <select id="webAlarmNum" parameterType="java.lang.String" resultType="java.lang.Integer">
|
|
|
- select count(*) from msg_web_push where status = 1
|
|
|
- <if test="userIds != null and userIds != ''">
|
|
|
- and receive_by in
|
|
|
- <foreach item="item" collection="userIds" separator="," open="(" close=")" index="">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="webAlarm" parameterType="java.lang.String" resultType="com.ozs.service.entity.MsgAlarm">
|
|
|
- select b.* from (
|
|
|
- select alarm_id from msg_web_push where status = 1
|
|
|
- <if test="userIds != null and userIds != ''">
|
|
|
- and receive_by in
|
|
|
- <foreach item="item" collection="userIds" separator="," open="(" close=")" index="">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- ) a left join (
|
|
|
- select * from msg_alarm
|
|
|
- ) b on a.alarm_id = b.alarm_id
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="messageMoreByUserIds" parameterType="java.util.List" resultType="java.lang.String">
|
|
|
- select alarm_id from msg_web_push where status = #{status} and receive_by in
|
|
|
- <foreach item="item" collection="userIds" index="index" separator="," open="(" close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="messageMore" parameterType="com.ozs.service.entity.vo.MsgAlarmVo"
|
|
|
- resultType="com.ozs.service.entity.MsgAlarm">
|
|
|
- select b.* from (
|
|
|
- select alarm_id from msg_web_push
|
|
|
+ <select id="webAlarmNum" parameterType="com.ozs.service.entity.vo.MsgAlarmVo" resultType="java.lang.Integer">
|
|
|
+ select count(1)
|
|
|
+ from msg_web_push AS a
|
|
|
+ join msg_alarm AS b on a.alarm_id = b.alarm_id
|
|
|
+ join base_camera_management AS c on b.camera_code = c.camera_code
|
|
|
<where>
|
|
|
- <if test="status != null and status != ''">
|
|
|
- and status = #{status}
|
|
|
- </if>
|
|
|
- <if test="userIds != null and userIds != ''">
|
|
|
- and receive_by in
|
|
|
- <foreach item="item" collection="userIds" index="index" separator="," open="(" close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
+ status = 1
|
|
|
+ <if test="!dsFlay">
|
|
|
+ and
|
|
|
+ <trim prefix="(" prefixOverrides="or" suffix=")">
|
|
|
+ <if test="dsUserId != null and dsUserId != ''">
|
|
|
+ or a.receive_by = #{dsUserId}
|
|
|
+ </if>
|
|
|
+ <if test="dsDeptId != null and dsDeptId != 0">
|
|
|
+ or c.dept_id = #{dsDeptId}
|
|
|
+ </if>
|
|
|
+ <if test="dsDeptIds != null">
|
|
|
+ or c.dept_id in
|
|
|
+ <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
</if>
|
|
|
</where>
|
|
|
- ) a left join (
|
|
|
- select * from msg_alarm
|
|
|
- <where>
|
|
|
- <if test="alarmType != null and alarmType != ''">
|
|
|
- and alarm_type = #{alarmType}
|
|
|
- </if>
|
|
|
- <if test="beginAlarmTime != null and beginAlarmTime != ''">
|
|
|
- and alarm_time >= #{beginAlarmTime}
|
|
|
- </if>
|
|
|
- <if test="endAlarmTime != null and endAlarmTime != ''">
|
|
|
- and alarm_time <= #{endAlarmTime}
|
|
|
- </if>
|
|
|
- <if test="isLock != null and isLock != ''">
|
|
|
- and is_lock = #{isLock}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- ) b on a.alarm_id = b.alarm_id left join (
|
|
|
- select * from base_camera_management
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="webAlarm" parameterType="com.ozs.service.entity.vo.MsgAlarmVo" resultType="com.ozs.service.entity.MsgAlarm">
|
|
|
+ select b.*
|
|
|
+ from msg_web_push AS a
|
|
|
+ join msg_alarm AS b on a.alarm_id = b.alarm_id
|
|
|
+ join base_camera_management AS c on b.camera_code = c.camera_code
|
|
|
<where>
|
|
|
- <if test="railwayCode != null and railwayCode != ''">
|
|
|
- and railway_code = #{railwayCode}
|
|
|
- </if>
|
|
|
- <if test="beginMile != null and beginMile != ''">
|
|
|
- and begin_mile >= #{beginMile}
|
|
|
- </if>
|
|
|
- <if test="endMile != null and endMile != ''">
|
|
|
- and end_mile <= #{endMile}
|
|
|
+ status = 1
|
|
|
+ <if test="!dsFlay">
|
|
|
+ and
|
|
|
+ <trim prefix="(" prefixOverrides="or" suffix=")">
|
|
|
+ <if test="dsUserId != null and dsUserId != ''">
|
|
|
+ or a.receive_by = #{dsUserId}
|
|
|
+ </if>
|
|
|
+ <if test="dsDeptId != null and dsDeptId != 0">
|
|
|
+ or c.dept_id = #{dsDeptId}
|
|
|
+ </if>
|
|
|
+ <if test="dsDeptIds != null">
|
|
|
+ or c.dept_id in
|
|
|
+ <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
</if>
|
|
|
</where>
|
|
|
- ) c on b.camera_code = c.camera_code
|
|
|
</select>
|
|
|
|
|
|
- <select id="messageMoreCount" parameterType="com.ozs.service.entity.vo.MsgAlarmVo" resultType="java.lang.Integer">
|
|
|
- select count(b.*) from (
|
|
|
- select alarm_id from msg_web_push
|
|
|
+ <select id="messageMore" parameterType="com.ozs.service.entity.vo.MsgAlarmVo"
|
|
|
+ resultType="com.ozs.service.entity.MsgAlarm">
|
|
|
+ select b.*
|
|
|
+ from msg_web_push AS a
|
|
|
+ join msg_alarm AS b on a.alarm_id = b.alarm_id
|
|
|
+ join base_camera_management AS c on b.camera_code = c.camera_code
|
|
|
<where>
|
|
|
- <if test="status != null and status != ''">
|
|
|
- and status = #{status}
|
|
|
- </if>
|
|
|
- <if test="userIds != null and userIds != ''">
|
|
|
- and receive_by in
|
|
|
- <foreach item="item" collection="userIds" index="index" separator="," open="(" close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
+ <if test="!dsFlay">
|
|
|
+ and
|
|
|
+ <trim prefix="(" prefixOverrides="or" suffix=")">
|
|
|
+ <if test="dsUserId != null and dsUserId != ''">
|
|
|
+ or a.receive_by = #{dsUserId}
|
|
|
+ </if>
|
|
|
+ <if test="dsDeptId != null and dsDeptId != 0">
|
|
|
+ or c.dept_id = #{dsDeptId}
|
|
|
+ </if>
|
|
|
+ <if test="dsDeptIds != null">
|
|
|
+ or c.dept_id in
|
|
|
+ <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
</if>
|
|
|
- </where>
|
|
|
- ) a left join (
|
|
|
- select * from msg_alarm
|
|
|
- <where>
|
|
|
<if test="alarmType != null and alarmType != ''">
|
|
|
- and alarm_type = #{alarmType}
|
|
|
+ and b.alarm_type = #{alarmType}
|
|
|
</if>
|
|
|
<if test="beginAlarmTime != null and beginAlarmTime != ''">
|
|
|
- and alarm_time >= #{beginAlarmTime}
|
|
|
+ and b.alarm_time >= #{beginAlarmTime}
|
|
|
</if>
|
|
|
<if test="endAlarmTime != null and endAlarmTime != ''">
|
|
|
- and alarm_time <= #{endAlarmTime}
|
|
|
+ and b.alarm_time <= #{endAlarmTime}
|
|
|
</if>
|
|
|
<if test="isLock != null and isLock != ''">
|
|
|
- and is_lock = #{isLock}
|
|
|
+ and b.is_lock = #{isLock}
|
|
|
</if>
|
|
|
- </where>
|
|
|
- ) b on a.alarm_id = b.alarm_id left join (
|
|
|
- select * from base_camera_management
|
|
|
- <where>
|
|
|
<if test="railwayCode != null and railwayCode != ''">
|
|
|
- and railway_code = #{railwayCode}
|
|
|
+ and c.railway_code = #{railwayCode}
|
|
|
</if>
|
|
|
<if test="beginMile != null and beginMile != ''">
|
|
|
- and begin_mile >= #{beginMile}
|
|
|
+ and c.begin_mile >= #{beginMile}
|
|
|
</if>
|
|
|
<if test="endMile != null and endMile != ''">
|
|
|
- and end_mile <= #{endMile}
|
|
|
+ and c.end_mile <= #{endMile}
|
|
|
</if>
|
|
|
</where>
|
|
|
- ) c on b.camera_code = c.camera_code
|
|
|
</select>
|
|
|
|
|
|
<select id="messageMoreNum" parameterType="com.ozs.service.entity.vo.MsgAlarmVo" resultType="java.util.Map">
|
|
|
- select count(id) count, SUM(CASE status WHEN '1' THEN 1 ELSE 0 end) AS 'noCount' from msg_web_push
|
|
|
+ select count(1) count, SUM(CASE a.status WHEN '1' THEN 1 ELSE 0 end) AS 'noCount' from msg_web_push AS a join msg_alarm AS b on a.alarm_id = b.alarm_id join base_camera_management AS c on b.camera_code = c.camera_code
|
|
|
<where>
|
|
|
- <if test="userIds != null and userIds != ''">
|
|
|
- and receive_by in
|
|
|
- <foreach item="item" collection="userIds" index="index" separator="," open="(" close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
+ <if test="!dsFlay">
|
|
|
+ and
|
|
|
+ <trim prefix="(" prefixOverrides="or" suffix=")">
|
|
|
+ <if test="dsUserId != null and dsUserId != ''">
|
|
|
+ or a.receive_by = #{dsUserId}
|
|
|
+ </if>
|
|
|
+ <if test="dsDeptId != null and dsDeptId != 0">
|
|
|
+ or c.dept_id = #{dsDeptId}
|
|
|
+ </if>
|
|
|
+ <if test="dsDeptIds != null">
|
|
|
+ or c.dept_id in
|
|
|
+ <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|