122 lines
6.4 KiB
XML
122 lines
6.4 KiB
XML
<?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.fire.mapper.FireFacilityMapper">
|
|
|
|
<resultMap type="FireFacility" id="FireFacilityResult">
|
|
<result property="id" column="id" />
|
|
<result property="locationId" column="location_id" />
|
|
<result property="facilityName" column="facility_name" />
|
|
<result property="facilityType" column="facility_type" />
|
|
<result property="modelNumber" column="model_number" />
|
|
<result property="quantity" column="quantity" />
|
|
<result property="entryDate" column="entry_date" />
|
|
<result property="productionDate" column="production_date" />
|
|
<result property="expiryDate" column="expiry_date" />
|
|
<result property="status" column="status" />
|
|
<result property="remark" column="remark" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateTime" column="update_time" />
|
|
</resultMap>
|
|
|
|
<sql id="selectFireFacilityVo">
|
|
select id, location_id, facility_name, facility_type, model_number, quantity, entry_date, production_date, expiry_date, status, remark, create_time, update_time from fire_facilities
|
|
</sql>
|
|
|
|
<select id="selectFireFacilityList" parameterType="FireFacility" resultMap="FireFacilityResult">
|
|
<include refid="selectFireFacilityVo"/>
|
|
<where>
|
|
<if test="locationId != null and locationId != ''"> and location_id like concat('%', #{locationId}, '%')</if>
|
|
<if test="facilityName != null and facilityName != ''"> and facility_name like concat('%', #{facilityName}, '%')</if>
|
|
<if test="facilityType != null and facilityType != ''"> and facility_type = #{facilityType}</if>
|
|
<if test="params.beginEntryDate != null and params.beginEntryDate != '' and params.endEntryDate != null and params.endEntryDate != ''"> and entry_date between #{params.beginEntryDate} and #{params.endEntryDate}</if>
|
|
<if test="params.beginExpiryDate != null and params.beginExpiryDate != '' and params.endExpiryDate != null and params.endExpiryDate != ''"> and expiry_date between #{params.beginExpiryDate} and #{params.endExpiryDate}</if>
|
|
<if test="status != null "> and status = #{status}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectFireFacilityById" parameterType="Long" resultMap="FireFacilityResult">
|
|
<include refid="selectFireFacilityVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertFireFacility" parameterType="FireFacility" useGeneratedKeys="true" keyProperty="id">
|
|
insert into fire_facilities
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="locationId != null and locationId != ''">location_id,</if>
|
|
<if test="facilityName != null and facilityName != ''">facility_name,</if>
|
|
<if test="facilityType != null and facilityType != ''">facility_type,</if>
|
|
<if test="modelNumber != null">model_number,</if>
|
|
<if test="quantity != null">quantity,</if>
|
|
<if test="entryDate != null">entry_date,</if>
|
|
<if test="productionDate != null">production_date,</if>
|
|
<if test="expiryDate != null">expiry_date,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="locationId != null and locationId != ''">#{locationId},</if>
|
|
<if test="facilityName != null and facilityName != ''">#{facilityName},</if>
|
|
<if test="facilityType != null and facilityType != ''">#{facilityType},</if>
|
|
<if test="modelNumber != null">#{modelNumber},</if>
|
|
<if test="quantity != null">#{quantity},</if>
|
|
<if test="entryDate != null">#{entryDate},</if>
|
|
<if test="productionDate != null">#{productionDate},</if>
|
|
<if test="expiryDate != null">#{expiryDate},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateFireFacility" parameterType="FireFacility">
|
|
update fire_facilities
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="locationId != null and locationId != ''">location_id = #{locationId},</if>
|
|
<if test="facilityName != null and facilityName != ''">facility_name = #{facilityName},</if>
|
|
<if test="facilityType != null and facilityType != ''">facility_type = #{facilityType},</if>
|
|
<if test="modelNumber != null">model_number = #{modelNumber},</if>
|
|
<if test="quantity != null">quantity = #{quantity},</if>
|
|
<if test="entryDate != null">entry_date = #{entryDate},</if>
|
|
<if test="productionDate != null">production_date = #{productionDate},</if>
|
|
<if test="expiryDate != null">expiry_date = #{expiryDate},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteFireFacilityById" parameterType="Long">
|
|
delete from fire_facilities where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteFireFacilityByIds" parameterType="String">
|
|
delete from fire_facilities where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
|
|
<!-- 根据位置ID和设施名称查询 -->
|
|
<select id="selectByLocationAndName" resultMap="FireFacilityResult">
|
|
<include refid="selectFireFacilityVo"/>
|
|
where location_id = #{locationId} and facility_name = #{facilityName}
|
|
</select>
|
|
|
|
|
|
<!-- * 查询根据id查询设施列表-->
|
|
|
|
<select id="getDetails" resultMap="FireFacilityResult">
|
|
<include refid="selectFireFacilityVo"/>
|
|
<where>id = #{id} </where>
|
|
</select>
|
|
|
|
|
|
</mapper> |