|
@@ -24,15 +24,20 @@
|
|
|
COALESCE(sf.nickname, '') user_nickname,
|
|
|
ac.id category_id,
|
|
|
ac.category_name category_name,
|
|
|
- COALESCE(a.meta_keyword, '') meta_keyword,
|
|
|
- COALESCE(a.meta_description, '') meta_description,
|
|
|
a.status status,
|
|
|
a.is_top is_top,
|
|
|
a.create_time create_time,
|
|
|
a.update_time update_time
|
|
|
</sql>
|
|
|
<sql id="includeArticleTranslation">
|
|
|
- id, article_id, language, title, description, content
|
|
|
+ id,
|
|
|
+ article_id,
|
|
|
+ language,
|
|
|
+ title,
|
|
|
+ description,
|
|
|
+ content,
|
|
|
+ COALESCE(meta_keyword, '') meta_keyword,
|
|
|
+ COALESCE(meta_description, '') meta_description
|
|
|
</sql>
|
|
|
<sql id="leftJoinCategory">
|
|
|
LEFT JOIN cms_article_category ac ON a.category_id = ac.id
|
|
@@ -41,7 +46,7 @@
|
|
|
LEFT JOIN sys_user_info sf ON a.user_id = sf.user_id
|
|
|
</sql>
|
|
|
<sql id="leftJoinTranslations">
|
|
|
- LEFT JOIN cms_article_translations at ON a.id = at.article_id
|
|
|
+ LEFT JOIN cms_article_i18n at ON a.id = at.article_id
|
|
|
</sql>
|
|
|
|
|
|
<resultMap id="resultMapArticle" type="java.util.LinkedHashMap">
|
|
@@ -66,8 +71,6 @@
|
|
|
<result property="user_nickname" column="user_nickname" />
|
|
|
<result property="category_id" column="category_id" javaType="java.lang.Long" />
|
|
|
<result property="category_name" column="category_name" />
|
|
|
- <result property="meta_keyword" column="meta_keyword" />
|
|
|
- <result property="meta_description" column="meta_description" />
|
|
|
<result property="status" column="status" javaType="java.lang.Integer" />
|
|
|
<result property="is_top" column="is_top" javaType="java.lang.Integer" />
|
|
|
<result property="create_time" column="create_time" />
|
|
@@ -78,6 +81,8 @@
|
|
|
<result property="title" column="title" />
|
|
|
<result property="content" column="content" />
|
|
|
<result property="description" column="description" />
|
|
|
+ <result property="meta_keyword" column="meta_keyword" />
|
|
|
+ <result property="meta_description" column="meta_description" />
|
|
|
</collection>
|
|
|
</resultMap>
|
|
|
|
|
@@ -106,10 +111,10 @@
|
|
|
AND a.create_time >= #{create_time}
|
|
|
</if>
|
|
|
</where>
|
|
|
- ORDER BY a.is_top = 1 DESC, a.update_time DESC
|
|
|
+ ORDER BY a.is_top = 1 DESC, a.create_time DESC
|
|
|
</select>
|
|
|
|
|
|
- <!-- 查 详情 (二次查询,带翻译) -->
|
|
|
+ <!-- 查 详情 -->
|
|
|
<select id="selectArticleDetail" resultMap="resultMapArticleDetail">
|
|
|
SELECT <include refid="includeArticleDetail" />
|
|
|
FROM cms_article a
|
|
@@ -117,13 +122,11 @@
|
|
|
<include refid="leftJoinUser" />
|
|
|
WHERE a.id = #{article_id}
|
|
|
</select>
|
|
|
- <!--<include refid="leftJoinTranslations" />-->
|
|
|
- <!-- and at.language = #{lang} -->
|
|
|
|
|
|
- <!-- 查 翻译集合 (子查询) -->
|
|
|
+ <!-- 查 翻译详情 (子查询) -->
|
|
|
<select id="queryTranslationsById" resultType="java.util.LinkedHashMap">
|
|
|
SELECT <include refid="includeArticleTranslation" />
|
|
|
- FROM cms_article_translations
|
|
|
+ FROM cms_article_i18n
|
|
|
WHERE article_id = #{id}
|
|
|
</select>
|
|
|
|
|
@@ -138,37 +141,6 @@
|
|
|
<!-- WHERE a.id = #{article_id} AND at.language = #{lang}-->
|
|
|
<!--</select>-->
|
|
|
|
|
|
-
|
|
|
- <!--<!– 审核功能,参考 /System/SysUserMapper.xml –>-->
|
|
|
-
|
|
|
- <!--<insert id="insertArticle" parameterType="com.backendsys.entity.Cms.CmsArticleDTO"-->
|
|
|
- <!-- useGeneratedKeys="true" keyProperty="article_id">-->
|
|
|
- <!-- INSERT INTO cms_article (-->
|
|
|
- <!-- user_id, category_id-->
|
|
|
- <!-- <if test="meta_keyword != null and meta_keyword != ''">, meta_keyword</if>-->
|
|
|
- <!-- <if test="meta_description != null and meta_description != ''">, meta_description</if>-->
|
|
|
- <!-- <if test="status != null and status != ''">, status</if>-->
|
|
|
- <!-- <if test="is_top != null and is_top != ''">, is_top</if>-->
|
|
|
- <!-- )-->
|
|
|
- <!-- VALUES (-->
|
|
|
- <!-- #{user_id}, #{category_id}-->
|
|
|
- <!-- <if test="meta_keyword != null and meta_keyword != ''">, #{meta_keyword}</if>-->
|
|
|
- <!-- <if test="meta_description != null and meta_description != ''">, #{meta_description}</if>-->
|
|
|
- <!-- <if test="status != null and status != ''">, #{status}</if>-->
|
|
|
- <!-- <if test="is_top != null and is_top != ''">, #{is_top}</if>-->
|
|
|
- <!-- );-->
|
|
|
- <!--</insert>-->
|
|
|
- <!--<insert id="insertArticleTranslations" parameterType="java.util.List">-->
|
|
|
- <!-- INSERT INTO cms_article_translations (-->
|
|
|
- <!-- article_id, language, title, content, description-->
|
|
|
- <!-- )-->
|
|
|
- <!-- VALUES-->
|
|
|
- <!-- <foreach collection="translations" item="translation" separator=",">-->
|
|
|
- <!-- (#{translation.article_id}, #{translation.language}, #{translation.title}, #{translation.content}, #{translation.description})-->
|
|
|
- <!-- </foreach>-->
|
|
|
- <!--</insert>-->
|
|
|
-
|
|
|
-
|
|
|
<!--<update id="updateArticle" parameterType="com.backendsys.entity.Cms.CmsArticleDTO"-->
|
|
|
<!-- useGeneratedKeys="true" keyProperty="article_id">-->
|
|
|
<!-- UPDATE cms_article-->
|
|
@@ -181,7 +153,7 @@
|
|
|
<!-- WHERE id = #{article_id};-->
|
|
|
|
|
|
<!-- <foreach collection="translations" item="translation" separator=";">-->
|
|
|
- <!-- UPDATE cms_article_translations-->
|
|
|
+ <!-- UPDATE cms_article_i18n-->
|
|
|
<!-- <set>-->
|
|
|
<!-- title = #{translation.title},-->
|
|
|
<!-- content = #{translation.content},-->
|
|
@@ -198,7 +170,7 @@
|
|
|
<!--<!– 删除 –>-->
|
|
|
<!--<delete id="deleteArticle" parameterType="java.lang.Long">-->
|
|
|
<!-- DELETE FROM cms_article WHERE id = #{article_id};-->
|
|
|
- <!-- DELETE FROM cms_article_translations WHERE article_id = #{article_id};-->
|
|
|
+ <!-- DELETE FROM cms_article_i18n WHERE article_id = #{article_id};-->
|
|
|
<!--</delete>-->
|
|
|
|
|
|
<!--<!– 删除 (批量) –>-->
|
|
@@ -208,7 +180,7 @@
|
|
|
<!-- #{id}-->
|
|
|
<!-- </foreach>;-->
|
|
|
|
|
|
- <!-- DELETE FROM cms_article_translations WHERE article_id IN-->
|
|
|
+ <!-- DELETE FROM cms_article_i18n WHERE article_id IN-->
|
|
|
<!-- <foreach collection="ids" item="id" open="(" separator="," close=")">-->
|
|
|
<!-- #{id}-->
|
|
|
<!-- </foreach>;-->
|