ArchivesFileMapper.xml 4.94 KB
<?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.mapper.ArchivesFileMapper">

    <resultMap type="ArchivesFile" id="ArchivesFileResult">
        <result property="id"    column="id"    />
        <result property="colletctId"    column="colletct_id"    />
        <result property="name"    column="name"    />
        <result property="size"    column="size"    />
        <result property="type"    column="type"    />
        <result property="secretLevel"    column="secret_level"    />
        <result property="version"    column="version"    />
        <result property="file"    column="file"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectArchivesFileVo">
        select id, colletct_id, name, size, type, secret_level, version, file, create_by, create_time, update_by, update_time from archives_file
    </sql>

    <select id="selectArchivesFileList" parameterType="ArchivesFile" resultMap="ArchivesFileResult">
        <include refid="selectArchivesFileVo"/>
        <where>
            <if test="colletctId != null "> and colletct_id = #{colletctId}</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="size != null  and size != ''"> and size = #{size}</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="secretLevel != null  and secretLevel != ''"> and secret_level = #{secretLevel}</if>
            <if test="version != null  and version != ''"> and version = #{version}</if>
            <if test="file != null  and file != ''"> and file = #{file}</if>
        </where>
    </select>

    <select id="selectArchivesFileById" parameterType="Long" resultMap="ArchivesFileResult">
        <include refid="selectArchivesFileVo"/>
        where id = #{id}
    </select>

    <insert id="insertArchivesFile" parameterType="ArchivesFile" useGeneratedKeys="true" keyProperty="id">
        insert into archives_file
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="colletctId != null">colletct_id,</if>
            <if test="name != null">name,</if>
            <if test="size != null">size,</if>
            <if test="type != null">type,</if>
            <if test="secretLevel != null">secret_level,</if>
            <if test="version != null">version,</if>
            <if test="file != null">file,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="colletctId != null">#{colletctId},</if>
            <if test="name != null">#{name},</if>
            <if test="size != null">#{size},</if>
            <if test="type != null">#{type},</if>
            <if test="secretLevel != null">#{secretLevel},</if>
            <if test="version != null">#{version},</if>
            <if test="file != null">#{file},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
        </trim>
    </insert>

    <update id="updateArchivesFile" parameterType="ArchivesFile">
        update archives_file
        <trim prefix="SET" suffixOverrides=",">
            <if test="colletctId != null">colletct_id = #{colletctId},</if>
            <if test="name != null">name = #{name},</if>
            <if test="size != null">size = #{size},</if>
            <if test="type != null">type = #{type},</if>
            <if test="secretLevel != null">secret_level = #{secretLevel},</if>
            <if test="version != null">version = #{version},</if>
            <if test="file != null">file = #{file},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteArchivesFileById" parameterType="Long">
        delete from archives_file where id = #{id}
    </delete>

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