林火综合应急信息管理系统后端
guoshilong
2023-03-07 b195148e1b60361197cfb5abe6e283f2cd5a7454
src/main/java/org/springblade/modules/fire/mapper/FireMapper.xml
@@ -3,7 +3,7 @@
<mapper namespace="org.springblade.modules.fire.mapper.FireMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="fireResultMap" type="org.springblade.modules.fire.entity.FireEntity">
    <resultMap id="fireResultMap" type="org.springblade.modules.fire.vo.FireVO">
        <result column="id" property="id"/>
        <result column="no" property="no"/>
        <result column="location" property="location" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
@@ -20,13 +20,44 @@
        <result column="update_time" property="updateTime"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="supplementId" property="supplementId"/>
    </resultMap>
    <select id="selectFirePage" resultMap="fireResultMap">
        select * from sys_fire where is_deleted = 0
        select fire.*,sup.id supplementId from sys_fire fire
        LEFT JOIN sys_fire_supplement sup ON sup.fire_id = fire.id AND sup.is_deleted = 0
        where fire.is_deleted = 0
        <if test="fire.location !=null and fire.location !='' ">
            AND location = #{fire.location,typeHandler=com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler}
            AND fire.location = #{fire.location,typeHandler=com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler}
        </if>
        <if test="fire.no !=null and fire.no !=''">
            AND fire.no LIKE CONCAT('%',#{fire.no},'%')
        </if>
        <if test="fire.address !=null and fire.address !=''">
            AND fire.address LIKE CONCAT('%',#{fire.address},'%')
        </if>
        <if test="fire.findWay!=null and fire.findWay !=''">
            AND fire.find_way = #{fire.findWay}
        </if>
        <if test="fire.status!=null and fire.status !=''">
            AND fire.status = #{fire.status}
        </if>
        <if test="fire.alarmTimeStart !=null and fire.alarmTimeStart !=''">
            AND DATE_FORMAT(fire.alarm_time,'%Y-%m-%d') &gt;= #{fire.alarmTimeStart}
        </if>
        <if test="fire.alarmTimeEnd !=null and fire.alarmTimeEnd !=''">
            AND DATE_FORMAT(fire.alarm_time,'%Y-%m-%d') &lt;= #{fire.alarmTimeEnd}
        </if>
    </select>
    <select id="getAll" resultMap="fireResultMap">
        select fire.*,sup.id supplementId from sys_fire fire
        LEFT JOIN sys_fire_supplement sup ON sup.fire_id = fire.id AND sup.is_deleted = 0
        where fire.is_deleted = 0 AND sup.id IS NULL
        <if test="fire.no !=null and fire.no !=''">
            AND fire.no LIKE CONCAT('%',#{fire.no},'%')
        </if>
    </select>