123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- <?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.system.mapper.TEarlyWarningMapper">
- <resultMap type="TEarlyWarning" id="TEarlyWarningResult">
- <result property="id" column="id"/>
- <result property="userId" column="user_id"/>
- <result property="state" column="state"/>
- <result property="type" column="type"/>
- <result property="content" column="content"/>
- <result property="eventRecord" column="event_record"/>
- <result property="location" column="location"/>
- <result property="lng" column="lng"/>
- <result property="lat" column="lat"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="facilityId" column="facility_id"/>
- <result property="deviceIdCode" column="device_id_code"/>
- <result property="alarmId" column="alarm_id"/>
- <result property="typeDesc" column="type_desc" />
- </resultMap>
- <sql id="selectTEarlyWarningVo">
- select id,
- user_id,
- state,
- type,
- content,
- event_record,
- location,
- lng,
- lat,
- create_time,
- update_time,
- facility_id,
- device_id_code,
- alarm_id,
- type_desc
- from t_early_warning
- </sql>
- <select id="selectTEarlyWarningByAlarmId" parameterType="long" resultMap="TEarlyWarningResult">
- <include refid="selectTEarlyWarningVo"/>
- where alarm_id = #{alarmId}
- </select>
- <select id="selectTEarlyWarningList" parameterType="TEarlyWarning" resultMap="TEarlyWarningResult">
- <include refid="selectTEarlyWarningVo"/>
- <where>
- <if test="userId != null ">and user_id = #{userId}</if>
- <if test="state != null ">and state = #{state}</if>
- <if test="type != null ">and type = #{type}</if>
- <if test="content != null and content != ''">and content = #{content}</if>
- <if test="eventRecord != null and eventRecord != ''">and event_record = #{eventRecord}</if>
- <if test="location != null and location != ''">and location = #{location}</if>
- <if test="lng != null ">and lng = #{lng}</if>
- <if test="lat != null ">and lat = #{lat}</if>
- <if test="facilityId != null ">and facility_id = #{facilityId}</if>
- <if test="deviceIdCode != null and deviceIdCode != ''">and device_id_code = #{deviceIdCode}</if>
- <if test="alarmId != null ">and alarm_id = #{alarmId}</if>
- <if test="typeDesc != null and typeDesc != ''"> and type_desc = #{typeDesc}</if>
- </where>
- </select>
- <select id="selectTEarlyWarningById" parameterType="Long" resultMap="TEarlyWarningResult">
- <include refid="selectTEarlyWarningVo"/>
- where id = #{id}
- </select>
- <select id="selectTEarlyWarningList_SOS" resultType="com.ruoyi.system.domain.TEarlyWarning">
- select a.id,
- a.user_id,
- a.state,
- a.state as solve_status,
- a.type,
- a.type as alarm_type,
- a.content ,
- a.event_record,
- a.event_record as msg,
- a.location,
- a.location as address_desc,
- a.lng,
- a.lat,
- a.lng as gps_long,
- a.lat as gps_lat,
- a.create_time as createTime,
- a.update_time,
- a.facility_id,
- a.device_id_code,
- a.device_id_code as deviceIdCode,
- a.alarm_id,
- a.type_desc as typeDesc,
- a.type_desc as alarmMsg,
- b.name,
- b.tel_one,
- c.id as service_id,
- c.store_name,
- d.device_model
- from t_early_warning a
- left join t_user_profile b on a.user_id = b.id
- left join t_service_manage c on b.serviceid = c.id
- left join t_device_list d on a.device_id_code = d.device_id
- <where>
- <if test="type != null ">and a.type = #{type}</if>
- <if test="name != null ">and b.name = #{name}</if>
- <if test="solve_status != null ">and a.state = #{solve_status}</if>
- </where>
- </select>
- <select id="selectTEarlyWarningList_HEALTHSOLVE" resultType="com.ruoyi.system.domain.TEarlyWarning">
- select a.id,
- a.user_id,
- a.state,
- a.state as solve_status,
- a.type,
- a.type as alarm_type,
- a.content as alarmMsg,
- a.event_record,
- a.event_record as msg,
- a.location,
- a.location as address_desc,
- a.lng,
- a.lat,
- a.lng as gps_long,
- a.lat as gps_lat,
- a.create_time as createTime,
- a.update_time,
- a.facility_id,
- a.device_id_code,
- a.device_id_code as deviceIdCode,
- a.alarm_id,
- a.type_desc,
- b.name,
- b.tel_one,
- c.id as service_id,
- c.store_name,
- d.device_model
- from t_early_warning a
- left join t_user_profile b on a.user_id = b.id
- left join t_service_manage c on b.serviceid = c.id
- left join t_device_list d on a.device_id_code = d.device_id
- <where>
- and a.type >= 22
- and a.type <= 25
- <if test="name != null ">and b.name = #{name}</if>
- <if test="solve_status != null ">and a.state = #{solve_status}</if>
- </where>
- </select>
- <select id="selectTEarlyWarningList_OTHERSOLVE" resultType="com.ruoyi.system.domain.TEarlyWarning">
- select a.id,
- a.user_id,
- a.state,
- a.state as solve_status,
- a.type,
- a.type as alarm_type,
- a.content as alarmMsg,
- a.event_record,
- a.event_record as msg,
- a.location,
- a.location as address_desc,
- a.lng,
- a.lat,
- a.lng as gps_long,
- a.lat as gps_lat,
- a.create_time as createTime,
- a.update_time,
- a.facility_id,
- a.device_id_code,
- a.device_id_code as deviceIdCode,
- a.alarm_id,
- a.type_desc,
- b.name,
- b.tel_one,
- c.id as service_id,
- c.store_name,
- d.device_model
- from t_early_warning a
- left join t_user_profile b on a.user_id = b.id
- left join t_service_manage c on b.serviceid = c.id
- left join t_device_list d on a.device_id_code = d.device_id
- <where>
- and a.type != 16
- and a.type != 21
- and a.type != 22
- and a.type != 23
- and a.type != 24
- and a.type != 25
- <if test="name != null ">and b.name = #{name}</if>
- <if test="solve_status != null ">and a.state = #{solve_status}</if>
- </where>
- </select>
- <select id="selectTEarlyWarningCompletedCountByType" parameterType="Integer" resultType="java.lang.Integer">
- SELECT COUNT(*)
- FROM t_early_warning
- WHERE type = #{type}
- AND state = 1;
- </select>
- <select id="selectTEarlyWarningUnCompletedCountByType" parameterType="Integer" resultType="java.lang.Integer">
- SELECT COUNT(*)
- FROM t_early_warning
- WHERE type = #{type}
- AND state = 0;
- </select>
- <select id="selectTEarlyWarningUnCompletedPercentageByType" parameterType="Integer" resultType="java.lang.Double">
- SELECT (COUNT(CASE WHEN state = 1 THEN 0 END) / COUNT(*) * 100)
- FROM t_early_warning
- WHERE type = #{type}
- </select>
- <select id="selectTEarlyWarningUnCompletedPercentageByAllType" resultType="java.lang.Double">
- SELECT (COUNT(CASE WHEN state = 1 THEN 0 END) / COUNT(*) * 100)
- FROM t_early_warning
- </select>
- <insert id="insertTEarlyWarning" parameterType="TEarlyWarning" useGeneratedKeys="true" keyProperty="id">
- insert into t_early_warning
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="userId != null">user_id,</if>
- <if test="state != null">state,</if>
- <if test="type != null">type,</if>
- <if test="content != null">content,</if>
- <if test="eventRecord != null">event_record,</if>
- <if test="location != null">location,</if>
- <if test="lng != null">lng,</if>
- <if test="lat != null">lat,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="facilityId != null">facility_id,</if>
- <if test="deviceIdCode != null">device_id_code,</if>
- <if test="alarmId != null">alarm_id,</if>
- <if test="typeDesc != null">type_desc,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="userId != null">#{userId},</if>
- <if test="state != null">#{state},</if>
- <if test="type != null">#{type},</if>
- <if test="content != null">#{content},</if>
- <if test="eventRecord != null">#{eventRecord},</if>
- <if test="location != null">#{location},</if>
- <if test="lng != null">#{lng},</if>
- <if test="lat != null">#{lat},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="facilityId != null">#{facilityId},</if>
- <if test="deviceIdCode != null">#{deviceIdCode},</if>
- <if test="alarmId != null">#{alarmId},</if>
- <if test="typeDesc != null">#{typeDesc},</if>
- </trim>
- </insert>
- <update id="updateTEarlyWarning" parameterType="TEarlyWarning">
- update t_early_warning
- <trim prefix="SET" suffixOverrides=",">
- <if test="userId != null">user_id = #{userId},</if>
- <if test="state != null">state = #{state},</if>
- <if test="type != null">type = #{type},</if>
- <if test="content != null">content = #{content},</if>
- <if test="eventRecord != null">event_record = #{eventRecord},</if>
- <if test="location != null">location = #{location},</if>
- <if test="lng != null">lng = #{lng},</if>
- <if test="lat != null">lat = #{lat},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="facilityId != null">facility_id = #{facilityId},</if>
- <if test="deviceIdCode != null">device_id_code = #{deviceIdCode},</if>
- <if test="alarmId != null">alarm_id = #{alarmId},</if>
- <if test="typeDesc != null">type_desc = #{typeDesc},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteTEarlyWarningById" parameterType="Long">
- delete
- from t_early_warning
- where id = #{id}
- </delete>
- <delete id="deleteTEarlyWarningByIds" parameterType="String">
- delete from t_early_warning where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|