| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <?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.base.mapper.KnowledgeContentMapper">
- <resultMap type="KnowledgeContent" id="KnowledgeContentResult">
- <result property="id" column="id" />
- <result property="title" column="title" />
- <result property="description" column="description" />
- <result property="contentType" column="content_type" />
- <result property="contentCategory" column="content_category" />
- <result property="imageUrl" column="image_url" />
- <result property="source" column="source" />
- <result property="viewCount" column="view_count" />
- <result property="videoUrl" column="video_url" />
- <result property="duration" column="duration" />
- <result property="articleContent" column="article_content" />
- <result property="author" column="author" />
- <result property="tags" column="tags" />
- <result property="publishDate" column="publish_date" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="status" column="status" />
- </resultMap>
- <sql id="selectKnowledgeContentVo">
- select id, title, description, content_type, content_category, image_url, source, view_count, video_url, duration, article_content, author, tags, publish_date, create_time, update_time, status from knowledge_content
- </sql>
- <select id="selectKnowledgeContentList" parameterType="KnowledgeContent" resultMap="KnowledgeContentResult">
- <include refid="selectKnowledgeContentVo"/>
- <where>
- <if test="title != null and title != ''"> and title = #{title}</if>
- <if test="description != null and description != ''"> and description = #{description}</if>
- <if test="contentType != null and contentType != ''"> and content_type = #{contentType}</if>
- <if test="contentCategory != null and contentCategory != ''"> and content_category = #{contentCategory}</if>
- <if test="imageUrl != null and imageUrl != ''"> and image_url = #{imageUrl}</if>
- <if test="source != null and source != ''"> and source = #{source}</if>
- <if test="viewCount != null "> and view_count = #{viewCount}</if>
- <if test="videoUrl != null and videoUrl != ''"> and video_url = #{videoUrl}</if>
- <if test="duration != null and duration != ''"> and duration = #{duration}</if>
- <if test="articleContent != null and articleContent != ''"> and article_content = #{articleContent}</if>
- <if test="author != null and author != ''"> and author = #{author}</if>
- <if test="tags != null and tags != ''"> and tags = #{tags}</if>
- <if test="publishDate != null "> and publish_date = #{publishDate}</if>
- <if test="status != null "> and status = #{status}</if>
- </where>
- </select>
- <select id="selectKnowledgeContentById" parameterType="Long" resultMap="KnowledgeContentResult">
- <include refid="selectKnowledgeContentVo"/>
- where id = #{id}
- </select>
- <insert id="insertKnowledgeContent" parameterType="KnowledgeContent" useGeneratedKeys="true" keyProperty="id">
- insert into knowledge_content
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="title != null and title != ''">title,</if>
- <if test="description != null">description,</if>
- <if test="contentType != null and contentType != ''">content_type,</if>
- <if test="contentCategory != null and contentCategory != ''">content_category,</if>
- <if test="imageUrl != null and imageUrl != ''">image_url,</if>
- <if test="source != null">source,</if>
- <if test="viewCount != null">view_count,</if>
- <if test="videoUrl != null">video_url,</if>
- <if test="duration != null">duration,</if>
- <if test="articleContent != null">article_content,</if>
- <if test="author != null">author,</if>
- <if test="tags != null">tags,</if>
- <if test="publishDate != null">publish_date,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="status != null">status,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="title != null and title != ''">#{title},</if>
- <if test="description != null">#{description},</if>
- <if test="contentType != null and contentType != ''">#{contentType},</if>
- <if test="contentCategory != null and contentCategory != ''">#{contentCategory},</if>
- <if test="imageUrl != null and imageUrl != ''">#{imageUrl},</if>
- <if test="source != null">#{source},</if>
- <if test="viewCount != null">#{viewCount},</if>
- <if test="videoUrl != null">#{videoUrl},</if>
- <if test="duration != null">#{duration},</if>
- <if test="articleContent != null">#{articleContent},</if>
- <if test="author != null">#{author},</if>
- <if test="tags != null">#{tags},</if>
- <if test="publishDate != null">#{publishDate},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="status != null">#{status},</if>
- </trim>
- </insert>
- <insert id="insertKnowledgeImages" parameterType="KnowledgeImages" useGeneratedKeys="true" keyProperty="id">
- insert into knowledge_image (
- <if test="articleId != null">article_id,</if>
- <if test="url != null">url,</if>
- <if test="title != null">title,</if>
- <if test="subtitle != null">subtitle,</if>
- <if test="color != null">color,</if>
- <if test="sortOrder != null">sort_order,</if>
- <if test="imageType != null">image_type,</if>
- create_time
- ) values (
- <if test="articleId != null">#{articleId},</if>
- <if test="url != null">#{url},</if>
- <if test="title != null">#{title},</if>
- <if test="subtitle != null">#{subtitle},</if>
- <if test="color != null">#{color},</if>
- <if test="sortOrder != null">#{sortOrder},</if>
- <if test="imageType != null">#{imageType},</if>
- sysdate()
- )
- </insert>
- <update id="updateKnowledgeContent" parameterType="KnowledgeContent">
- update knowledge_content
- <trim prefix="SET" suffixOverrides=",">
- <if test="title != null and title != ''">title = #{title},</if>
- <if test="description != null">description = #{description},</if>
- <if test="contentType != null and contentType != ''">content_type = #{contentType},</if>
- <if test="contentCategory != null and contentCategory != ''">content_category = #{contentCategory},</if>
- <if test="imageUrl != null and imageUrl != ''">image_url = #{imageUrl},</if>
- <if test="source != null">source = #{source},</if>
- <if test="viewCount != null">view_count = #{viewCount},</if>
- <if test="videoUrl != null">video_url = #{videoUrl},</if>
- <if test="duration != null">duration = #{duration},</if>
- <if test="articleContent != null">article_content = #{articleContent},</if>
- <if test="author != null">author = #{author},</if>
- <if test="tags != null">tags = #{tags},</if>
- <if test="publishDate != null">publish_date = #{publishDate},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="status != null">status = #{status},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteKnowledgeContentById" parameterType="Long">
- delete from knowledge_content where id = #{id}
- </delete>
- <delete id="deleteKnowledgeContentByIds" parameterType="String">
- delete from knowledge_content where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|