<?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="org.springblade.audit.mapper.AuditUploadFileMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="org.springblade.audit.entity.AuditUploadFile">
        <id column="id" property="id" />
        <result column="report_type" property="reportType" />
        <result column="report_name" property="reportName" />
        <result column="report_path" property="reportPath" />
        <result column="upload_id" property="uploadId" />
        <result column="audit_id" property="auditId" />
        <result column="status" property="status" />
        <result column="remark" property="remark" />
        <result column="audit_time" property="auditTime" />
        <result column="create_time" property="createTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, report_type, report_name, report_path, upload_id, audit_id, status, remark, audit_time, create_time
    </sql>

    <select id="getPageByQuery" resultType="org.springblade.audit.entity.AuditUploadFile">
        SELECT
        *
        FROM
        audit_upload_file
        where 1=1
        <if test="query.reportName != null and query.reportName != ''">
            and report_name LIKE CONCAT('%',#{query.reportName},'%')
        </if>
        <if test="query.status != null and query.status != ''">
            and status = #{query.status}
        </if>
        <if test="query.userId != null and query.userId != ''">
            and upload_id = #{query.userId}
        </if>
        order by create_time desc
    </select>

</mapper>
