【优化】教程分类以及教程
This commit is contained in:
@@ -11,14 +11,16 @@
|
||||
<result column="view_count" property="viewCount"/>
|
||||
<result column="recommend_status" property="recommendStatus"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="lang" property="lang"/>
|
||||
<result column="category_title" property="categoryTitle"/>
|
||||
<result column="category_id" property="categoryId"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础查询SQL片段 -->
|
||||
<sql id="selectVOSql">
|
||||
select c.*, cc.category_title
|
||||
select c.*, cc.category_title, cc.id as category_id
|
||||
from app_tutorial c
|
||||
left join app_tutorial_category_relation ccr on c.id = ccr.tutorial_id
|
||||
left join app_tutorial_category cc on cc.id = ccr.category_id
|
||||
@@ -36,9 +38,28 @@
|
||||
<if test="tutorialTitle != null and tutorialTitle != ''">
|
||||
AND c.tutorial_title like CONCAT('%', #{tutorialTitle}, '%')
|
||||
</if>
|
||||
|
||||
</where>
|
||||
ORDER BY c.recommend_status,c.create_time asc
|
||||
</select>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="page" resultMap="VOResultMap">
|
||||
<include refid="selectVOSql"/>
|
||||
<where>
|
||||
<if test="tutorial.categoryId != null and tutorial.categoryId != 0">
|
||||
AND cc.id = #{tutorial.categoryId}
|
||||
</if>
|
||||
<if test="tutorial.tutorialTitle != null and tutorial.tutorialTitle != ''">
|
||||
AND c.tutorial_title like CONCAT('%', #{tutorial.tutorialTitle}, '%')
|
||||
</if>
|
||||
<if test="tutorial.lang != null and tutorial.lang != ''">
|
||||
AND c.lang = #{tutorial.lang}
|
||||
</if>
|
||||
<if test="tutorial.status != null">
|
||||
AND c.status = #{tutorial.status}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user