|
|
@@ -1,146 +0,0 @@
|
|
|
-<?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.uniapp.mapper.KnowledgeArticleMapper">
|
|
|
-
|
|
|
- <resultMap type="com.ruoyi.uniapp.domain.KnowledgeArticle" id="KnowledgeArticleResult">
|
|
|
- <id property="id" column="id"/>
|
|
|
- <result property="title" column="title"/>
|
|
|
- <result property="description" column="description"/>
|
|
|
- <result property="content" column="content"/>
|
|
|
- <result property="category" column="category"/>
|
|
|
- <result property="thumbnail" column="thumbnail"/>
|
|
|
- <result property="contentType" column="content_type"/>
|
|
|
- <result property="videoUrl" column="video_url"/>
|
|
|
- <result property="videoDuration" column="video_duration"/>
|
|
|
- <result property="source" column="source"/>
|
|
|
- <result property="tags" column="tags"/>
|
|
|
- <result property="publishDate" column="publish_date"/>
|
|
|
- <result property="viewCount" column="view_count"/>
|
|
|
- <result property="likeCount" column="like_count"/>
|
|
|
- <result property="isRecommend" column="is_recommend"/>
|
|
|
- <result property="status" column="status"/>
|
|
|
- <result property="createTime" column="create_time"/>
|
|
|
- <result property="updateTime" column="update_time"/>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
- <sql id="selectKnowledgeArticleVo">
|
|
|
- select id, title, description, content, category, thumbnail, content_type, video_url, video_duration,
|
|
|
- source, tags, publish_date, view_count, like_count, is_recommend, status, create_time, update_time
|
|
|
- from knowledge_article
|
|
|
- </sql>
|
|
|
-
|
|
|
- <select id="selectKnowledgeArticleById" parameterType="Integer" resultMap="KnowledgeArticleResult">
|
|
|
- <include refid="selectKnowledgeArticleVo"/>
|
|
|
- where id = #{id}
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectKnowledgeArticleList" parameterType="com.ruoyi.uniapp.domain.KnowledgeArticle" resultMap="KnowledgeArticleResult">
|
|
|
- <include refid="selectKnowledgeArticleVo"/>
|
|
|
- <where>
|
|
|
- <if test="title != null and title != ''">
|
|
|
- AND title like concat('%', #{title}, '%')
|
|
|
- </if>
|
|
|
- <if test="category != null and category != ''">
|
|
|
- AND category = #{category}
|
|
|
- </if>
|
|
|
- <if test="contentType != null and contentType != ''">
|
|
|
- AND content_type = #{contentType}
|
|
|
- </if>
|
|
|
- <if test="isRecommend != null">
|
|
|
- AND is_recommend = #{isRecommend}
|
|
|
- </if>
|
|
|
- <if test="status != null">
|
|
|
- AND status = #{status}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- order by publish_date desc
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectKnowledgeArticlesByCategory" resultMap="KnowledgeArticleResult">
|
|
|
- <include refid="selectKnowledgeArticleVo"/>
|
|
|
- where category = #{category} and status = 1
|
|
|
- order by publish_date desc
|
|
|
- </select>
|
|
|
-
|
|
|
- <insert id="insertKnowledgeArticle" parameterType="com.ruoyi.uniapp.domain.KnowledgeArticle" useGeneratedKeys="true" keyProperty="id">
|
|
|
- insert into knowledge_article (
|
|
|
- <if test="title != null">title,</if>
|
|
|
- <if test="description != null">description,</if>
|
|
|
- <if test="content != null">content,</if>
|
|
|
- <if test="category != null">category,</if>
|
|
|
- <if test="thumbnail != null">thumbnail,</if>
|
|
|
- <if test="contentType != null">content_type,</if>
|
|
|
- <if test="videoUrl != null">video_url,</if>
|
|
|
- <if test="videoDuration != null">video_duration,</if>
|
|
|
- <if test="source != null">source,</if>
|
|
|
- <if test="tags != null">tags,</if>
|
|
|
- <if test="publishDate != null">publish_date,</if>
|
|
|
- <if test="viewCount != null">view_count,</if>
|
|
|
- <if test="likeCount != null">like_count,</if>
|
|
|
- <if test="isRecommend != null">is_recommend,</if>
|
|
|
- <if test="status != null">status,</if>
|
|
|
- create_time,
|
|
|
- update_time
|
|
|
- ) values (
|
|
|
- <if test="title != null">#{title},</if>
|
|
|
- <if test="description != null">#{description},</if>
|
|
|
- <if test="content != null">#{content},</if>
|
|
|
- <if test="category != null">#{category},</if>
|
|
|
- <if test="thumbnail != null">#{thumbnail},</if>
|
|
|
- <if test="contentType != null">#{contentType},</if>
|
|
|
- <if test="videoUrl != null">#{videoUrl},</if>
|
|
|
- <if test="videoDuration != null">#{videoDuration},</if>
|
|
|
- <if test="source != null">#{source},</if>
|
|
|
- <if test="tags != null">#{tags},</if>
|
|
|
- <if test="publishDate != null">#{publishDate},</if>
|
|
|
- <if test="viewCount != null">#{viewCount},</if>
|
|
|
- <if test="likeCount != null">#{likeCount},</if>
|
|
|
- <if test="isRecommend != null">#{isRecommend},</if>
|
|
|
- <if test="status != null">#{status},</if>
|
|
|
- sysdate(),
|
|
|
- sysdate()
|
|
|
- )
|
|
|
- </insert>
|
|
|
-
|
|
|
- <update id="updateKnowledgeArticle" parameterType="com.ruoyi.uniapp.domain.KnowledgeArticle">
|
|
|
- update knowledge_article
|
|
|
- <set>
|
|
|
- <if test="title != null">title = #{title},</if>
|
|
|
- <if test="description != null">description = #{description},</if>
|
|
|
- <if test="content != null">content = #{content},</if>
|
|
|
- <if test="category != null">category = #{category},</if>
|
|
|
- <if test="thumbnail != null">thumbnail = #{thumbnail},</if>
|
|
|
- <if test="contentType != null">content_type = #{contentType},</if>
|
|
|
- <if test="videoUrl != null">video_url = #{videoUrl},</if>
|
|
|
- <if test="videoDuration != null">video_duration = #{videoDuration},</if>
|
|
|
- <if test="source != null">source = #{source},</if>
|
|
|
- <if test="tags != null">tags = #{tags},</if>
|
|
|
- <if test="publishDate != null">publish_date = #{publishDate},</if>
|
|
|
- <if test="viewCount != null">view_count = #{viewCount},</if>
|
|
|
- <if test="likeCount != null">like_count = #{likeCount},</if>
|
|
|
- <if test="isRecommend != null">is_recommend = #{isRecommend},</if>
|
|
|
- <if test="status != null">status = #{status},</if>
|
|
|
- update_time = sysdate()
|
|
|
- </set>
|
|
|
- where id = #{id}
|
|
|
- </update>
|
|
|
-
|
|
|
- <delete id="deleteKnowledgeArticleById" parameterType="Integer">
|
|
|
- delete from knowledge_article where id = #{id}
|
|
|
- </delete>
|
|
|
-
|
|
|
- <update id="updateViewCount" parameterType="Integer">
|
|
|
- update knowledge_article
|
|
|
- set view_count = view_count + 1
|
|
|
- where id = #{id}
|
|
|
- </update>
|
|
|
-
|
|
|
- <update id="updateLikeCount">
|
|
|
- update knowledge_article
|
|
|
- set like_count = like_count + #{count}
|
|
|
- where id = #{id}
|
|
|
- </update>
|
|
|
-
|
|
|
-</mapper>
|