|
|
@@ -0,0 +1,46 @@
|
|
|
+<?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="cn.seecoder.fdroidrepository.Mapper.PostMapper">
|
|
|
+ <resultMap id="PostResultMap" type="cn.seecoder.fdroidrepository.DataObject.PO.PostPO">
|
|
|
+ <id property="id" column="id"/>
|
|
|
+ <result property="authorId" column="author_id"/>
|
|
|
+ <result property="authorName" column="author_name"/>
|
|
|
+ <result property="title" column="title"/>
|
|
|
+ <result property="content" column="content"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ <result property="valid" column="valid"/>
|
|
|
+ <result property="type" column="type"/>
|
|
|
+ <result property="topic" column="topic"/>
|
|
|
+ <result property="questionId" column="question_id"/>
|
|
|
+ <result property="questionName" column="question_name"/>
|
|
|
+ <result property="replyToId" column="reply_to_id"/>
|
|
|
+ <result property="rate" column="rate"/>
|
|
|
+ <result property="appId" column="app_id"/>
|
|
|
+ <result property="appName" column="app_name"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="search" resultMap="PostResultMap" parameterType="cn.seecoder.fdroidrepository.DataObject.VO.PostSearchVO">
|
|
|
+ select * from post where 1 = 1
|
|
|
+ <if test="type != null"> and type = #{type}</if>
|
|
|
+ <if test="valid != null">and valid = #{valid}</if>
|
|
|
+ <if test="authorId != null">and author_id = #{authorId}</if>
|
|
|
+ <if test="questionId != null">and question_id = #{questionId}</if>
|
|
|
+ <if test="replyToId != null">and reply_to_id = #{replyToId}</if>
|
|
|
+ <if test="appId != null">and app_id = #{appId}</if>
|
|
|
+ order by update_time desc
|
|
|
+ <if test="pageNum != null">
|
|
|
+ limit (#{pageNum} - 1) * 10,10
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="searchCount" resultType="java.lang.Integer" parameterType="cn.seecoder.fdroidrepository.DataObject.VO.PostSearchVO">
|
|
|
+ select count(id) from post where 1 = 1
|
|
|
+ <if test="type != null"> and type = #{type}</if>
|
|
|
+ <if test="valid != null">and valid = #{valid}</if>
|
|
|
+ <if test="authorId != null">and author_id = #{authorId}</if>
|
|
|
+ <if test="questionId != null">and question_id = #{questionId}</if>
|
|
|
+ <if test="replyToId != null">and reply_to_id = #{replyToId}</if>
|
|
|
+ <if test="appId != null">and app_id = #{appId}</if>
|
|
|
+ </select>
|
|
|
+</mapper>
|