From f14c50cb0036d3ddd655ce4e34732ba396a836c4 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 30 五月 2023 12:42:03 +0800
Subject: [PATCH] optimize 统计

---
 java110-db/src/main/resources/mapper/common/CommunityPublicityV1ServiceDaoImplMapper.xml |  263 ++++++++++++++++++++++++++--------------------------
 1 files changed, 132 insertions(+), 131 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/common/CommunityPublicityV1ServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/common/CommunityPublicityV1ServiceDaoImplMapper.xml
index bdf16e0..6b4d526 100644
--- a/java110-db/src/main/resources/mapper/common/CommunityPublicityV1ServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/common/CommunityPublicityV1ServiceDaoImplMapper.xml
@@ -5,156 +5,157 @@
 <mapper namespace="communityPublicityV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 淇濆瓨灏忓尯鍏ず淇℃伅 add by wuxw 2018-07-03 -->
     <insert id="saveCommunityPublicityInfo" parameterType="Map">
         insert into community_publicity(
-create_user_id,pub_id,context,collect_count,pub_type,like_count,create_user_name,title,community_id,read_count,header_img
-) values (
-#{createUserId},#{pubId},#{context},#{collectCount},#{pubType},#{likeCount},#{createUserName},#{title},#{communityId},#{readCount},#{headerImg}
-)
+        create_user_id,pub_id,context,collect_count,pub_type,like_count,create_user_name,title,community_id,read_count,header_img
+        ) values (
+        #{createUserId},#{pubId},#{context},#{collectCount},#{pubType},#{likeCount},#{createUserName},#{title},#{communityId},#{readCount},#{headerImg}
+        )
     </insert>
-
 
 
     <!-- 鏌ヨ灏忓尯鍏ず淇℃伅 add by wuxw 2018-07-03 -->
     <select id="getCommunityPublicityInfo" parameterType="Map" resultType="Map">
-        select  t.create_user_id,t.create_user_id createUserId,t.pub_id,t.pub_id pubId,t.context,t.collect_count,t.collect_count collectCount,t.pub_type,t.pub_type pubType,t.like_count,t.like_count likeCount,t.create_user_name,t.create_user_name createUserName,t.status_cd,t.status_cd statusCd,t.title,t.community_id,t.community_id communityId,t.read_count,t.read_count readCount,t.header_img,t.header_img headerImg 
-from community_publicity t 
-where 1 =1 
-<if test="createUserId !=null and createUserId != ''">
-   and t.create_user_id= #{createUserId}
-</if> 
-<if test="pubId !=null and pubId != ''">
-   and t.pub_id= #{pubId}
-</if> 
-<if test="context !=null and context != ''">
-   and t.context= #{context}
-</if> 
-<if test="collectCount !=null and collectCount != ''">
-   and t.collect_count= #{collectCount}
-</if> 
-<if test="pubType !=null and pubType != ''">
-   and t.pub_type= #{pubType}
-</if> 
-<if test="likeCount !=null and likeCount != ''">
-   and t.like_count= #{likeCount}
-</if> 
-<if test="createUserName !=null and createUserName != ''">
-   and t.create_user_name= #{createUserName}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="title !=null and title != ''">
-   and t.title= #{title}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="readCount !=null and readCount != ''">
-   and t.read_count= #{readCount}
-</if> 
-<if test="headerImg !=null and headerImg != ''">
-   and t.header_img= #{headerImg}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.create_user_id,t.create_user_id createUserId,t.pub_id,t.pub_id
+        pubId,t.context,t.collect_count,t.collect_count collectCount,t.pub_type,t.pub_type
+        pubType,t.like_count,t.like_count likeCount,t.create_user_name,t.create_user_name
+        createUserName,t.status_cd,t.status_cd statusCd,t.title,t.community_id,t.community_id
+        communityId,t.read_count,t.read_count readCount,t.header_img,t.header_img headerImg,
+        t.create_time createTime,td.`name` pubTypeName
+        from community_publicity t
+        left join t_dict td on t.pub_type = td.status_cd and td.table_name = 'community_publicity' and td.table_columns = 'pub_type'
+        where 1 =1
+        <if test="createUserId !=null and createUserId != ''">
+            and t.create_user_id= #{createUserId}
+        </if>
+        <if test="pubId !=null and pubId != ''">
+            and t.pub_id= #{pubId}
+        </if>
+        <if test="context !=null and context != ''">
+            and t.context= #{context}
+        </if>
+        <if test="collectCount !=null and collectCount != ''">
+            and t.collect_count= #{collectCount}
+        </if>
+        <if test="pubType !=null and pubType != ''">
+            and t.pub_type= #{pubType}
+        </if>
+        <if test="likeCount !=null and likeCount != ''">
+            and t.like_count= #{likeCount}
+        </if>
+        <if test="createUserName !=null and createUserName != ''">
+            and t.create_user_name= #{createUserName}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="title !=null and title != ''">
+            and t.title= #{title}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="readCount !=null and readCount != ''">
+            and t.read_count= #{readCount}
+        </if>
+        <if test="headerImg !=null and headerImg != ''">
+            and t.header_img= #{headerImg}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
     </select>
 
 
-
-
     <!-- 淇敼灏忓尯鍏ず淇℃伅 add by wuxw 2018-07-03 -->
     <update id="updateCommunityPublicityInfo" parameterType="Map">
-        update  community_publicity t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="createUserId !=null and createUserId != ''">
-, t.create_user_id= #{createUserId}
-</if> 
-<if test="context !=null and context != ''">
-, t.context= #{context}
-</if> 
-<if test="collectCount !=null and collectCount != ''">
-, t.collect_count= #{collectCount}
-</if> 
-<if test="pubType !=null and pubType != ''">
-, t.pub_type= #{pubType}
-</if> 
-<if test="likeCount !=null and likeCount != ''">
-, t.like_count= #{likeCount}
-</if> 
-<if test="createUserName !=null and createUserName != ''">
-, t.create_user_name= #{createUserName}
-</if> 
-<if test="title !=null and title != ''">
-, t.title= #{title}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
-<if test="readCount !=null and readCount != ''">
-, t.read_count= #{readCount}
-</if> 
-<if test="headerImg !=null and headerImg != ''">
-, t.header_img= #{headerImg}
-</if> 
- where 1=1 <if test="pubId !=null and pubId != ''">
-and t.pub_id= #{pubId}
-</if> 
+        update community_publicity t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="createUserId !=null and createUserId != ''">
+            , t.create_user_id= #{createUserId}
+        </if>
+        <if test="context !=null and context != ''">
+            , t.context= #{context}
+        </if>
+        <if test="collectCount !=null and collectCount != ''">
+            , t.collect_count= #{collectCount}
+        </if>
+        <if test="pubType !=null and pubType != ''">
+            , t.pub_type= #{pubType}
+        </if>
+        <if test="likeCount !=null and likeCount != ''">
+            , t.like_count= #{likeCount}
+        </if>
+        <if test="createUserName !=null and createUserName != ''">
+            , t.create_user_name= #{createUserName}
+        </if>
+        <if test="title !=null and title != ''">
+            , t.title= #{title}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        <if test="readCount !=null and readCount != ''">
+            , t.read_count= #{readCount}
+        </if>
+        <if test="headerImg !=null and headerImg != ''">
+            , t.header_img= #{headerImg}
+        </if>
+        where 1=1
+        <if test="pubId !=null and pubId != ''">
+            and t.pub_id= #{pubId}
+        </if>
 
     </update>
 
     <!-- 鏌ヨ灏忓尯鍏ず鏁伴噺 add by wuxw 2018-07-03 -->
-     <select id="queryCommunityPublicitysCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from community_publicity t 
-where 1 =1 
-<if test="createUserId !=null and createUserId != ''">
-   and t.create_user_id= #{createUserId}
-</if> 
-<if test="pubId !=null and pubId != ''">
-   and t.pub_id= #{pubId}
-</if> 
-<if test="context !=null and context != ''">
-   and t.context= #{context}
-</if> 
-<if test="collectCount !=null and collectCount != ''">
-   and t.collect_count= #{collectCount}
-</if> 
-<if test="pubType !=null and pubType != ''">
-   and t.pub_type= #{pubType}
-</if> 
-<if test="likeCount !=null and likeCount != ''">
-   and t.like_count= #{likeCount}
-</if> 
-<if test="createUserName !=null and createUserName != ''">
-   and t.create_user_name= #{createUserName}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="title !=null and title != ''">
-   and t.title= #{title}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="readCount !=null and readCount != ''">
-   and t.read_count= #{readCount}
-</if> 
-<if test="headerImg !=null and headerImg != ''">
-   and t.header_img= #{headerImg}
-</if> 
+    <select id="queryCommunityPublicitysCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from community_publicity t
+        where 1 =1
+        <if test="createUserId !=null and createUserId != ''">
+            and t.create_user_id= #{createUserId}
+        </if>
+        <if test="pubId !=null and pubId != ''">
+            and t.pub_id= #{pubId}
+        </if>
+        <if test="context !=null and context != ''">
+            and t.context= #{context}
+        </if>
+        <if test="collectCount !=null and collectCount != ''">
+            and t.collect_count= #{collectCount}
+        </if>
+        <if test="pubType !=null and pubType != ''">
+            and t.pub_type= #{pubType}
+        </if>
+        <if test="likeCount !=null and likeCount != ''">
+            and t.like_count= #{likeCount}
+        </if>
+        <if test="createUserName !=null and createUserName != ''">
+            and t.create_user_name= #{createUserName}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="title !=null and title != ''">
+            and t.title= #{title}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="readCount !=null and readCount != ''">
+            and t.read_count= #{readCount}
+        </if>
+        <if test="headerImg !=null and headerImg != ''">
+            and t.header_img= #{headerImg}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

--
Gitblit v1.8.0