Commit a2cb28a7 by 段启岩

更新博客和问题里面的字查询

parent f6d16496
......@@ -20,27 +20,21 @@
<result property="status" column="status"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<collection property="tags" ofType="cn.meteor.beyondclouds.modules.tag.entity.Tag">
<id property="tagId" column="tag_id"/>
<result property="tagName" column="tag_name"/>
<result property="tagType" column="tag_type"/>
<result property="referenceCount" column="reference_count"/>
<collection property="tags" ofType="cn.meteor.beyondclouds.modules.tag.entity.Tag" column="blog_id" select="selectTags">
</collection>
</resultMap>
<select id="selectTags" resultType="cn.meteor.beyondclouds.modules.tag.entity.Tag">
select t.*
from tag t, blog_tag bt
where bt.tag_id = t.tag_id
and bt.blog_id = #{blogId}
</select>
<select id="selectPageWithTags" resultMap="blogWithTagsResultMap">
select
b.*,
t.tag_id,
t.tag_name,
t.tag_type,
t.create_time,
t.update_time
b.*
from blog b
left join blog_tag bt
on b.blog_id = bt.blog_id
left join tag t
on t.tag_id = bt.tag_id
<if test="ew != null and ew.customSqlSegment != null">
${ew.customSqlSegment}
</if>
......@@ -49,18 +43,8 @@
<select id="listByIdsWithTags" resultMap="blogWithTagsResultMap">
select
b.*,
t.tag_id,
t.tag_name,
t.tag_type,
t.reference_count,
t.create_time,
t.update_time
b.*
from blog b
left join blog_tag bt
on b.blog_id = bt.blog_id
left join tag t
on t.tag_id = bt.tag_id
where b.blog_id in
<foreach collection="blogIds" item="blogId" index="index" open="(" close=")" separator=",">
#{blogId}
......
......@@ -16,28 +16,21 @@
<result property="status" column="status"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<collection property="tags" ofType="cn.meteor.beyondclouds.modules.tag.entity.Tag">
<id property="tagId" column="tag_id"/>
<result property="tagName" column="tag_name"/>
<result property="tagType" column="tag_type"/>
<result property="referenceCount" column="reference_count"/>
<collection property="tags" ofType="cn.meteor.beyondclouds.modules.tag.entity.Tag" column="question_id" select="selectTags">
</collection>
</resultMap>
<select id="selectTags" resultType="cn.meteor.beyondclouds.modules.tag.entity.Tag">
select t.*
from tag t, question_tag qt
where qt.tag_id = t.tag_id
and qt.question_id = #{questionId}
</select>
<select id="selectPageWithTags" resultMap="blogWithTagsResultMap">
select
q.*,
t.tag_id,
t.tag_name,
t.tag_type,
t.reference_count,
t.create_time,
t.update_time
q.*
from question q
left join question_tag qt
on q.question_id = qt.question_id
left join tag t
on t.tag_id = qt.tag_id
<if test="ew != null and ew.customSqlSegment != null">
${ew.customSqlSegment}
</if>
......@@ -45,18 +38,7 @@
<select id="listByIdsWithTags" resultMap="blogWithTagsResultMap">
select
q.*,
t.tag_id,
t.tag_name,
t.tag_type,
t.reference_count,
t.create_time,
t.update_time
from question q
left join question_tag qt
on q.question_id = qt.question_id
left join tag t
on t.tag_id = qt.tag_id
q.*
where q.question_id in
<foreach collection="questionIds" item="questionId" index="index" open="(" close=")" separator=",">
#{questionId}
......
......@@ -4,7 +4,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/beyond_clouds?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
username: root
password: 2018006709
password: 100Centa30821%mysql
# 邮箱
mail:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment