From b497ff41e47f4ebe69b86f13f6972f34f33f4884 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 01 六月 2021 09:35:46 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity

---
 java110-db/src/main/resources/mapper/store/ContractServiceDaoImplMapper.xml |   75 +++++++++++++++++++++++++++++++------
 1 files changed, 63 insertions(+), 12 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/store/ContractServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/store/ContractServiceDaoImplMapper.xml
index d749bbb..36a7091 100755
--- a/java110-db/src/main/resources/mapper/store/ContractServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/store/ContractServiceDaoImplMapper.xml
@@ -8,9 +8,13 @@
     <!-- 淇濆瓨鍚堝悓绠$悊淇℃伅 add by wuxw 2018-07-03 -->
     <insert id="saveContractInfo" parameterType="Map">
         insert into contract(
-        a_link,a_contacts,amount,contract_type,store_id,operator,signing_time,b_contacts,party_a,b_link,party_b,contract_id,obj_id,contract_name,start_time,end_time,state,contract_code,obj_type,operator_link
+        a_link,a_contacts,amount,contract_type,store_id,operator,signing_time,b_contacts,party_a,b_link,party_b,
+        contract_id,obj_id,contract_name,start_time,end_time,state,contract_code,obj_type,operator_link,contract_parent_id,
+        obj_name, obj_person_name, obj_person_id,start_user_id
         ) values (
-        #{aLink},#{aContacts},#{amount},#{contractType},#{storeId},#{operator},#{signingTime},#{bContacts},#{partyA},#{bLink},#{partyB},#{contractId},#{objId},#{contractName},#{startTime},#{endTime},#{state},#{contractCode},#{objType},#{operatorLink}
+        #{aLink},#{aContacts},#{amount},#{contractType},#{storeId},#{operator},#{signingTime},#{bContacts},#{partyA},#{bLink},#{partyB},
+        #{contractId},#{objId},#{contractName},#{startTime},#{endTime},#{state},#{contractCode},#{objType},#{operatorLink},#{contractParentId},
+        #{objName}, #{objPersonName}, #{objPersonId},#{startUserId}
         )
     </insert>
 
@@ -24,10 +28,15 @@
         partyB,t.contract_id,t.contract_id contractId,t.obj_id,t.obj_id objId,t.contract_name,t.contract_name
         contractName,t.start_time,t.start_time startTime,t.end_time,t.end_time
         endTime,t.state,t.contract_code,t.contract_code contractCode,t.obj_type,t.obj_type
-        objType,t.operator_link,t.operator_link operatorLink,ct.type_name contractTypeName,td.`name` stateName,t.state_desc stateDesc
+        objType,t.operator_link,t.operator_link operatorLink,ct.type_name contractTypeName,td.`name`
+        stateName,t.state_desc stateDesc,t.contract_parent_id contractParentId,tt.contract_code parentContractCode,
+        tt.contract_name parentContractName,t.obj_name objName, t.obj_person_name objPersonName, t.obj_person_id objPersonId,
+        t.start_user_id startUserId
         from contract t
-        LEFT JOIN contract_type ct on t.contract_type = ct.contract_type_id and ct.status_cd = '0' and ct.store_id = t.store_id
+        LEFT JOIN contract_type ct on t.contract_type = ct.contract_type_id and ct.status_cd = '0' and ct.store_id =
+        t.store_id
         LEFT JOIN t_dict td on td.status_cd = t.state and td.table_name = 'contract' and td.table_columns = 'state'
+        left join contract tt on t.contract_parent_id = tt.contract_id and tt.status_cd = '0' and tt.store_id = t.store_id
         where 1 =1
         <if test="aLink !=null and aLink != ''">
             and t.a_link= #{aLink}
@@ -68,20 +77,38 @@
         <if test="contractId !=null and contractId != ''">
             and t.contract_id= #{contractId}
         </if>
+        <if test="contractIds !=null">
+            and t.contract_id in
+            <foreach collection="contractIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
+        </if>
+        <if test="objPersonId !=null and objPersonId != ''">
+            and t.obj_person_id= #{objPersonId}
         </if>
         <if test="contractName !=null and contractName != ''">
             and t.contract_name= #{contractName}
         </if>
-        <if test="startTime !=null and startTime != ''">
+        <if test="contractNameLike !=null and contractNameLike != ''">
+            and t.contract_name like  concat('%',#{contractNameLike},'%')
+        </if>
+        <if test="startTime !=null">
             and t.start_time= #{startTime}
         </if>
-        <if test="endTime !=null and endTime != ''">
-            and t.end_time= #{endTime}
+        <if test="endTime !=null ">
+            and t.end_time &lt;= #{endTime}
         </if>
         <if test="state !=null and state != ''">
             and t.state= #{state}
+        </if>
+        <if test="noStates !=null ">
+            and t.state not in
+            <foreach collection="noStates" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
         </if>
         <if test="contractCode !=null and contractCode != ''">
             and t.contract_code= #{contractCode}
@@ -91,6 +118,9 @@
         </if>
         <if test="operatorLink !=null and operatorLink != ''">
             and t.operator_link= #{operatorLink}
+        </if>
+        <if test="contractParentId !=null and contractParentId != ''">
+            and t.contract_parent_id= #{contractParentId}
         </if>
         order by t.create_time desc
         <if test="page != -1 and page != null ">
@@ -142,13 +172,22 @@
         <if test="objId !=null and objId != ''">
             , t.obj_id= #{objId}
         </if>
+        <if test="objName !=null and objName != ''">
+            , t.obj_name= #{objName}
+        </if>
+        <if test="objPersonId !=null and objPersonId != ''">
+            , t.obj_person_id= #{objPersonId}
+        </if>
+        <if test="objPersonName !=null and objPersonName != ''">
+            , t.obj_person_name= #{objPersonName}
+        </if>
         <if test="contractName !=null and contractName != ''">
             , t.contract_name= #{contractName}
         </if>
-        <if test="startTime !=null and startTime != ''">
+        <if test="startTime !=null ">
             , t.start_time= #{startTime}
         </if>
-        <if test="endTime !=null and endTime != ''">
+        <if test="endTime !=null">
             , t.end_time= #{endTime}
         </if>
         <if test="state !=null and state != ''">
@@ -220,17 +259,26 @@
         <if test="objId !=null and objId != ''">
             and t.obj_id= #{objId}
         </if>
+        <if test="objPersonId !=null and objPersonId != ''">
+            and t.obj_person_id= #{objPersonId}
+        </if>
         <if test="contractName !=null and contractName != ''">
             and t.contract_name= #{contractName}
         </if>
-        <if test="startTime !=null and startTime != ''">
+        <if test="startTime !=null ">
             and t.start_time= #{startTime}
         </if>
-        <if test="endTime !=null and endTime != ''">
-            and t.end_time= #{endTime}
+        <if test="endTime !=null ">
+            and t.end_time &lt;= #{endTime}
         </if>
         <if test="state !=null and state != ''">
             and t.state= #{state}
+        </if>
+        <if test="noStates !=null ">
+            and t.state not in
+            <foreach collection="noStates" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
         </if>
         <if test="contractCode !=null and contractCode != ''">
             and t.contract_code= #{contractCode}
@@ -241,6 +289,9 @@
         <if test="operatorLink !=null and operatorLink != ''">
             and t.operator_link= #{operatorLink}
         </if>
+        <if test="contractParentId !=null and contractParentId != ''">
+            and t.contract_parent_id= #{contractParentId}
+        </if>
 
 
     </select>

--
Gitblit v1.8.0