|
|
@@ -0,0 +1,645 @@
|
|
|
+<?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.goafanti.common.dao.JtKnowledgeBaseMapper">
|
|
|
+ <resultMap id="BaseResultMap" type="com.goafanti.common.model.JtKnowledgeBase">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ <result column="id" jdbcType="VARCHAR" property="id" />
|
|
|
+ <result column="category" jdbcType="INTEGER" property="category" />
|
|
|
+ <result column="title" jdbcType="VARCHAR" property="title" />
|
|
|
+ <result column="summary" jdbcType="VARCHAR" property="summary" />
|
|
|
+ <result column="source" jdbcType="VARCHAR" property="source" />
|
|
|
+ <result column="status" jdbcType="INTEGER" property="status" />
|
|
|
+ <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
|
+ <result column="owner" jdbcType="VARCHAR" property="owner" />
|
|
|
+ <result column="release_time" jdbcType="TIMESTAMP" property="releaseTime" />
|
|
|
+ <result column="read_number" jdbcType="INTEGER" property="readNumber" />
|
|
|
+ <result column="comment_number" jdbcType="INTEGER" property="commentNumber" />
|
|
|
+ <result column="star_number" jdbcType="INTEGER" property="starNumber" />
|
|
|
+ <result column="keyword" jdbcType="VARCHAR" property="keyword" />
|
|
|
+ <result column="pic_url" jdbcType="VARCHAR" property="picUrl" />
|
|
|
+ <result column="top" jdbcType="INTEGER" property="top" />
|
|
|
+ <result column="recommend" jdbcType="INTEGER" property="recommend" />
|
|
|
+ </resultMap>
|
|
|
+ <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.goafanti.common.model.JtKnowledgeBase">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ <result column="content" jdbcType="LONGVARCHAR" property="content" />
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Example_Where_Clause">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ <where>
|
|
|
+ <foreach collection="oredCriteria" item="criteria" separator="or">
|
|
|
+ <if test="criteria.valid">
|
|
|
+ <trim prefix="(" prefixOverrides="and" suffix=")">
|
|
|
+ <foreach collection="criteria.criteria" item="criterion">
|
|
|
+ <choose>
|
|
|
+ <when test="criterion.noValue">
|
|
|
+ and ${criterion.condition}
|
|
|
+ </when>
|
|
|
+ <when test="criterion.singleValue">
|
|
|
+ and ${criterion.condition} #{criterion.value}
|
|
|
+ </when>
|
|
|
+ <when test="criterion.betweenValue">
|
|
|
+ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
|
+ </when>
|
|
|
+ <when test="criterion.listValue">
|
|
|
+ and ${criterion.condition}
|
|
|
+ <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
|
+ #{listItem}
|
|
|
+ </foreach>
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+ <sql id="Update_By_Example_Where_Clause">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ <where>
|
|
|
+ <foreach collection="example.oredCriteria" item="criteria" separator="or">
|
|
|
+ <if test="criteria.valid">
|
|
|
+ <trim prefix="(" prefixOverrides="and" suffix=")">
|
|
|
+ <foreach collection="criteria.criteria" item="criterion">
|
|
|
+ <choose>
|
|
|
+ <when test="criterion.noValue">
|
|
|
+ and ${criterion.condition}
|
|
|
+ </when>
|
|
|
+ <when test="criterion.singleValue">
|
|
|
+ and ${criterion.condition} #{criterion.value}
|
|
|
+ </when>
|
|
|
+ <when test="criterion.betweenValue">
|
|
|
+ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
|
+ </when>
|
|
|
+ <when test="criterion.listValue">
|
|
|
+ and ${criterion.condition}
|
|
|
+ <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
|
+ #{listItem}
|
|
|
+ </foreach>
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ id, category, title, summary, source, status, create_time, owner, release_time, read_number,
|
|
|
+ comment_number, star_number, keyword, pic_url, top, recommend
|
|
|
+ </sql>
|
|
|
+ <sql id="Blob_Column_List">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ content
|
|
|
+ </sql>
|
|
|
+ <select id="selectByExampleWithBLOBs" parameterType="com.goafanti.common.model.JtKnowledgeBaseExample" resultMap="ResultMapWithBLOBs">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ select
|
|
|
+ <if test="distinct">
|
|
|
+ distinct
|
|
|
+ </if>
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ ,
|
|
|
+ <include refid="Blob_Column_List" />
|
|
|
+ from jt_knowledge_base
|
|
|
+ <if test="_parameter != null">
|
|
|
+ <include refid="Example_Where_Clause" />
|
|
|
+ </if>
|
|
|
+ <if test="orderByClause != null">
|
|
|
+ order by ${orderByClause}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="selectByExample" parameterType="com.goafanti.common.model.JtKnowledgeBaseExample" resultMap="BaseResultMap">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ select
|
|
|
+ <if test="distinct">
|
|
|
+ distinct
|
|
|
+ </if>
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from jt_knowledge_base
|
|
|
+ <if test="_parameter != null">
|
|
|
+ <include refid="Example_Where_Clause" />
|
|
|
+ </if>
|
|
|
+ <if test="orderByClause != null">
|
|
|
+ order by ${orderByClause}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <delete id="deleteByExample" parameterType="com.goafanti.common.model.JtKnowledgeBaseExample">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ delete from jt_knowledge_base
|
|
|
+ <if test="_parameter != null">
|
|
|
+ <include refid="Example_Where_Clause" />
|
|
|
+ </if>
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" parameterType="com.goafanti.common.model.JtKnowledgeBase">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ insert into jt_knowledge_base (id, category, title,
|
|
|
+ summary, source, status,
|
|
|
+ create_time, owner, release_time,
|
|
|
+ read_number, comment_number, star_number,
|
|
|
+ keyword, pic_url, top,
|
|
|
+ recommend, content)
|
|
|
+ values (#{id,jdbcType=VARCHAR}, #{category,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR},
|
|
|
+ #{summary,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
|
|
|
+ #{createTime,jdbcType=TIMESTAMP}, #{owner,jdbcType=VARCHAR}, #{releaseTime,jdbcType=TIMESTAMP},
|
|
|
+ #{readNumber,jdbcType=INTEGER}, #{commentNumber,jdbcType=INTEGER}, #{starNumber,jdbcType=INTEGER},
|
|
|
+ #{keyword,jdbcType=VARCHAR}, #{picUrl,jdbcType=VARCHAR}, #{top,jdbcType=INTEGER},
|
|
|
+ #{recommend,jdbcType=INTEGER}, #{content,jdbcType=LONGVARCHAR})
|
|
|
+ </insert>
|
|
|
+ <insert id="insertSelective" parameterType="com.goafanti.common.model.JtKnowledgeBase">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ insert into jt_knowledge_base
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">
|
|
|
+ id,
|
|
|
+ </if>
|
|
|
+ <if test="category != null">
|
|
|
+ category,
|
|
|
+ </if>
|
|
|
+ <if test="title != null">
|
|
|
+ title,
|
|
|
+ </if>
|
|
|
+ <if test="summary != null">
|
|
|
+ summary,
|
|
|
+ </if>
|
|
|
+ <if test="source != null">
|
|
|
+ source,
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ status,
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time,
|
|
|
+ </if>
|
|
|
+ <if test="owner != null">
|
|
|
+ owner,
|
|
|
+ </if>
|
|
|
+ <if test="releaseTime != null">
|
|
|
+ release_time,
|
|
|
+ </if>
|
|
|
+ <if test="readNumber != null">
|
|
|
+ read_number,
|
|
|
+ </if>
|
|
|
+ <if test="commentNumber != null">
|
|
|
+ comment_number,
|
|
|
+ </if>
|
|
|
+ <if test="starNumber != null">
|
|
|
+ star_number,
|
|
|
+ </if>
|
|
|
+ <if test="keyword != null">
|
|
|
+ keyword,
|
|
|
+ </if>
|
|
|
+ <if test="picUrl != null">
|
|
|
+ pic_url,
|
|
|
+ </if>
|
|
|
+ <if test="top != null">
|
|
|
+ top,
|
|
|
+ </if>
|
|
|
+ <if test="recommend != null">
|
|
|
+ recommend,
|
|
|
+ </if>
|
|
|
+ <if test="content != null">
|
|
|
+ content,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">
|
|
|
+ #{id,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="category != null">
|
|
|
+ #{category,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="title != null">
|
|
|
+ #{title,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="summary != null">
|
|
|
+ #{summary,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="source != null">
|
|
|
+ #{source,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ #{status,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="owner != null">
|
|
|
+ #{owner,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="releaseTime != null">
|
|
|
+ #{releaseTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="readNumber != null">
|
|
|
+ #{readNumber,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="commentNumber != null">
|
|
|
+ #{commentNumber,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="starNumber != null">
|
|
|
+ #{starNumber,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="keyword != null">
|
|
|
+ #{keyword,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="picUrl != null">
|
|
|
+ #{picUrl,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="top != null">
|
|
|
+ #{top,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="recommend != null">
|
|
|
+ #{recommend,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="content != null">
|
|
|
+ #{content,jdbcType=LONGVARCHAR},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <select id="countByExample" parameterType="com.goafanti.common.model.JtKnowledgeBaseExample" resultType="java.lang.Integer">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ select count(*) from jt_knowledge_base
|
|
|
+ <if test="_parameter != null">
|
|
|
+ <include refid="Example_Where_Clause" />
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <update id="updateByExampleSelective" parameterType="map">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ update jt_knowledge_base
|
|
|
+ <set>
|
|
|
+ <if test="record.id != null">
|
|
|
+ id = #{record.id,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="record.category != null">
|
|
|
+ category = #{record.category,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="record.title != null">
|
|
|
+ title = #{record.title,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="record.summary != null">
|
|
|
+ summary = #{record.summary,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="record.source != null">
|
|
|
+ source = #{record.source,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="record.status != null">
|
|
|
+ status = #{record.status,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="record.createTime != null">
|
|
|
+ create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="record.owner != null">
|
|
|
+ owner = #{record.owner,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="record.releaseTime != null">
|
|
|
+ release_time = #{record.releaseTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="record.readNumber != null">
|
|
|
+ read_number = #{record.readNumber,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="record.commentNumber != null">
|
|
|
+ comment_number = #{record.commentNumber,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="record.starNumber != null">
|
|
|
+ star_number = #{record.starNumber,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="record.keyword != null">
|
|
|
+ keyword = #{record.keyword,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="record.picUrl != null">
|
|
|
+ pic_url = #{record.picUrl,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="record.top != null">
|
|
|
+ top = #{record.top,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="record.recommend != null">
|
|
|
+ recommend = #{record.recommend,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="record.content != null">
|
|
|
+ content = #{record.content,jdbcType=LONGVARCHAR},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ <if test="_parameter != null">
|
|
|
+ <include refid="Update_By_Example_Where_Clause" />
|
|
|
+ </if>
|
|
|
+ </update>
|
|
|
+ <update id="updateByExampleWithBLOBs" parameterType="map">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ update jt_knowledge_base
|
|
|
+ set id = #{record.id,jdbcType=VARCHAR},
|
|
|
+ category = #{record.category,jdbcType=INTEGER},
|
|
|
+ title = #{record.title,jdbcType=VARCHAR},
|
|
|
+ summary = #{record.summary,jdbcType=VARCHAR},
|
|
|
+ source = #{record.source,jdbcType=VARCHAR},
|
|
|
+ status = #{record.status,jdbcType=INTEGER},
|
|
|
+ create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
|
|
+ owner = #{record.owner,jdbcType=VARCHAR},
|
|
|
+ release_time = #{record.releaseTime,jdbcType=TIMESTAMP},
|
|
|
+ read_number = #{record.readNumber,jdbcType=INTEGER},
|
|
|
+ comment_number = #{record.commentNumber,jdbcType=INTEGER},
|
|
|
+ star_number = #{record.starNumber,jdbcType=INTEGER},
|
|
|
+ keyword = #{record.keyword,jdbcType=VARCHAR},
|
|
|
+ pic_url = #{record.picUrl,jdbcType=VARCHAR},
|
|
|
+ top = #{record.top,jdbcType=INTEGER},
|
|
|
+ recommend = #{record.recommend,jdbcType=INTEGER},
|
|
|
+ content = #{record.content,jdbcType=LONGVARCHAR}
|
|
|
+ <if test="_parameter != null">
|
|
|
+ <include refid="Update_By_Example_Where_Clause" />
|
|
|
+ </if>
|
|
|
+ </update>
|
|
|
+ <update id="updateByExample" parameterType="map">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbggenerated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Wed Nov 07 10:11:18 CST 2018.
|
|
|
+ -->
|
|
|
+ update jt_knowledge_base
|
|
|
+ set id = #{record.id,jdbcType=VARCHAR},
|
|
|
+ category = #{record.category,jdbcType=INTEGER},
|
|
|
+ title = #{record.title,jdbcType=VARCHAR},
|
|
|
+ summary = #{record.summary,jdbcType=VARCHAR},
|
|
|
+ source = #{record.source,jdbcType=VARCHAR},
|
|
|
+ status = #{record.status,jdbcType=INTEGER},
|
|
|
+ create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
|
|
+ owner = #{record.owner,jdbcType=VARCHAR},
|
|
|
+ release_time = #{record.releaseTime,jdbcType=TIMESTAMP},
|
|
|
+ read_number = #{record.readNumber,jdbcType=INTEGER},
|
|
|
+ comment_number = #{record.commentNumber,jdbcType=INTEGER},
|
|
|
+ star_number = #{record.starNumber,jdbcType=INTEGER},
|
|
|
+ keyword = #{record.keyword,jdbcType=VARCHAR},
|
|
|
+ pic_url = #{record.picUrl,jdbcType=VARCHAR},
|
|
|
+ top = #{record.top,jdbcType=INTEGER},
|
|
|
+ recommend = #{record.recommend,jdbcType=INTEGER}
|
|
|
+ <if test="_parameter != null">
|
|
|
+ <include refid="Update_By_Example_Where_Clause" />
|
|
|
+ </if>
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!-- 获得列表 -->
|
|
|
+ <select id="getKnowledgeBaseListBySome" parameterType="java.util.Map" resultType="com.goafanti.admin.bo.KnowledgeBaseBo">
|
|
|
+ select
|
|
|
+ v.id, v.category, v.title, v.summary, v.source, v.status, v.create_time as createTime, v.owner, v.release_time as releaseTime,
|
|
|
+ v.read_number as readNumber,
|
|
|
+ v.comment_number as commentNumber, v.star_number as starNumber, v.keyword, v.pic_url as picUrl, v.top, v.recommend, a.name as ownerName
|
|
|
+ from jt_knowledge_base v
|
|
|
+ left join admin a on v.owner = a.id
|
|
|
+ where 1=1
|
|
|
+ <if test='v.title != null and v.title != ""'>
|
|
|
+ <bind name="n" value="'%' + v.title + '%' " />
|
|
|
+ and v.title like #{n,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="v.category != null">
|
|
|
+ and v.category = #{v.category,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="v.status != null">
|
|
|
+ and v.status = #{v.status,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="v.status == null">
|
|
|
+ and v.status <> 2
|
|
|
+ </if>
|
|
|
+ <if test="v.owner != null">
|
|
|
+ and v.owner = #{v.owner,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test='v.keyword != null and v.keyword != ""'>
|
|
|
+ <bind name="kw" value="'%' + v.keyword + '%' "/>
|
|
|
+ and v.keyword like #{kw,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null and endTime != null">
|
|
|
+ v.release_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="v.top != null">
|
|
|
+ and v.top = #{v.top,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="v.recommend != null">
|
|
|
+ and v.recommend = #{v.recommend,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="ob == 1">
|
|
|
+ order by v.create_time desc
|
|
|
+ </if>
|
|
|
+ <if test="ob == 2">
|
|
|
+ order by v.release_time desc
|
|
|
+ </if>
|
|
|
+ <if test="page_sql!=null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <!-- 获得总数 -->
|
|
|
+ <select id="getKnowledgeBaseCountBySome" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
|
+ select count(*)
|
|
|
+ from jt_knowledge_base v
|
|
|
+ left join admin a on v.owner = a.id
|
|
|
+ where 1=1
|
|
|
+ <if test='v.title != null and v.title != ""'>
|
|
|
+ <bind name="n" value="'%' + v.title + '%' " />
|
|
|
+ and v.title like #{n,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="v.category != null">
|
|
|
+ and v.category = #{v.category,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="v.status != null">
|
|
|
+ and v.status = #{v.status,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="v.status == null">
|
|
|
+ and v.status <> 2
|
|
|
+ </if>
|
|
|
+ <if test="v.owner != null">
|
|
|
+ and v.owner = #{v.owner,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test='v.keyword != null and v.keyword != ""'>
|
|
|
+ <bind name="kw" value="'%' + v.keyword + '%' "/>
|
|
|
+ and v.keyword like #{kw,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="v.top != null">
|
|
|
+ and v.top = #{v.top,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="v.recommend != null">
|
|
|
+ and v.recommend = #{v.recommend,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="ob == 1">
|
|
|
+ order by v.create_time desc
|
|
|
+ </if>
|
|
|
+ <if test="ob == 2">
|
|
|
+ order by v.release_time desc
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 获得一个知识详情数据 -->
|
|
|
+ <select id="getKnowledgeBaseById" parameterType="com.goafanti.common.model.JtKnowledgeBase" resultType="com.goafanti.admin.bo.KnowledgeBaseBo">
|
|
|
+ select
|
|
|
+ v.id, v.category, v.title, v.summary, v.source, v.status, v.create_time as createTime, v.owner, v.release_time as releaseTime, v.read_number as readNumber,
|
|
|
+ v.comment_number as commentNumber, v.star_number as starNumber, v.keyword, v.pic_url as picUrl, v.top, v.recommend, v.content, a.name as ownerName
|
|
|
+ from jt_knowledge_base v
|
|
|
+ left join admin a on v.owner = a.id
|
|
|
+ where 1=1
|
|
|
+ <if test="id != null">
|
|
|
+ and v.id = #{id,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="category != null">
|
|
|
+ and v.category = #{category,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test='title != null and title != ""'>
|
|
|
+ <bind name="n" value="'%' + title + '%' " />
|
|
|
+ and v.title like #{n,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="summary != null">
|
|
|
+ <bind name="s" value="'%' + summary + '%' " />
|
|
|
+ and v.summary like #{s,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="source != null">
|
|
|
+ and v.source = #{source,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ and v.status = #{status,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="owner != null">
|
|
|
+ and v.owner #{owner,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="readNumber != null">
|
|
|
+ and v.read_number = #{readNumber,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="commentNumber != null">
|
|
|
+ and v.comment_number = #{commentNumber,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="starNumber != null">
|
|
|
+ and v.star_Number = #{starNumber,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="keyword != null">
|
|
|
+ <bind name="kw" value="'%' + keyword + '%' "/>
|
|
|
+ and v.keyword like #{kw,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="picUrl != null">
|
|
|
+ and v.pic_url = #{picUrl,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="top != null">
|
|
|
+ and v.top = #{top,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="recommend != null">
|
|
|
+ and v.recommend = #{recommend,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <!-- 修改 -->
|
|
|
+ <update id="updateBySome" parameterType="com.goafanti.common.model.JtKnowledgeBase">
|
|
|
+ update jt_knowledge_base
|
|
|
+ <set>
|
|
|
+ <if test="category != null">
|
|
|
+ category = #{category,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="title != null">
|
|
|
+ title = #{title,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="summary != null">
|
|
|
+ summary = #{summary,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="source != null">
|
|
|
+ source = #{source,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ status = #{status,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="owner != null">
|
|
|
+ owner = #{owner,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="releaseTime != null">
|
|
|
+ release_time = #{releaseTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="picUrl != null">
|
|
|
+ pic_url = #{picUrl,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="top != null">
|
|
|
+ top = #{top,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="recommend != null">
|
|
|
+ recommend = #{recommend,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="keyword != null">
|
|
|
+ keyword = #{keyword,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="content != null">
|
|
|
+ content = #{content,jdbcType=LONGVARCHAR},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+ <!-- 新增一个阅读量 -->
|
|
|
+ <update id="addOneRead" parameterType="java.lang.String">
|
|
|
+ update jt_knowledge_base set read_number = read_number +1
|
|
|
+ where
|
|
|
+ id = #{_parameter,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+ <!-- 新增一个评论量 -->
|
|
|
+ <update id="addOneComment" parameterType="java.lang.String">
|
|
|
+ update jt_knowledge_base set comment_number = comment_number +1
|
|
|
+ where
|
|
|
+ id = #{_parameter,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+ <!-- 新增一个点赞量 -->
|
|
|
+ <update id="addOneStar" parameterType="java.lang.String">
|
|
|
+ update jt_knowledge_base set star_number = star_number +1
|
|
|
+ where
|
|
|
+ id = #{_parameter,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+ <!-- 标题检查 -->
|
|
|
+ <select id="nameCheck" parameterType="java.lang.String" resultType="java.lang.Integer">
|
|
|
+ select count(*) from jt_knowledge_base where title = #{_parameter,jdbcType=VARCHAR}
|
|
|
+ </select>
|
|
|
+</mapper>
|