limeng 1 سال پیش
والد
کامیت
2905976ae0
1فایلهای تغییر یافته به همراه26 افزوده شده و 9 حذف شده
  1. 26 9
      src/main/resources/com/sooka/mybatis/mapper/TCmsContentMapper.xml

+ 26 - 9
src/main/resources/com/sooka/mybatis/mapper/TCmsContentMapper.xml

@@ -325,15 +325,32 @@
     </select>
     </select>
 
 
     <select id="QueryTitleDescription"  resultType="com.sooka.mybatis.model.TCmsContent" parameterType="java.util.Map">
     <select id="QueryTitleDescription"  resultType="com.sooka.mybatis.model.TCmsContent" parameterType="java.util.Map">
-        select * from
-        (select news.content_id contentId, t_cms_content.category_id categoryId, t_cms_content.title,t_cms_content.url,t_cms_content.user_id,t_cms_content.inputdate,news.content description
-        from t_cms_content,t_cms_content_news news
-        where
-        (   title like CONCAT('%',#{keyword},'%')
-        or
-        description like CONCAT('%',#{keyword},'%')
-        ) and news.content_id=t_cms_content.content_id) a
-
+        SELECT
+            *
+        FROM
+        (
+            SELECT
+                news.content_id contentId,
+                t_cms_content.category_id categoryId,
+                t_cms_content.title,
+                t_cms_content.url,
+                t_cms_content.user_id,
+                t_cms_content.inputdate,
+                news.content description
+            FROM
+                t_cms_content,
+                t_cms_content_news news
+            WHERE
+                1 = 1
+            AND
+                (
+                    title like CONCAT('%',#{keyword},'%')
+                    or
+                    description like CONCAT('%',#{keyword},'%')
+                )
+            AND news.content_id = t_cms_content.content_id
+            AND STATUS = 1
+        ) a
         <if test="categoryId != null">
         <if test="categoryId != null">
             left join
             left join
             cms.t_cms_category c on a.categoryId = c.category_id where c.parent_id = #{categoryId}
             cms.t_cms_category c on a.categoryId = c.category_id where c.parent_id = #{categoryId}