| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?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.yonge.cooleshow.bbs.dao.BbsArticleDao">
- <resultMap id="BaseResultMap" type="com.yonge.cooleshow.bbs.entity.BbsArticle">
- <result column="id_" property="id" />
- <result column="user_id_" property="userId" />
- <result column="title_" property="title" />
- <result column="content_" property="content" />
- <result column="label_id_" property="labelId" />
- <result column="label_name_" property="labelName" />
- <result column="views_count_" property="viewsCount" />
- <result column="likes_count_" property="likesCount" />
- <result column="comments_count_" property="commentsCount" />
- <result column="collects_count_" property="collectsCount" />
- <result column="status_" property="status" />
- <result column="top_flag_" property="topFlag" />
- <result column="reply_flag_" property="replyFlag" />
- <result column="examine_time_" property="examineTime" />
- <result column="created_time_" property="createdTime" />
- <result column="updated_time_" property="updatedTime" />
- <result column="del_flag_" property="delFlag" />
- </resultMap>
- <!-- 表字段 -->
- <sql id="baseColumns">
- t.id_ as id
- , t.user_id_ as userId
- , t.title_ as title
- , t.content_ as content
- , t.label_id_ as labelId
- , t.label_name_ as labelName
- , t.views_count_ as viewsCount
- , t.likes_count_ as likesCount
- , t.comments_count_ as commentsCount
- , t.collects_count_ as collectsCount
- , t.status_ as status
- , t.top_flag_ as topFlag
- , t.reply_flag_ as replyFlag
- , t.examine_time_ as examineTime
- , t.created_time_ as createdTime
- , t.updated_time_ as updatedTime
- , t.del_flag_ as delFlag
- </sql>
- <insert id="addArticle" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- INSERT INTO bbs_article
- (user_id_,title_,content_,label_id_,label_name_,status_,reply_flag_)
- VALUES(#{userId},#{title},#{content},#{labelId},#{labelName},#{status},#{replyFlag})
- </insert>
- <update id="deleteArticle" parameterType="java.util.List">
- UPDATE bbs_article SET del_flag_=1 WHERE id_ IN
- <foreach collection="list" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </update>
- <select id="selectPage" resultType="com.yonge.cooleshow.bbs.vo.BbsArticleVo">
- SELECT
- <include refid="baseColumns" />
- FROM bbs_article t
- <where>
- <if test="param.status != null ">
- and #{param.status} = t.status_
- </if>
- <if test="param.search != null and param.search != ''">
- and t.title_ like concat('%',#{param.search},'%')
- </if>
- <if test="param.label != null">
- and t.label_id_ = #{param.label}
- </if>
- <if test="param.userId != null" >
- and t.user_id_ = #{param.userId}
- </if>
- <if test="param.delFlag != null" >
- and t.del_flag_ = #{param.delFlag}
- </if>
- </where>
- order by find_in_set(t.top_flag_,1),
- <if test="param.sort != null">
- <choose>
- <when test="param.sort == 'HOT'">
- t.comments_count_ desc,
- </when>
- </choose>
- </if>
- t.created_time_ desc
- </select>
- </mapper>
|