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/user/OwnerV1ServiceDaoImplMapper.xml | 54 ++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 48 insertions(+), 6 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/user/OwnerV1ServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/user/OwnerV1ServiceDaoImplMapper.xml
index 22a8ff7..288221f 100644
--- a/java110-db/src/main/resources/mapper/user/OwnerV1ServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/user/OwnerV1ServiceDaoImplMapper.xml
@@ -6,9 +6,9 @@
<!-- 淇濆瓨涓氫富淇℃伅淇℃伅 add by wuxw 2018-07-03 -->
<insert id="saveOwnerInfo" parameterType="Map">
insert into building_owner(id_card, sex, link, owner_type_cd, remark, owner_id, user_id, name, state,
- community_id, age, member_id, address)
+ community_id, age, member_id, address)
values (#{idCard}, #{sex}, #{link}, #{ownerTypeCd}, #{remark}, #{ownerId}, #{userId}, #{name}, #{state},
- #{communityId}, #{age}, #{memberId}, #{address})
+ #{communityId}, #{age}, #{memberId}, #{address})
</insert>
<!-- 鏌ヨ涓氫富淇℃伅淇℃伅 add by wuxw 2018-07-03 -->
@@ -33,6 +33,12 @@
<if test="ownerTypeCd !=null and ownerTypeCd != ''">
and t.owner_type_cd= #{ownerTypeCd}
</if>
+ <if test="ownerTypeCds != null">
+ and t.owner_type_cd in
+ <foreach collection="ownerTypeCds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ </if>
<if test="remark !=null and remark != ''">
and t.remark= #{remark}
</if>
@@ -42,11 +48,20 @@
<if test="ownerId !=null and ownerId != ''">
and t.owner_id= #{ownerId}
</if>
+ <if test="ownerIds !=null">
+ and t.owner_id in
+ <foreach collection="ownerIds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ </if>
<if test="userId !=null and userId != ''">
and t.user_id= #{userId}
</if>
<if test="name !=null and name != ''">
and t.name= #{name}
+ </if>
+ <if test="nameLike !=null and nameLike != ''">
+ and t.name like concat('%',#{nameLike},'%')
</if>
<if test="state !=null and state != ''">
and t.state= #{state}
@@ -72,9 +87,7 @@
<if test="newBId != null and newBId != ''">
,t.b_id = #{newBId}
</if>
- <if test="idCard !=null and idCard != ''">
- , t.id_card= #{idCard}
- </if>
+ , t.id_card= #{idCard}
<if test="sex !=null and sex != ''">
, t.sex= #{sex}
</if>
@@ -105,7 +118,7 @@
<if test="communityId !=null and communityId != ''">
, t.community_id= #{communityId}
</if>
- <if test="age !=null and age != ''">
+ <if test="age != ''">
, t.age= #{age}
</if>
where 1=1
@@ -134,6 +147,12 @@
<if test="ownerTypeCd !=null and ownerTypeCd != ''">
and t.owner_type_cd= #{ownerTypeCd}
</if>
+ <if test="ownerTypeCds != null">
+ and t.owner_type_cd in
+ <foreach collection="ownerTypeCds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ </if>
<if test="remark !=null and remark != ''">
and t.remark= #{remark}
</if>
@@ -143,11 +162,20 @@
<if test="ownerId !=null and ownerId != ''">
and t.owner_id= #{ownerId}
</if>
+ <if test="ownerIds !=null">
+ and t.owner_id in
+ <foreach collection="ownerIds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ </if>
<if test="userId !=null and userId != ''">
and t.user_id= #{userId}
</if>
<if test="name !=null and name != ''">
and t.name= #{name}
+ </if>
+ <if test="nameLike !=null and nameLike != ''">
+ and t.name like concat('%',#{nameLike},'%')
</if>
<if test="state !=null and state != ''">
and t.state= #{state}
@@ -179,4 +207,18 @@
</if>
</select>
+ <select id="queryOwnerMembersCount" parameterType="Map" resultType="Map">
+ select t.owner_id ownerId,count(1) memberCount
+ from
+ building_owner t
+ where t.status_cd = '0'
+ and t.owner_type_cd != '1001'
+ and t.owner_id in
+ <foreach collection="ownerIds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ group by t.owner_id
+ </select>
+
+
</mapper>
--
Gitblit v1.8.0