<?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.ads.business.dao.DocHistoryDao">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ads.business.entity.DocHistory">
        <id column="id" property="id" />
        <result column="type_id" property="typeId" />
        <result column="name" property="name" />
        <result column="doc_url" property="docUrl" />
        <result column="link_url" property="linkUrl" />
        <result column="status" property="status" />
        <result column="create_user" property="createUser" />
        <result column="create_time" property="createTime" />
        <result column="update_user" property="updateUser" />
        <result column="update_time" property="updateTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, type_id, name, doc_url, link_url, status, create_user, create_time, update_user, update_time
    </sql>

    <select id="getDocHistoryList"
            resultType="com.ads.business.service.model.response.DocHistoryListResponse">
        select
        hdh.id  AS id,
        hdh.doc_id AS docId,
        hdh.name AS name,
        hdh.doc_url AS docUrl,
        hdh.link_url AS linkUrl,
        hdh.file_size AS fileSize,
        hu.name AS createUser,
        hdh.create_time AS createTime
        from hsay_doc_history hdh left JOIN hsay_user hu on hu.user_id = hdh.create_user
        ${ew.customSqlSegment}
    </select>
</mapper>
