Selaa lähdekoodia

mapper文件移植

gao.qiang 2 vuotta sitten
vanhempi
commit
c8b966509f

+ 83 - 0
business-service/src/main/resources/mapper/BaseCameraManagementMapper.xml

@@ -0,0 +1,83 @@
+<?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.ozs.mapper.BaseCameraManagementMapper">
+
+
+    <select id="selectCameraManagementList" resultType="com.ozs.entity.BaseCameraManagement" parameterType="com.ozs.entity.vo.BaseCameraManagementVo">
+        SELECT
+        a.id  AS id,
+        a.camera_code AS cameraCode,
+        a.railway_code AS railwayCode,
+        a.channel AS channel,
+        a.dept_id AS deptId,
+        a.line_dir AS lineDir,
+        a.install_mile AS installMile,
+        a.begin_mile AS beginMile,
+        a.end_mile AS endMile,
+        a.install_longitude AS installLongitude,
+        a.install_latitude AS installLatitude,
+        a.card_num AS cardNum,
+        a.start_recording AS startRecording,
+        a.task_id AS taskId,
+        a.create_time AS createTime
+        FROM
+        base_camera_management a
+        <where>
+            <if test="railwayCode != null and railwayCode != ''">
+                and a.railway_code=#{railwayCode}
+            </if>
+            <if test="lineDir != null and lineDir != 0">
+                and a.line_dir =#{lineDir}
+            </if>
+            <if test="deptId != null and deptId != 0">
+                and a.dept_id =#{deptId}
+            </if>
+            <if test="beginMile != null and beginMile != 0">
+                and a.begin_mile &gt;=#{beginMile}
+            </if>
+            <if test="endMile != null and endMile != 0">
+                and a.end_mile &lt;=#{endMile}
+            </if>
+            <if test="!dsFlay">
+                and
+                <trim prefix="(" prefixOverrides="or" suffix=")">
+                <if test="dsUserId != null and dsUserId != ''">
+                    or a.create_by=#{dsUserId}  
+                </if>
+                <if test="dsDeptId != null and dsDeptId != 0">
+                    or  a.dept_id=#{dsDeptId}  
+                </if>
+                <if test="dsDeptIds != null">
+                    or a.dept_id in
+                    <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
+                        #{item}
+                    </foreach>
+                </if>
+                </trim>
+            </if>
+        </where>
+    </select>
+
+    <select id="countCamera" parameterType="com.ozs.entity.vo.MsgAlarmVo" resultType="java.lang.Integer">
+        select count(id) from base_camera_management
+        <where>
+            <if test="!dsFlay">
+                and
+                <trim prefix="(" prefixOverrides="or" suffix=")">
+                    <if test="dsUserId != null and dsUserId != ''">
+                        or create_by = #{dsUserId}
+                    </if>
+                    <if test="dsDeptId != null and dsDeptId != 0">
+                        or dept_id = #{dsDeptId}
+                    </if>
+                    <if test="dsDeptIds != null">
+                        or dept_id in
+                        <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
+                            #{item}
+                        </foreach>
+                    </if>
+                </trim>
+            </if>
+        </where>
+    </select>
+</mapper>

+ 7 - 0
business-service/src/main/resources/mapper/BaseDeptMapper.xml

@@ -0,0 +1,7 @@
+<?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.ozs.mapper.BaseDeptMapper">
+    <select id="selectDeptByDeptName" parameterType="string"  resultType="java.lang.Long">
+		select dept_id from sys_dept where dept_name = #{deptName}
+	</select>
+</mapper>

+ 46 - 0
business-service/src/main/resources/mapper/BaseDeviceDynamicManagementMapper.xml

@@ -0,0 +1,46 @@
+<?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.ozs.mapper.BaseDeviceDynamicManagementMapper">
+
+    <select id="list" resultType="com.ozs.entity.vo.BaseCameraManagementDto" parameterType="com.ozs.entity.vo.CameraTreeVo">
+		SELECT
+			l.railway_code AS railwayCode, 
+			l.railway_name AS railwayName, 
+			a.camera_code AS cameraCode, 
+			a.line_dir AS lineDir, 
+			a.install_mile AS installMile, 
+			a.id AS id
+		FROM
+		    base_camera_management AS a inner join
+		    base_railway_management AS l  on  a.railway_code=l.railway_code
+		<where>
+			<if test="railwayCode != null and railwayCode !=''">
+				concat(l.railway_name,a.camera_code)
+				like concat("%",#{railwayCode},"%")
+			</if>
+			<if test="lineDir != null and lineDir != ''">
+				line_dir = #{lineDir}
+			</if>
+			<if test="mils != null and mils != ''">
+				concat(a.install_mile, a.begin_mile, a.end_mile) = #{mils}
+			</if>
+			<if test="!dsFlay">
+				and
+				<trim prefix="(" prefixOverrides="or" suffix=")">
+					<if test="dsUserId != null and dsUserId != ''">
+						or a.create_by=#{dsUserId}
+					</if>
+					<if test="dsDeptId != null and dsDeptId != 0">
+						or  a.dept_id=#{dsDeptId}
+					</if>
+					<if test="dsDeptIds != null">
+						or a.dept_id in
+						<foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
+							#{item}
+						</foreach>
+					</if>
+				</trim>
+			</if>
+		</where>
+    </select>
+</mapper>

+ 8 - 0
business-service/src/main/resources/mapper/BaseRailwayManagementMapper.xml

@@ -0,0 +1,8 @@
+<?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.ozs.mapper.BaseRailwayManagementMapper">
+
+    <select id="getCameraNameByCameraCode" resultType="java.lang.String" parameterType="java.lang.String">
+        select railway_name railwayName from base_railway_management where railway_code = #{cameraCode}
+    </select>
+</mapper>

+ 81 - 0
business-service/src/main/resources/mapper/BaseUserMapper.xml

@@ -0,0 +1,81 @@
+<?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.ozs.mapper.BaseUserMapper">
+
+    <select id="getUserIdList" resultType="java.lang.String" parameterType="java.lang.String">
+        select user_id
+        from sys_user
+        where user_id = #{userId}
+          and data_permission = 1
+    </select>
+
+    <select id="getUserIdByDeptId" resultType="java.lang.String" parameterType="java.lang.Long">
+        select user_id
+        from sys_user
+        where dept_id = #{deptId}
+          and data_permission = 2
+    </select>
+
+    <select id="getDeptId" resultType="java.lang.Long" parameterType="java.lang.Long">
+        select dept_id
+        from sys_dept
+        where dept_id = #{deptId} or find_in_set(#{deptId}, ancestors)
+    </select>
+
+    <select id="getUserIdByDeptIds" resultType="java.lang.String" parameterType="java.util.List">
+        select user_id
+        from sys_user
+        where data_permission = 3 and dept_id in
+        <foreach item="item" collection="deptList" separator="," open="(" close=")" index="">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="getUserIdByDeptIdAndUserId" resultType="java.lang.String">
+        select user_id
+        from sys_user
+        where (user_id = #{userId} or dept_id = #{deptId})
+          and data_permission = 4
+    </select>
+
+    <select id="getUserIdListBy5" resultType="java.lang.String" parameterType="java.lang.String">
+        select user_id
+        from sys_user
+        where user_id = #{userId}
+          and data_permission = 5
+    </select>
+
+    <select id="getUserIdByDeptIdsBy5" resultType="string" parameterType="list">
+        select user_id
+        from sys_user
+        where dept_id in
+        <foreach item="item" collection="deptList" separator="," open="(" close=")" index="">
+            #{item}
+        </foreach>
+        and data_permission = 5
+    </select>
+
+    <select id="getUserIdList6" resultType="java.lang.String">
+        select user_id
+        from sys_user
+        where data_permission = 6
+    </select>
+
+    <select id="getUser" resultType="com.ozs.entity.BaseUser" parameterType="java.lang.String">
+        select user_id userId, dept_id deptId, data_permission dataPermission,nick_name nickName,user_name userName from sys_user where user_id = #{userId}
+    </select>
+    <select id="getUserName" resultType="com.ozs.entity.BaseUser" parameterType="java.lang.String">
+        select user_id userId, dept_id deptId, data_permission dataPermission from sys_user where user_name = #{userName}
+    </select>
+    <select id="getUserIdsList" resultType="java.lang.String">
+        select user_id
+        from sys_user
+    </select>
+    <select id="getRoleName" resultType="java.lang.String" parameterType="java.lang.String">
+        SELECT  r.role_key FROM `sys_user` u JOIN sys_user_role ur ON u.id=ur.user_id JOIN sys_role r 
+         ON ur.role_id=r.role_id WHERE u.user_id=#{userId}
+    </select>
+    <select id="getUserById" resultType="com.ozs.entity.BaseUser">
+    select user_id userId, dept_id deptId, data_permission dataPermission,nick_name nickName,user_name userName from sys_user where id = #{id}
+    </select>
+</mapper>

+ 5 - 0
business-service/src/main/resources/mapper/MsgAlarmFrequencyMapper.xml

@@ -0,0 +1,5 @@
+<?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.ozs.mapper.MsgAlarmFrequencyMapper">
+
+</mapper>

+ 374 - 0
business-service/src/main/resources/mapper/MsgAlarmMapper.xml

@@ -0,0 +1,374 @@
+<?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.ozs.mapper.MsgAlarmMapper">
+    <resultMap id="AlarmStatisticVoResult" type="com.ozs.entity.vo.AlarmStatisticVo">
+        <id column="id" property="id"/>
+        <result column="alarm_id" property="alarmId"/>
+        <result column="railway_name" property="railwayName"/>
+        <result column="camera_code" property="cameraCode"/>
+        <result column="alarm_time" property="alarmTime"/>
+        <result column="remark" property="remark"/>
+        <result column="released_reason" property="releasedReason"/>
+        <result column="released_type" property="releasedType"/>
+        <result column="alarm_mile" property="alarmMile"/>
+        <result column="content" property="content"/>
+        <result column="alarm_confidence" property="alarmConfidence"/>
+        <result column="line_dir" property="lineDir"/>
+        <result column="alarm_type" property="alarmType"/>
+        <result column="alarm_attr" property="alarmAttr"/>
+        <result column="image_url" property="imageUrl"/>
+        <result column="released_by" property="releasedBy"/>
+        <result column="released_time" property="releasedTime"/>
+        <result column="is_lock" property="isLock"/>
+    </resultMap>
+
+    <select id="list" resultMap="AlarmStatisticVoResult">
+        SELECT
+        a.alarm_id ,
+        a.camera_code ,
+        a.alarm_time ,
+        a.alarm_mile,
+        a.content ,
+        a.alarm_confidence ,
+        a.line_dir,
+        a.alarm_type,
+        a.alarm_attr,
+        a.image_url,
+        a.released_by ,
+        a.released_time,
+        a.released_reason,
+        a.released_type,
+        c.railway_name,
+        a.remark,
+        a.is_lock
+        FROM
+        msg_alarm AS a inner join
+        base_camera_management AS b on a.camera_code=b.camera_code left join
+        msg_web_push m on a.alarm_id = m.alarm_id left join
+        base_railway_management c on b.railway_code=c.railway_code
+
+        <where>
+            <if test="railwayCode != null and railwayCode != ''">
+                and UPPER(b.railway_code) like UPPER(CONCAT('%',#{railwayCode},'%'))
+            </if>
+            <if test="currentYear != null and currentYear != 0">
+                and YEAR(a.alarm_time) like UPPER(CONCAT('%',#{currentYear},'%'))
+            </if>
+            <if test="currentYear == null or currentYear == ''">
+                and YEAR(a.alarm_time) = YEAR(SYSDATE())
+            </if>
+            <if test="currentMonth != null and currentMonth != 0">
+                and MONTH(a.alarm_time) =#{currentMonth}
+            </if>
+            <if test="alarmType != null and alarmType != ''">
+                and UPPER(a.alarm_type) like UPPER(CONCAT('%',#{alarmType},'%'))
+            </if>
+            <if test="userId != null and userId != ''">
+                and UPPER(m.receive_by) like UPPER(CONCAT('%',#{userId},'%'))
+            </if>
+        </where>
+        group by a.alarm_id
+    </select>
+
+    <resultMap id="AlarmStatisticDtoResult" type="com.ozs.entity.vo.AlarmStatisticDto">
+        <id column="id" property="id"/>
+        <result column="alarmId" property="alarmId"/>
+        <result column="cameraCode" property="cameraCode"/>
+        <result column="alarmTime" property="alarmTime"/>
+        <result column="alarmMile" property="alarmMile"/>
+        <result column="content" property="content"/>
+        <result column="alarmConfidence" property="alarmConfidence"/>
+        <result column="lineDir" property="lineDir"/>
+        <result column="alarmType" property="alarmType"/>
+        <result column="alarmAttr" property="alarmAttr"/>
+        <result column="imageUrl" property="imageUrl"/>
+        <result column="releasedBy" property="releasedBy"/>
+        <result column="releasedTime" property="releasedTime"/>
+        <result column="releasedReason" property="releasedReason"/>
+        <result column="releasedType" property="releasedType"/>
+        <result column="railwayName" property="railwayName"/>
+        <result column="remark" property="remark"/>
+        <result column="isLock" property="isLock"/>
+    </resultMap>
+    <select id="listDto" resultMap="AlarmStatisticDtoResult">
+        SELECT
+        a.alarm_id AS alarmId,
+        a.camera_code AS cameraCode,
+        a.alarm_time AS alarmTime,
+        a.alarm_mile AS alarmMile,
+        a.content AS content,
+        a.alarm_confidence AS alarmConfidence,
+        a.line_dir AS lineDir,
+        a.alarm_type AS alarmType,
+        a.alarm_attr AS alarmAttr,
+        a.image_url AS imageUrl,
+        a.released_by AS releasedBy,
+        a.released_time AS releasedTime,
+        a.released_reason AS releasedReason,
+        a.released_type AS releasedType,
+        c.railway_name AS railwayName,
+        a.remark AS remark,
+        a.is_lock AS isLock
+        FROM
+        msg_alarm AS a inner join
+        base_camera_management AS b on a.camera_code=b.camera_code left join
+        msg_web_push m on a.alarm_id = m.alarm_id left join
+        base_railway_management c on b.railway_code=c.railway_code
+
+        <where>
+            <if test="railwayCode != null and railwayCode != ''">
+                and UPPER(b.railway_code) like UPPER(CONCAT('%',#{railwayCode},'%'))
+            </if>
+            <if test="currentYear != null and currentYear != 0">
+                and YEAR(a.alarm_time) like UPPER(CONCAT('%',#{currentYear},'%'))
+            </if>
+            <if test="currentYear == null or currentYear == ''">
+                and YEAR(a.alarm_time) = YEAR(SYSDATE())
+            </if>
+            <if test="currentMonth != null and currentMonth != 0">
+                and MONTH(a.alarm_time) =#{currentMonth}
+            </if>
+            <if test="alarmType != null and alarmType != ''">
+                and UPPER(a.alarm_type) like UPPER(CONCAT('%',#{alarmType},'%'))
+            </if>
+            <if test="userId != null and userId != ''">
+                and UPPER(m.receive_by) like UPPER(CONCAT('%',#{userId},'%'))
+            </if>
+        </where>
+        group by a.alarm_id
+    </select>
+    <resultMap id="AlarmStatisticMonthDtoResult" type="com.ozs.entity.vo.AlarmStatisticMonthDto">
+        <id column="id" property="id"/>
+        <result column="monthsta" property="monthsta"/>
+        <result column="monthstaString" property="monthstaString"/>
+        <result column="frequency" property="frequency"/>
+        <result column="alarm_type" property="alarmType"/>
+    </resultMap>
+    <select id="listDtoMonth" resultMap="AlarmStatisticMonthDtoResult">
+        SELECT p.monthsta as monthsta,sum(p.fre) as frequency,p.monthstaString as monthstaString
+        from
+        (SELECT
+        DATE_FORMAT(a.alarm_time,'%Y年%m月') as monthstaString,
+        MONTH(a.alarm_time) as monthsta,
+        count(DISTINCT a.alarm_id) as fre
+        FROM
+        msg_alarm AS a inner join
+        base_camera_management AS b on a.camera_code=b.camera_code left join
+        msg_web_push m on a.alarm_id = m.alarm_id left join
+        base_railway_management c on b.railway_code=c.railway_code
+
+        <where>
+            <if test="railwayCode != null and railwayCode != ''">
+                and UPPER(b.railway_code) like UPPER(CONCAT('%',#{railwayCode},'%'))
+            </if>
+            <if test="currentYear != null and currentYear != 0">
+                and YEAR(a.alarm_time) like UPPER(CONCAT('%',#{currentYear},'%'))
+            </if>
+            <if test="currentYear == null or currentYear == ''">
+                and YEAR(a.alarm_time) = YEAR(SYSDATE())
+            </if>
+            <if test="currentMonth != null and currentMonth != 0">
+                and MONTH(a.alarm_time) =#{currentMonth}
+            </if>
+            <if test="alarmType != null and alarmType != ''">
+                and UPPER(a.alarm_type) like UPPER(CONCAT('%',#{alarmType},'%'))
+            </if>
+            <if test="userId != null and userId != ''">
+                and UPPER(m.receive_by) like UPPER(CONCAT('%',#{userId},'%'))
+            </if>
+        </where>
+        group by a.alarm_id) AS p group by p.monthsta order by p.monthsta
+    </select>
+
+    <select id="listDtoDay" resultMap="AlarmStatisticMonthDtoResult">
+        SELECT p.daysta as monthsta,sum(p.fre) as frequency,p.daystaString as monthstaString
+        from
+        (SELECT
+        DATE_FORMAT(a.alarm_time,'%Y年%m月%d日') as daystaString,
+        DAY(a.alarm_time) as daysta,
+        count(DISTINCT a.alarm_id) as fre
+        FROM
+        msg_alarm AS a inner join
+        base_camera_management AS b on a.camera_code=b.camera_code left join
+        msg_web_push m on a.alarm_id = m.alarm_id left join
+        base_railway_management c on b.railway_code=c.railway_code
+
+        <where>
+            <if test="railwayCode != null and railwayCode != ''">
+                and UPPER(b.railway_code) like UPPER(CONCAT('%',#{railwayCode},'%'))
+            </if>
+            <if test="currentYear != null and currentYear != 0">
+                and YEAR(a.alarm_time) like UPPER(CONCAT('%',#{currentYear},'%'))
+            </if>
+            <if test="currentYear == null or currentYear == ''">
+                and YEAR(a.alarm_time) = YEAR(SYSDATE())
+            </if>
+            <if test="currentMonth != null and currentMonth != 0">
+                and MONTH(a.alarm_time) =#{currentMonth}
+            </if>
+            <if test="alarmType != null and alarmType != ''">
+                and UPPER(a.alarm_type) like UPPER(CONCAT('%',#{alarmType},'%'))
+            </if>
+            <if test="userId != null and userId != ''">
+                and UPPER(m.receive_by) like UPPER(CONCAT('%',#{userId},'%'))
+            </if>
+        </where>
+        group by a.alarm_id) AS p group by p.daysta order by p.daysta
+    </select>
+    <select id="selectCameraCode" parameterType="java.lang.String" resultType="java.lang.Integer">
+        select is_lock from msg_alarm where camera_code = #{cameraCode} ORDER BY alarm_time DESC LIMIT 1
+    </select>
+
+    <select id="selectByCameraCode" parameterType="java.lang.String" resultType="com.ozs.entity.MsgAlarm">
+        select * from msg_alarm where camera_code = #{cameraCode} order by alarm_time desc limit 1
+    </select>
+    <select id="selectMsgAlarmList" resultType="com.ozs.entity.MsgAlarm"
+            parameterType="com.ozs.entity.vo.MsgAlarmVo">
+        SELECT
+        a.alarm_id AS alarmId,
+        a.alarm_time AS alarmTime,
+        a.alarm_mile AS alarmMile,
+        a.line_dir AS lineDir,
+        a.alarm_type AS alarmType,
+        a.camera_code AS cameraCode,
+        a.id  AS id,
+        a.content AS content,
+        a.alarm_confidence AS alarmConfidence,
+        a.alarm_attr AS alarmAttr,
+        a.image_url AS imageUrl,
+        a.released_by AS releasedBy,
+        a.is_lock AS isLock,
+        a.released_time AS releasedTime,
+        a.released_type AS releasedType,
+        a.released_reason AS releasedReason,
+        a.remark AS remark
+        FROM
+        msg_alarm AS a  join
+        base_camera_management AS b on a.camera_code=b.camera_code
+        <where>
+            <if test="railwayCode != null and railwayCode != ''">
+                and b.railway_code=#{railwayCode}
+            </if>
+            <if test="beginMile != null and beginMile != 0">
+                and b.begin_mile &gt;=#{beginMile}
+            </if>
+            <if test="endMile != null and endMile != 0">
+                and b.end_mile &lt;=#{endMile}
+            </if>
+            <if test="!dsFlay">
+                and
+                <trim prefix="(" prefixOverrides="or" suffix=")">
+                <if test="dsUserId != null and dsUserId != ''">
+                    or  a.create_by=#{dsUserId}
+                </if>
+                <if test="dsDeptId != null and dsDeptId != 0">
+                    or b.dept_id=#{dsDeptId}
+                </if>
+                <if test="dsDeptIds != null">
+                    or b.dept_id in
+                    <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
+                        #{item}
+                    </foreach>
+                </if>
+                </trim>
+            </if>
+            <if test="alarmType != null and alarmType != 0">
+                and a.alarm_type=#{alarmType}
+            </if>
+            <if test="alarmMile != null and alarmMile != 0">
+                and a.alarm_mile=#{alarmMile}
+            </if>
+            <if test="isLock != null and isLock != 0">
+                and a.is_lock=#{isLock}
+            </if>
+            <if test="lineDir != null and lineDir != 0">
+                and a.line_dir =#{lineDir}
+            </if>
+            <if test="releasedType != null and releasedType != 0">
+                and a.released_type =#{releasedType}
+            </if>
+            <if test="beginAlarmTime != null and beginAlarmTime != ''">
+                and date_format(a.alarm_time,'%Y-%m-%d %H:%i:%S') &gt;= date_format(#{beginAlarmTime},'%Y-%m-%d %H:%i:%S')
+            </if>
+            <if test="endAlarmTime != null and endAlarmTime != ''">
+                AND date_format(a.alarm_time,'%Y-%m-%d %H:%i:%S') &lt;= date_format(#{endAlarmTime},'%Y-%m-%d %H:%i:%S')
+            </if>
+        </where>
+        order by  a.alarm_time desc
+    </select>
+
+    <select id="getByAlarmId" resultType="com.ozs.entity.MsgAlarm" parameterType="java.lang.String">
+        select * from msg_alarm where alarm_id = #{alarmId}
+    </select>
+
+    <select id="countMsg" parameterType="com.ozs.entity.vo.MsgAlarmVo" resultType="java.lang.Integer">
+        select count(1) from msg_alarm AS a join base_camera_management AS b on a.camera_code = b.camera_code
+        <where>
+            <if test="!dsFlay">
+                and
+                <trim prefix="(" prefixOverrides="or" suffix=")">
+                    <if test="dsUserId != null and dsUserId != ''">
+                        or a.create_by = #{dsUserId}
+                    </if>
+                    <if test="dsDeptId != null and dsDeptId != 0">
+                        or b.dept_id = #{dsDeptId}
+                    </if>
+                    <if test="dsDeptIds != null">
+                        or b.dept_id in
+                        <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
+                            #{item}
+                        </foreach>
+                    </if>
+                </trim>
+            </if>
+        </where>
+    </select>
+
+    <select id="countJC" parameterType="com.ozs.entity.vo.MsgAlarmVo" resultType="java.lang.Integer">
+        select count(1) from msg_alarm AS a  join base_camera_management AS b on a.camera_code=b.camera_code
+        <where>
+            is_lock = 1
+            <if test="!dsFlay">
+                and
+                <trim prefix="(" prefixOverrides="or" suffix=")">
+                    <if test="dsUserId != null and dsUserId != ''">
+                        or a.create_by = #{dsUserId}
+                    </if>
+                    <if test="dsDeptId != null and dsDeptId != 0">
+                        or b.dept_id = #{dsDeptId}
+                    </if>
+                    <if test="dsDeptIds != null">
+                        or b.dept_id in
+                        <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
+                            #{item}
+                        </foreach>
+                    </if>
+                </trim>
+            </if>
+        </where>
+    </select>
+
+    <select id="countWJC" parameterType="com.ozs.entity.vo.MsgAlarmVo" resultType="java.lang.Integer">
+        select count(1) from msg_alarm AS a  join base_camera_management AS b on a.camera_code=b.camera_code
+        <where>
+            is_lock = 2
+            <if test="!dsFlay">
+                and
+                <trim prefix="(" prefixOverrides="or" suffix=")">
+                    <if test="dsUserId != null and dsUserId != ''">
+                        or a.create_by = #{dsUserId}
+                    </if>
+                    <if test="dsDeptId != null and dsDeptId != 0">
+                        or b.dept_id = #{dsDeptId}
+                    </if>
+                    <if test="dsDeptIds != null">
+                        or b.dept_id in
+                        <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
+                            #{item}
+                        </foreach>
+                    </if>
+                </trim>
+            </if>
+        </where>
+    </select>
+</mapper>

+ 106 - 0
business-service/src/main/resources/mapper/MsgAppPushMapper.xml

@@ -0,0 +1,106 @@
+<?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.ozs.mapper.MsgAppPushMapper">
+    <resultMap id="MsgAppPushVoResult" type="com.ozs.entity.vo.MsgAppPushVo">
+        <id column="id" property="id"/>
+        <result column="alarm_id" property="alarmId"/>
+        <result column="receive_by" property="receiveBy"/>
+        <result column="status" property="status"/>
+        <result column="create_by" property="createBy"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_by" property="updateBy"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="remark" property="remark"/>
+        <result column="lineDir" property="lineDir"/>
+        <result column="railwayName" property="railwayName"/>
+        <result column="railwayType" property="railwayType"/>
+        <result column="alarmMile" property="alarmMile"/>
+        <result column="alarmType" property="alarmType"/>
+        <result column="alarmAttr" property="alarmAttr"/>
+        <result column="imageUrl" property="imageUrl"/>
+        <association property="baseCameraManagement" javaType="com.ozs.entity.BaseCameraManagement">
+            <id column="id" property="id"/>
+            <result column="railway_code" property="railwayCode"/>
+            <result column="channel" property="channel"/>
+            <result column="install_mile" property="installMile"/>
+            <result column="begin_mile" property="beginMile"/>
+            <result column="end_mile" property="endMile"/>
+            <result column="install_longitude" property="installLongitude"/>
+            <result column="install_latitude" property="installLatitude"/>
+        </association>
+    </resultMap>
+    <select id="alarmPushMsg" resultMap="MsgAppPushVoResult" parameterType="com.ozs.entity.vo.MsgAppPushVo">
+        select
+        m.id,
+        m.alarm_id,
+        m.receive_by,
+        a.line_dir AS lineDir,
+        a.alarm_mile AS alarmMile,
+        a.alarm_type AS alarmType,
+        a.alarm_attr AS alarmAttr,
+        a.image_url AS imageUrl,
+        m.status,
+        m.create_by,
+        m.create_time,
+        m.update_by,
+        m.update_time,
+        m.remark,
+        b.railway_code AS railway_code,
+        r.railway_name AS railwayName,
+        r.railway_type AS railwayType,
+        b.channel AS channel,
+        b.install_mile AS install_mile,
+        b.begin_mile AS begin_mile,
+        b.end_mile AS end_mile,
+        b.install_longitude AS install_longitude,
+        b.install_latitude AS install_latitude
+        from msg_app_push m join
+        msg_alarm AS a on m.alarm_id=a.alarm_id join
+        base_camera_management AS b on a.camera_code=b.camera_code join
+        base_railway_management AS r on b.railway_code=r.railway_code
+        <where>
+            <if test="status != null and status != 0">
+                and status = #{status}
+            </if>
+            <if test="receiveBy != null and receiveBy != ''">
+                and receive_by = #{receiveBy}
+            </if>
+        </where>
+    </select>
+
+    <update id="update" parameterType="com.ozs.entity.MsgAppPush">
+        update msg_app_push
+        <set>
+            <if test="status != null and status != 0">
+                status = #{status},
+            </if>
+            <if test="updateBy != null and updateBy != ''">
+                update_by = #{updateBy},
+            </if>
+            update_time = sysdate()
+        </set>
+        <where>
+            <if test="pushId != null and pushId != ''">
+                and push_id = #{pushId}
+            </if>
+            <if test="id != null and id != 0">
+                and push_id = #{id}
+            </if>
+        </where>
+    </update>
+
+    <select id="messageMoreApp" parameterType="com.ozs.entity.vo.MsgAlarmVo" resultType="com.ozs.entity.MsgAlarm">
+        select b.*, a.status, a.push_id as msgId
+        from msg_app_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="userId != null and userId != ''">
+                and a.receive_by = #{userId}
+            </if>
+            <if test="status != null and status != 0">
+                and a.status = #{status}
+            </if>
+        </where>
+    </select>
+</mapper>

+ 91 - 0
business-service/src/main/resources/mapper/MsgWebPushMapper.xml

@@ -0,0 +1,91 @@
+<?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.ozs.mapper.MsgWebPushMapper">
+
+    <select id="webAlarmNum" parameterType="java.lang.String" resultType="java.lang.Integer">
+        select count(1) from msg_web_push where status = 1
+        <if test="userId != null and userId != ''">
+            and receive_by = #{userId}
+        </if>
+    </select>
+
+    <select id="webAlarm" parameterType="java.lang.String" resultType="com.ozs.entity.MsgAlarm">
+        select b.*, a.push_id as msgId
+        from msg_web_push AS a
+        join msg_alarm AS b on a.alarm_id = b.alarm_id
+        where a.status = 1
+        <if test="userId != null and userId != ''">
+            and a.receive_by = #{userId}
+        </if>
+    </select>
+
+    <select id="messageMore" parameterType="com.ozs.entity.vo.MsgAlarmVo" resultType="com.ozs.entity.MsgAlarm">
+        select b.*, a.status, a.push_id as msgId
+        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="userId != null and userId != ''">
+                and a.receive_by = #{userId}
+            </if>
+            <if test="status != null and status != ''">
+                and a.status = #{status}
+            </if>
+            <if test="alarmType != null and alarmType != ''">
+                and b.alarm_type = #{alarmType}
+            </if>
+            <if test="beginAlarmTime != null and beginAlarmTime != ''">
+                and b.alarm_time &gt;= #{beginAlarmTime}
+            </if>
+            <if test="endAlarmTime != null and endAlarmTime != ''">
+                and b.alarm_time &lt;= #{endAlarmTime}
+            </if>
+            <if test="isLock != null and isLock != ''">
+                and b.is_lock = #{isLock}
+            </if>
+            <if test="railwayCode != null and railwayCode != ''">
+                and c.railway_code = #{railwayCode}
+            </if>
+            <if test="beginMile != null and beginMile != ''">
+                and c.begin_mile &gt;= #{beginMile}
+            </if>
+            <if test="endMile != null and endMile != ''">
+                and c.end_mile &lt;= #{endMile}
+            </if>
+        </where>
+    </select>
+
+    <select id="messageMoreNum" parameterType="com.ozs.entity.vo.MsgAlarmVo" resultType="java.util.Map">
+        select count(1) count, SUM(CASE status WHEN '1' THEN 1 ELSE 0 end) AS 'noCount' from msg_web_push
+        <where>
+            <if test="userId != null and userId != ''">
+                and receive_by = #{userId}
+            </if>
+        </where>
+    </select>
+
+    <update id="updateByPushId" parameterType="com.ozs.entity.MsgWebPush">
+        update msg_web_push
+        <set>
+            <if test="status != null and status != 0">
+                status = #{status}
+            </if>
+        </set>
+        <where>
+            <if test="pushId != null and pushId != ''">
+                and push_id = #{pushId}
+            </if>
+            <if test="id != null and id != 0">
+                and id = #{id}
+            </if>
+        </where>
+    </update>
+
+    <update id="readAll" parameterType="java.lang.String">
+        update msg_web_push
+        <set>
+            status = 2
+        </set>
+        where receive_by = #{userId} and status = 1
+    </update>
+</mapper>

+ 5 - 0
business-service/src/main/resources/mapper/SvcAddressMapper.xml

@@ -0,0 +1,5 @@
+<?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.ozs.mapper.SvcAddressMapper">
+
+</mapper>

+ 21 - 0
business-service/src/main/resources/mapper/UserRegistrationidMapper.xml

@@ -0,0 +1,21 @@
+<?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.ozs.mapper.UserRegistrationidMapper">
+
+    <update id="updateRegistrationID" parameterType="com.ozs.entity.UserRegistrationid">
+        update user_registrationid
+        <set>
+            <if test="registrationId != null and registrationId != ''">
+                registration_id = #{registrationId}
+            </if>
+        </set>
+        where user_id = #{userId}
+    </update>
+
+    <select id="selectRegistrationID" resultType="java.lang.String" parameterType="java.util.List">
+        select registration_id from user_registrationid where user_id in
+        <foreach item="item" collection="userIdList" separator="," open="(" close=")" index="">
+            #{item}
+        </foreach>
+    </select>
+</mapper>

+ 94 - 0
vehicle-admin/src/main/java/com/ozs/web/common/CaptchaController.java

@@ -0,0 +1,94 @@
+package com.ozs.web.common;
+
+import com.google.code.kaptcha.Producer;
+import com.ozs.common.config.BaseConfig;
+import com.ozs.common.constant.CacheConstants;
+import com.ozs.common.constant.Constants;
+import com.ozs.common.core.domain.AjaxResult;
+import com.ozs.common.core.redis.RedisCache;
+import com.ozs.common.utils.sign.Base64;
+import com.ozs.common.utils.uuid.IdUtils;
+import com.ozs.system.service.ISysConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.FastByteArrayOutputStream;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletResponse;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 验证码操作处理
+ *
+ * @author ruoyi
+ */
+@RestController
+public class CaptchaController
+{
+    @Resource(name = "captchaProducer")
+    private Producer captchaProducer;
+
+    @Resource(name = "captchaProducerMath")
+    private Producer captchaProducerMath;
+
+    @Autowired
+    private RedisCache redisCache;
+
+    @Autowired
+    private ISysConfigService configService;
+    /**
+     * 生成验证码
+     */
+    @GetMapping("/captchaImage")
+    public AjaxResult getCode(HttpServletResponse response) throws IOException
+    {
+        AjaxResult ajax = AjaxResult.success();
+        boolean captchaEnabled = configService.selectCaptchaEnabled();
+        ajax.put("captchaEnabled", captchaEnabled);
+        if (!captchaEnabled) {
+            return ajax;
+        }
+
+        // 保存验证码信息
+        String uuid = IdUtils.simpleUUID();
+        String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
+
+        String capStr = null, code = null;
+        BufferedImage image = null;
+
+        // 生成验证码
+        String captchaType = BaseConfig.getCaptchaType();
+        if ("math".equals(captchaType))
+        {
+            String capText = captchaProducerMath.createText();
+            capStr = capText.substring(0, capText.lastIndexOf("@"));
+            code = capText.substring(capText.lastIndexOf("@") + 1);
+            image = captchaProducerMath.createImage(capStr);
+        }
+        else if ("char".equals(captchaType))
+        {
+            capStr = code = captchaProducer.createText();
+            image = captchaProducer.createImage(capStr);
+        }
+
+        redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
+        // 转换流信息写出
+        FastByteArrayOutputStream os = new FastByteArrayOutputStream();
+        try
+        {
+            ImageIO.write(image, "jpg", os);
+        }
+        catch (IOException e)
+        {
+            return AjaxResult.error(e.getMessage());
+        }
+
+        ajax.put("uuid", uuid);
+        ajax.put("img", Base64.encode(os.toByteArray()));
+        return ajax;
+    }
+}

+ 164 - 0
vehicle-admin/src/main/java/com/ozs/web/common/CommonController.java

@@ -0,0 +1,164 @@
+package com.ozs.web.common;
+
+import com.ozs.common.config.BaseConfig;
+import com.ozs.common.constant.Constants;
+import com.ozs.common.core.domain.AjaxResult;
+import com.ozs.common.utils.StringUtils;
+import com.ozs.common.utils.file.FileUploadUtils;
+import com.ozs.common.utils.file.FileUtils;
+import com.ozs.framework.config.ServerConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 通用请求处理
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/common")
+public class CommonController
+{
+    private static final Logger log = LoggerFactory.getLogger(CommonController.class);
+
+    @Autowired
+    private ServerConfig serverConfig;
+
+    private static final String FILE_DELIMETER = ",";
+
+    /**
+     * 通用下载请求
+     *
+     * @param fileName 文件名称
+     * @param delete 是否删除
+     */
+    @GetMapping("/download")
+    public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
+    {
+        try
+        {
+            if (!FileUtils.checkAllowDownload(fileName))
+            {
+                throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
+            }
+            String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
+            String filePath = BaseConfig.getDownloadPath() + fileName;
+
+            response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
+            FileUtils.setAttachmentResponseHeader(response, realFileName);
+            FileUtils.writeBytes(filePath, response.getOutputStream());
+            if (delete)
+            {
+                FileUtils.deleteFile(filePath);
+            }
+        }
+        catch (Exception e)
+        {
+            log.error("下载文件失败", e);
+        }
+    }
+
+    /**
+     * 通用上传请求(单个)
+     */
+    @PostMapping("/upload")
+    public AjaxResult uploadFile(MultipartFile file) throws Exception
+    {
+        try
+        {
+            // 上传文件路径
+            String filePath = BaseConfig.getUploadPath();
+            // 上传并返回新文件名称
+            String fileName = FileUploadUtils.upload(filePath, file);
+            String url = serverConfig.getUrl() + fileName;
+            AjaxResult ajax = AjaxResult.success();
+            ajax.put("url", url);
+            ajax.put("fileName", fileName);
+            ajax.put("newFileName", FileUtils.getName(fileName));
+            ajax.put("originalFilename", file.getOriginalFilename());
+            return ajax;
+        }
+        catch (Exception e)
+        {
+            return AjaxResult.error(e.getMessage());
+        }
+    }
+
+    /**
+     * 通用上传请求(多个)
+     */
+    @PostMapping("/uploads")
+    public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
+    {
+        try
+        {
+            // 上传文件路径
+            String filePath = BaseConfig.getUploadPath();
+            List<String> urls = new ArrayList<String>();
+            List<String> fileNames = new ArrayList<String>();
+            List<String> newFileNames = new ArrayList<String>();
+            List<String> originalFilenames = new ArrayList<String>();
+            for (MultipartFile file : files)
+            {
+                // 上传并返回新文件名称
+                String fileName = FileUploadUtils.upload(filePath, file);
+                String url = serverConfig.getUrl() + fileName;
+                urls.add(url);
+                fileNames.add(fileName);
+                newFileNames.add(FileUtils.getName(fileName));
+                originalFilenames.add(file.getOriginalFilename());
+            }
+            AjaxResult ajax = AjaxResult.success();
+            ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
+            ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
+            ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
+            ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
+            return ajax;
+        }
+        catch (Exception e)
+        {
+            return AjaxResult.error(e.getMessage());
+        }
+    }
+
+    /**
+     * 本地资源通用下载
+     */
+    @GetMapping("/download/resource")
+    public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
+            throws Exception
+    {
+        try
+        {
+            if (!FileUtils.checkAllowDownload(resource))
+            {
+                throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
+            }
+            // 本地资源路径
+            String localPath = BaseConfig.getProfile();
+            // 数据库资源地址
+            String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
+            // 下载名称
+            String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
+            response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
+            FileUtils.setAttachmentResponseHeader(response, downloadName);
+            FileUtils.writeBytes(downloadPath, response.getOutputStream());
+        }
+        catch (Exception e)
+        {
+            log.error("下载文件失败", e);
+        }
+    }
+}

+ 1 - 1
vehicle-admin/src/main/resources/application.yml

@@ -19,7 +19,7 @@ base:
 
 server:
   # 服务器的HTTP端口,默认为8080
-  port: 8080
+  port: 18810
   servlet:
     # 应用的访问路径
     context-path: /