<?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.ss.softwareVersion.mapper.SoftwareVersionMapper">

    <resultMap type="SoftwareVersion" id="EtSoftwareVersionResult">
        <result property="id"    column="id"    />
        <result property="version"    column="version"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="content"    column="content"    />
    </resultMap>

    <sql id="selectEtSoftwareVersionVo">
        select id, version, create_time, update_time, content from ss_software_version
    </sql>

    <select id="selectEtSoftwareVersionList" parameterType="SoftwareVersion" resultMap="EtSoftwareVersionResult">
        <include refid="selectEtSoftwareVersionVo"/>
        <where>
            <if test="version != null  and version != ''"> and version = #{version}</if>
            <if test="content != null  and content != ''"> and content = #{content}</if>
        </where>
        order by version
    </select>

    <select id="selectEtSoftwareVersionById" parameterType="Long" resultMap="EtSoftwareVersionResult">
        <include refid="selectEtSoftwareVersionVo"/>
        where id = #{id}
    </select>

    <insert id="insertEtSoftwareVersion" parameterType="SoftwareVersion">
        insert into ss_software_version
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="version != null">version,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="content != null">content,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="version != null">#{version},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="content != null">#{content},</if>
         </trim>
    </insert>

    <update id="updateEtSoftwareVersion" parameterType="SoftwareVersion">
        update ss_software_version
        <trim prefix="SET" suffixOverrides=",">
            <if test="version != null">version = #{version},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="content != null">content = #{content},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteEtSoftwareVersionById" parameterType="Long">
        delete from ss_software_version where id = #{id}
    </delete>

    <delete id="deleteEtSoftwareVersionByIds" parameterType="String">
        delete from ss_software_version where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
