zhyc-sheep/zhyc-module/src/main/resources/mapper/biosafety/QuarantineSampleMapper.xml

56 lines
2.1 KiB
XML
Raw Normal View History

2025-07-14 19:12:30 +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.zhyc.module.biosafety.mapper.QuarantineSampleMapper">
<resultMap type="QuarantineSample" id="QuarantineSampleResult">
<result property="id" column="id" />
<result property="name" column="name" />
</resultMap>
<sql id="selectQuarantineSampleVo">
select id, name from sw_quarantine_sample
</sql>
<select id="selectQuarantineSampleList" parameterType="QuarantineSample" resultMap="QuarantineSampleResult">
<include refid="selectQuarantineSampleVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
</where>
</select>
<select id="selectQuarantineSampleById" parameterType="Long" resultMap="QuarantineSampleResult">
<include refid="selectQuarantineSampleVo"/>
where id = #{id}
</select>
<insert id="insertQuarantineSample" parameterType="QuarantineSample" useGeneratedKeys="true" keyProperty="id">
insert into sw_quarantine_sample
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
</trim>
</insert>
<update id="updateQuarantineSample" parameterType="QuarantineSample">
update sw_quarantine_sample
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteQuarantineSampleById" parameterType="Long">
delete from sw_quarantine_sample where id = #{id}
</delete>
<delete id="deleteQuarantineSampleByIds" parameterType="String">
delete from sw_quarantine_sample where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>