DiskFilesLogMapper.xml 2.27 KB
Newer Older
284718418@qq.com committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?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="cn.timer.api.dao.disk.DiskFilesLogMapper">

	<!-- 可根据自己的需求,是否要使用 -->
    <resultMap type="cn.timer.api.bean.disk.DiskFilesLog" id="BaseResultMap">
        <id property="id" column="id"/>
        <result property="filesId" column="files_id"/>
        <result property="type" column="type"/>
        <result property="title" column="title"/>
        <result property="filePath" column="file_path"/>
        <result property="fileSize" column="file_size"/>
        <result property="userId" column="user_id"/>
        <result property="userName" column="user_name"/>
16
        <result property="deleteFlag" column="delete_flag"/>
284718418@qq.com committed
17 18
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
19

284718418@qq.com committed
20 21
    </resultMap>

22

23
    <select id="queryDiskFilesLog" resultType="cn.timer.api.dto.disk.DiskFilesDto">
24
        SELECT
25 26 27 28 29 30 31 32 33
            df.id,
            df.show_size,
            df.file_type,
            df.url_path,
            dfi.url,
            log.id obj_id,
            log.title,
            log.update_time,
            log.user_name
34
        FROM
35 36 37 38 39 40 41 42 43
        (SELECT * FROM disk_files_log WHERE id IN (SELECT MAX(id) FROM disk_files_log
        WHERE
        user_id = #{diskFilesLog.userId}
        and `delete_flag` = 0
        <if test="diskFilesLog.title != null and diskFilesLog.title != '' and diskFilesLog.title != 'null'">
            and title like CONCAT('%',#{diskFilesLog.title},'%')
        </if>
        <choose>
            <when test="diskFilesLog.type != null">
44
                and `type` = #{diskFilesLog.type}
45 46 47 48 49 50 51 52 53 54 55
            </when>
            <otherwise>
                and `type` <![CDATA[ <= ]]> 1
            </otherwise>
        </choose>
        GROUP BY files_id )) AS log
        LEFT JOIN disk_files df ON log.files_id = df.id
        LEFT JOIN disk_file_image dfi ON df.file_type = dfi.type
        LEFT JOIN disk_catalogue_files dcf ON df.id = dcf.files_id
        LEFT JOIN disk_catalogue dc ON dc.id = dcf.catalogue_id
        WHERE dc.org_id=#{orgId}
56
        GROUP BY
57
        log.files_id
58
        ORDER BY
59
        log.id DESC
60 61 62 63

    </select>


284718418@qq.com committed
64
</mapper>