<?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.system.mapper.CpsFileReviewInfoMapper">

    <resultMap type="com.ruoyi.system.domain.CpsFileReviewInfo" id="CpsFileReviewInfoResult">
        <result property="id"    column="id"    />
        <result property="uri"    column="uri"    />
        <result property="fileName"    column="file_name"    />
        <result property="fileType"    column="file_type"    />
        <result property="fileExt"    column="file_ext"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

    <sql id="selectCpsFileReviewInfoVo">
        select id,
               uri,
               file_name,
               file_type,
               file_ext,
               update_time,
               create_time,
               create_by,
               update_by
        from cps_file_review_info
    </sql>

    <select id="selectCpsFileReviewInfoList" parameterType="com.ruoyi.system.domain.CpsFileReviewInfo" resultMap="CpsFileReviewInfoResult">
        <include refid="selectCpsFileReviewInfoVo"/>
        <where>
            <if test="fileType != null ">and file_type = #{fileType}</if>
        </where>
        order by create_time desc
    </select>

    <select id="selectCpsFileReviewInfoById" parameterType="Long" resultMap="CpsFileReviewInfoResult">
        <include refid="selectCpsFileReviewInfoVo"/>
        where id = #{id}
    </select>

    <insert id="insertCpsFileReviewInfo" parameterType="com.ruoyi.system.domain.CpsFileReviewInfo" useGeneratedKeys="true" keyProperty="id">
        insert into cps_file_review_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="uri != null">uri,</if>
            <if test="fileName != null">file_name,</if>
            <if test="fileType != null">file_type,</if>
            <if test="fileExt!= null">file_ext,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="uri != null">#{uri},</if>
            <if test="fileName != null">#{fileName},</if>
            <if test="fileType != null">#{fileType},</if>
            <if test="fileExt!= null">#{fileExt},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
         </trim>
    </insert>

    <update id="updateCpsFileReviewInfo" parameterType="com.ruoyi.system.domain.CpsFileReviewInfo">
        update cps_file_review_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="uri != null">uri = #{uri},</if>
            <if test="fileName != null">file_name = #{fileName},</if>
            <if test="fileType != null">file_type = #{fileType},</if>
            <if test="fileExt!= null">file_ext = #{fileExt},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCpsFileReviewInfoById" parameterType="Long">
        delete from cps_file_review_info where id = #{id}
    </delete>

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