Files
pasd_java/pasd-fire/target/classes/mapper/fire/FireFacilityReplacementMapper.xml

83 lines
4.6 KiB
XML
Raw Normal View History

2025-07-30 17:15:01 +08:00
<?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.FireFacilityReplacementMapper">
<resultMap type="FireFacilityReplacement" id="FireFacilityReplacementResult">
<result property="id" column="id" />
<result property="oldFacilityId" column="old_facility_id" />
<result property="newFacilityId" column="new_facility_id" />
<result property="replaceDate" column="replace_date" />
<result property="replaceReason" column="replace_reason" />
<result property="replacePerson" column="replace_person" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectFireFacilityReplacementVo">
select id, old_facility_id, new_facility_id, replace_date, replace_reason, replace_person, remark, create_time from fire_facility_replacement
</sql>
<select id="selectFireFacilityReplacementList" parameterType="FireFacilityReplacement" resultMap="FireFacilityReplacementResult">
<include refid="selectFireFacilityReplacementVo"/>
<where>
<if test="oldFacilityId != null "> and old_facility_id = #{oldFacilityId}</if>
<if test="newFacilityId != null "> and new_facility_id = #{newFacilityId}</if>
<if test="params.beginReplaceDate != null and params.beginReplaceDate != '' and params.endReplaceDate != null and params.endReplaceDate != ''"> and replace_date between #{params.beginReplaceDate} and #{params.endReplaceDate}</if>
<if test="replacePerson != null and replacePerson != ''"> and replace_person = #{replacePerson}</if>
</where>
</select>
<select id="selectFireFacilityReplacementById" parameterType="Long" resultMap="FireFacilityReplacementResult">
<include refid="selectFireFacilityReplacementVo"/>
where id = #{id}
</select>
<insert id="insertFireFacilityReplacement" parameterType="FireFacilityReplacement" useGeneratedKeys="true" keyProperty="id">
insert into fire_facility_replacement
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="oldFacilityId != null">old_facility_id,</if>
<if test="newFacilityId != null">new_facility_id,</if>
<if test="replaceDate != null">replace_date,</if>
<if test="replaceReason != null and replaceReason != ''">replace_reason,</if>
<if test="replacePerson != null and replacePerson != ''">replace_person,</if>
<if test="remark != null">remark,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="oldFacilityId != null">#{oldFacilityId},</if>
<if test="newFacilityId != null">#{newFacilityId},</if>
<if test="replaceDate != null">#{replaceDate},</if>
<if test="replaceReason != null and replaceReason != ''">#{replaceReason},</if>
<if test="replacePerson != null and replacePerson != ''">#{replacePerson},</if>
<if test="remark != null">#{remark},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateFireFacilityReplacement" parameterType="FireFacilityReplacement">
update fire_facility_replacement
<trim prefix="SET" suffixOverrides=",">
<if test="oldFacilityId != null">old_facility_id = #{oldFacilityId},</if>
<if test="newFacilityId != null">new_facility_id = #{newFacilityId},</if>
<if test="replaceDate != null">replace_date = #{replaceDate},</if>
<if test="replaceReason != null and replaceReason != ''">replace_reason = #{replaceReason},</if>
<if test="replacePerson != null and replacePerson != ''">replace_person = #{replacePerson},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteFireFacilityReplacementById" parameterType="Long">
delete from fire_facility_replacement where id = #{id}
</delete>
<delete id="deleteFireFacilityReplacementByIds" parameterType="String">
delete from fire_facility_replacement where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>