From 781c2e20a4bb844dae3f4eafbf5f0e494b942ea8 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 25 五月 2023 18:07:08 +0800
Subject: [PATCH] optimize

---
 java110-db/src/main/resources/mapper/user/OwnerCarV1ServiceDaoImplMapper.xml |   70 +++++++++++++++++++++++++++-------
 1 files changed, 55 insertions(+), 15 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/user/OwnerCarV1ServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/user/OwnerCarV1ServiceDaoImplMapper.xml
index cafa8da..057fa31 100644
--- a/java110-db/src/main/resources/mapper/user/OwnerCarV1ServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/user/OwnerCarV1ServiceDaoImplMapper.xml
@@ -7,11 +7,10 @@
 
     <!-- 淇濆瓨杞﹁締淇℃伅 add by wuxw 2018-07-03 -->
     <insert id="saveOwnerCarInfo" parameterType="Map">
-        insert into owner_car(
-        car_brand,car_num,ps_id,remark,owner_id,car_type_cd,user_id,car_id,car_color,car_type,start_time,end_time,state,community_id,member_id,b_id
-        ) values (
-        #{carBrand},#{carNum},#{psId},#{remark},#{ownerId},#{carTypeCd},#{userId},#{carId},#{carColor},#{carType},#{startTime},#{endTime},#{state},#{communityId},#{memberId},'-1'
-        )
+        insert into owner_car(car_brand, car_num, ps_id, remark, owner_id, car_type_cd, user_id, car_id, car_color,
+        car_type, start_time, end_time, state, community_id, member_id, b_id,lease_type)
+        values (#{carBrand}, #{carNum}, #{psId}, #{remark}, #{ownerId}, #{carTypeCd}, #{userId}, #{carId}, #{carColor},
+        #{carType}, #{startTime}, #{endTime}, #{state}, #{communityId}, #{memberId}, '-1',#{leaseType})
     </insert>
 
 
@@ -21,7 +20,8 @@
         psId,t.remark,t.status_cd,t.status_cd statusCd,t.owner_id,t.owner_id ownerId,t.car_type_cd,t.car_type_cd
         carTypeCd,t.user_id,t.user_id userId,t.car_id,t.car_id carId,t.car_color,t.car_color
         carColor,t.car_type,t.car_type carType,t.start_time,t.start_time startTime,t.end_time,t.end_time
-        endTime,t.state,t.community_id,t.community_id communityId,t.member_id,t.member_id memberId
+        endTime,t.state,t.community_id,t.community_id communityId,t.member_id,t.member_id memberId,t.lease_type
+        leaseType
         from owner_car t
         where 1 =1
         <if test="carBrand !=null and carBrand != ''">
@@ -29,6 +29,9 @@
         </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="psId !=null and psId != ''">
             and t.ps_id= #{psId}
@@ -41,6 +44,15 @@
         </if>
         <if test="ownerId !=null and ownerId != ''">
             and t.owner_id= #{ownerId}
+        </if>
+        <if test="leaseType !=null and leaseType != ''">
+            and t.lease_type= #{leaseType}
+        </if>
+        <if test="leaseTypes !=null ">
+            and t.lease_type in
+            <foreach collection="leaseTypes" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
         </if>
         <if test="carTypeCd !=null and carTypeCd != ''">
             and t.car_type_cd= #{carTypeCd}
@@ -101,14 +113,8 @@
         <if test="ownerId !=null and ownerId != ''">
             , t.owner_id= #{ownerId}
         </if>
-        <if test="carTypeCd !=null and carTypeCd != ''">
-            , t.car_type_cd= #{carTypeCd}
-        </if>
         <if test="userId !=null and userId != ''">
             , t.user_id= #{userId}
-        </if>
-        <if test="carId !=null and carId != ''">
-            , t.car_id= #{carId}
         </if>
         <if test="carColor !=null and carColor != ''">
             , t.car_color= #{carColor}
@@ -125,14 +131,25 @@
         <if test="state !=null and state != ''">
             , t.state= #{state}
         </if>
-        <if test="communityId !=null and communityId != ''">
-            , t.community_id= #{communityId}
+        <if test="leaseType !=null and leaseType != ''">
+            , t.lease_type= #{leaseType}
         </if>
         where 1=1
+        <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="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="carTypeCd !=null and carTypeCd != ''">
+            and t.car_type_cd= #{carTypeCd}
+        </if>
     </update>
 
     <!-- 鏌ヨ杞﹁締鏁伴噺 add by wuxw 2018-07-03 -->
@@ -146,6 +163,9 @@
         <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="psId !=null and psId != ''">
             and t.ps_id= #{psId}
         </if>
@@ -157,6 +177,15 @@
         </if>
         <if test="ownerId !=null and ownerId != ''">
             and t.owner_id= #{ownerId}
+        </if>
+        <if test="leaseType !=null and leaseType != ''">
+            and t.lease_type= #{leaseType}
+        </if>
+        <if test="leaseTypes !=null ">
+            and t.lease_type in
+            <foreach collection="leaseTypes" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
         </if>
         <if test="carTypeCd !=null and carTypeCd != ''">
             and t.car_type_cd= #{carTypeCd}
@@ -188,8 +217,19 @@
         <if test="memberId !=null and memberId != ''">
             and t.member_id= #{memberId}
         </if>
+    </select>
 
 
+    <select id="queryOwnerCarCountByOwnerIds" parameterType="Map" resultType="Map">
+        select t.owner_id ownerId,count(1) carCount
+        from
+        owner_car t
+        where t.status_cd = '0'
+        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