All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mapper.MkCommunityArticleFileMapper.xml Maven / Gradle / Ivy

There is a newer version: 1.0.0-beta10
Show newest version
<?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.github.xujiaji.mk.community.mapper.MkCommunityArticleFileMapper">
    <update id="updateFileDeleted">
        UPDATE mk_file SET state = 1 WHERE id IN (SELECT file_id FROM mk_community_article_file WHERE article_id = ${articleId})
    </update>

    <delete id="deleteByArticleId">
        DELETE FROM mk_community_article_file WHERE article_id = ${articleId}
    </delete>

    <select id="selectPaths" resultType="java.lang.String">
        SELECT f.path
        FROM mk_community_article_file af
                 LEFT JOIN mk_file f ON af.file_id = f.id
        WHERE f.state = 0 AND af.type = ${articleFileType} AND af.article_id = ${articleId}
        ORDER BY af.order_num
    </select>

    <select id="selectPathsByYearMonth" resultType="java.lang.String">
        SELECT f.path
        FROM mk_community_article_file af
                 LEFT JOIN mk_file f ON af.file_id = f.id
        WHERE f.user_id = ${userId} AND f.state = 0 AND af.type = ${articleFileType} AND DATE_FORMAT(af.create_time, '%Y-%m') = #{yearMonth}
        ORDER BY af.order_num
    </select>
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy