From 3f1dc57d57ef0ceafcc59cd5ce34ff90cfe6d146 Mon Sep 17 00:00:00 2001
From: 1098226878 <1098226878@qq.com>
Date: 星期一, 13 九月 2021 17:06:16 +0800
Subject: [PATCH] 优化代码
---
java110-db/src/main/resources/mapper/user/OwnerCarServiceDaoImplMapper.xml | 114 +++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 94 insertions(+), 20 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/user/OwnerCarServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/user/OwnerCarServiceDaoImplMapper.xml
old mode 100644
new mode 100755
index 21ebbe1..3d74471
--- a/java110-db/src/main/resources/mapper/user/OwnerCarServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/user/OwnerCarServiceDaoImplMapper.xml
@@ -7,20 +7,21 @@
<!-- 淇濆瓨杞﹁締绠$悊淇℃伅 add by wuxw 2018-07-03 -->
<insert id="saveBusinessOwnerCarInfo" parameterType="Map">
insert into business_owner_car(
- car_color,car_brand,car_type,operate,car_num,ps_id,remark,owner_id,b_id,user_id,car_id,community_id,start_time,end_time,state
+ car_color,car_brand,car_type,operate,car_num,ps_id,remark,owner_id,b_id,user_id,car_id,community_id,start_time,
+ end_time,state,car_type_cd,member_id
) values (
#{carColor},#{carBrand},#{carType},#{operate},#{carNum},#{psId},#{remark},#{ownerId},#{bId},#{userId},#{carId},#{communityId},
- #{startTime},#{endTime},#{state}
+ #{startTime},#{endTime},#{state},#{carTypeCd},#{memberId}
)
</insert>
-
<!-- 鏌ヨ杞﹁締绠$悊淇℃伅锛圔usiness锛� add by wuxw 2018-07-03 -->
<select id="getBusinessOwnerCarInfo" parameterType="Map" resultType="Map">
select t.car_color,t.car_color carColor,t.car_brand,t.car_brand carBrand,t.car_type,t.car_type
carType,t.operate,t.car_num,t.car_num carNum,t.ps_id,t.ps_id psId,t.remark,t.owner_id,t.owner_id
ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.car_id,t.car_id carId,t.community_id,t.community_id
- communityId,t.start_time,t.end_time,t.state,t.start_time startTime,t.end_time endTime
+ communityId,t.start_time,t.end_time,t.state,t.start_time startTime,t.end_time endTime,t.car_type_cd,
+ t.car_type_cd carTypeCd,t.member_id,t.member_id memberId
from business_owner_car t
where 1 =1
<if test="carColor !=null and carColor != ''">
@@ -31,6 +32,9 @@
</if>
<if test="carType !=null and carType != ''">
and t.car_type= #{carType}
+ </if>
+ <if test="carTypeCd !=null and carTypeCd != ''">
+ and t.car_type_cd= #{carTypeCd}
</if>
<if test="operate !=null and operate != ''">
and t.operate= #{operate}
@@ -56,19 +60,22 @@
<if test="carId !=null and carId != ''">
and t.car_id= #{carId}
</if>
+ <if test="memberId !=null and memberId != ''">
+ and t.member_id= #{memberId}
+ </if>
<if test="communityId !=null and communityId != ''">
and t.community_id= #{communityId}
</if>
-
</select>
-
<!-- 淇濆瓨杞﹁締绠$悊淇℃伅鑷� instance琛ㄤ腑 add by wuxw 2018-07-03 -->
<insert id="saveOwnerCarInfoInstance" parameterType="Map">
insert into owner_car(
- car_color,car_brand,car_type,car_num,ps_id,remark,status_cd,owner_id,b_id,user_id,car_id,community_id,start_time,end_time,state
+ car_color,car_brand,car_type,car_num,ps_id,remark,status_cd,owner_id,b_id,user_id,car_id,community_id,
+ start_time,end_time,state,car_type_cd,member_id
) select
- t.car_color,t.car_brand,t.car_type,t.car_num,t.ps_id,t.remark,'0',t.owner_id,t.b_id,t.user_id,t.car_id,t.community_id,t.start_time,t.end_time,t.state
+ t.car_color,t.car_brand,t.car_type,t.car_num,t.ps_id,t.remark,'0',t.owner_id,t.b_id,t.user_id,t.car_id,t.community_id,
+ t.start_time,t.end_time,t.state, t.car_type_cd,t.member_id
from business_owner_car t where 1=1
<if test="carColor !=null and carColor != ''">
and t.car_color= #{carColor}
@@ -78,6 +85,9 @@
</if>
<if test="carType !=null and carType != ''">
and t.car_type= #{carType}
+ </if>
+ <if test="carTypeCd !=null and carTypeCd != ''">
+ and t.car_type_cd= #{carTypeCd}
</if>
and t.operate= 'ADD'
<if test="carNum !=null and carNum != ''">
@@ -101,10 +111,12 @@
<if test="carId !=null and carId != ''">
and t.car_id= #{carId}
</if>
+ <if test="memberId !=null and memberId != ''">
+ and t.member_id= #{memberId}
+ </if>
<if test="communityId !=null and communityId != ''">
and t.community_id= #{communityId}
</if>
-
</insert>
@@ -115,7 +127,8 @@
t.car_num,t.car_num carNum,t.ps_id,t.ps_id psId,t.remark,t.status_cd,t.status_cd statusCd,t.owner_id,
t.owner_id ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.car_id,t.car_id carId ,t.create_time
createTime,t.community_id communityId,bow.name ownerName,bow.id_card idCard,bow.link,t2.name stateName,
- t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.state
+ t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.state,
+ t.car_type_cd,t.car_type_cd carTypeCd,t.member_id,t.member_id memberId
from owner_car t
left join t_dict t1 on t.car_type=t1.status_cd and t1.table_name='owner_car' and t1.table_columns = 'car_type'
left join t_dict t2 on t.state=t2.status_cd and t2.table_name='owner_car' and t2.table_columns = 'state'
@@ -123,7 +136,7 @@
t.community_id
where 1=1
<if test="statusCd !=null and statusCd != ''">
- and t.status_cd = #{statusCd}
+ and t.status_cd = #{statusCd}
</if>
<if test="carColor !=null and carColor != ''">
and t.car_color= #{carColor}
@@ -134,8 +147,14 @@
<if test="carType !=null and carType != ''">
and t.car_type= #{carType}
</if>
+ <if test="carTypeCd !=null and carTypeCd != ''">
+ and t.car_type_cd= #{carTypeCd}
+ </if>
<if test="carNum !=null and carNum != ''">
and t.car_num= #{carNum}
+ </if>
+ <if test="carNumLike !=null and carNumLike != ''">
+ and t.car_num like concat('%',#{carNumLike},'%')
</if>
<if test="carNums !=null">
and t.car_num in
@@ -162,13 +181,22 @@
and t.owner_id= #{ownerId}
</if>
<if test="ownerName !=null and ownerName != ''">
- and bow.name= #{ownerName}
+ and bow.name like '%${ownerName}%'
</if>
<if test="bId !=null and bId != ''">
and t.b_id= #{bId}
</if>
<if test="carId !=null and carId != ''">
and t.car_id= #{carId}
+ </if>
+ <if test="memberId !=null and memberId != ''">
+ and t.member_id= #{memberId}
+ </if>
+ <if test="memberIds !=null">
+ and t.member_id in
+ <foreach collection="memberIds" item="item" index="index" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
</if>
<if test="carIds !=null">
and t.car_id in
@@ -182,16 +210,20 @@
<if test="state !=null and state != ''">
and t.state= #{state}
</if>
- <if test="valid == '1'">
+ <if test="valid == 1">
and t.end_time > now()
+ </if>
+ <if test="valid == 3">
+ and t.end_time < now()
+ </if>
+ <if test="valid == 2">
+ and t.ps_id= '-1'
</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="updateOwnerCarInfoInstance" parameterType="Map">
@@ -239,8 +271,14 @@
<if test="carId !=null and carId != ''">
and t.car_id= #{carId}
</if>
+ <if test="memberId !=null and memberId != ''">
+ and t.member_id= #{memberId}
+ </if>
<if test="communityId !=null and communityId != ''">
and t.community_id= #{communityId}
+ </if>
+ <if test="carTypeCd !=null and carTypeCd != ''">
+ and t.car_type_cd= #{carTypeCd}
</if>
</update>
@@ -251,10 +289,11 @@
from owner_car t
left join t_dict t1 on t.car_type=t1.status_cd and t1.table_name='owner_car' and t1.table_columns = 'car_type'
left join t_dict t2 on t.state=t2.status_cd and t2.table_name='owner_car' and t2.table_columns = 'state'
- left join building_owner bow on t.owner_id = bow.member_id and bow.status_cd = '0' and bow.community_id = t.community_id
+ left join building_owner bow on t.owner_id = bow.member_id and bow.status_cd = '0' and bow.community_id =
+ t.community_id
where 1=1
<if test="statusCd !=null and statusCd != ''">
- and t.status_cd = #{statusCd}
+ and t.status_cd = #{statusCd}
</if>
<if test="carColor !=null and carColor != ''">
and t.car_color= #{carColor}
@@ -265,8 +304,14 @@
<if test="carType !=null and carType != ''">
and t.car_type= #{carType}
</if>
+ <if test="carTypeCd !=null and carTypeCd != ''">
+ and t.car_type_cd= #{carTypeCd}
+ </if>
<if test="carNum !=null and carNum != ''">
and t.car_num= #{carNum}
+ </if>
+ <if test="carNumLike !=null and carNumLike != ''">
+ and t.car_num like concat('%',#{carNumLike},'%')
</if>
<if test="carNums !=null">
and t.car_num in
@@ -287,13 +332,22 @@
and t.owner_id= #{ownerId}
</if>
<if test="ownerName !=null and ownerName != ''">
- and bow.name= #{ownerName}
+ and bow.name like '%${ownerName}%'
</if>
<if test="bId !=null and bId != ''">
and t.b_id= #{bId}
</if>
<if test="carId !=null and carId != ''">
and t.car_id= #{carId}
+ </if>
+ <if test="memberId !=null and memberId != ''">
+ and t.member_id= #{memberId}
+ </if>
+ <if test="memberIds !=null">
+ and t.member_id in
+ <foreach collection="memberIds" item="item" index="index" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
</if>
<if test="carIds !=null">
and t.car_id in
@@ -307,11 +361,31 @@
<if test="state !=null and state != ''">
and t.state= #{state}
</if>
- <if test="valid == '1'">
+ <if test="valid == 1">
and t.end_time > now()
</if>
-
+ <if test="valid == 3">
+ and t.end_time < now()
+ </if>
+ <if test="valid == 2">
+ and t.ps_id= '-1'
+ </if>
</select>
+ <select id="queryOwnerParkingSpaceCount" parameterType="Map" resultType="Map">
+ select count(DISTINCT t.ps_id) count
+ from owner_car t
+ where
+ t.ps_id != '-1'
+ <if test="statusCd !=null and statusCd != ''">
+ and t.status_cd= #{statusCd}
+ </if>
+ <if test="ownerId !=null and ownerId != ''">
+ and t.owner_id= #{ownerId}
+ </if>
+ <if test="communityId !=null and communityId != ''">
+ and t.community_id= #{communityId}
+ </if>
+ </select>
</mapper>
--
Gitblit v1.8.0