From ff6ea34f6d435039755da1dd628b495576faaf5c Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期一, 24 四月 2023 00:43:52 +0800
Subject: [PATCH] 优化合同查询相关代码
---
java110-bean/src/main/java/com/java110/dto/contract/ContractDto.java | 49 ++++++++++++++++++++++++
java110-db/src/main/resources/mapper/store/ContractServiceDaoImplMapper.xml | 42 ++++++++++++++++++++-
2 files changed, 89 insertions(+), 2 deletions(-)
diff --git a/java110-bean/src/main/java/com/java110/dto/contract/ContractDto.java b/java110-bean/src/main/java/com/java110/dto/contract/ContractDto.java
index e22fa9b..a0bad6e 100755
--- a/java110-bean/src/main/java/com/java110/dto/contract/ContractDto.java
+++ b/java110-bean/src/main/java/com/java110/dto/contract/ContractDto.java
@@ -45,11 +45,16 @@
private String startTime;
private String endTime;
+
+ private String queryStartTime;
+ private String queryEndTime;
private String state;
private String[] states;
private String[] noStates;
private String stateDesc;
private String contractCode;
+
+ private String contractCodeLike;
private String objType;
private String operatorLink;
private String contractParentId;
@@ -68,6 +73,8 @@
private String stateName;
private String parentContractCode;
+ private String parentContractCodeLike;
+
private String parentContractName;
@@ -88,6 +95,8 @@
private String hasAudit;
private String hasEnd;
+
+ private String partyBLike;
private List<ContractAttrDto> attrs;
@@ -490,4 +499,44 @@
public void setAudit(String audit) {
this.audit = audit;
}
+
+ public String getContractCodeLike() {
+ return contractCodeLike;
+ }
+
+ public void setContractCodeLike(String contractCodeLike) {
+ this.contractCodeLike = contractCodeLike;
+ }
+
+ public String getQueryStartTime() {
+ return queryStartTime;
+ }
+
+ public void setQueryStartTime(String queryStartTime) {
+ this.queryStartTime = queryStartTime;
+ }
+
+ public String getQueryEndTime() {
+ return queryEndTime;
+ }
+
+ public void setQueryEndTime(String queryEndTime) {
+ this.queryEndTime = queryEndTime;
+ }
+
+ public String getPartyBLike() {
+ return partyBLike;
+ }
+
+ public void setPartyBLike(String partyBLike) {
+ this.partyBLike = partyBLike;
+ }
+
+ public String getParentContractCodeLike() {
+ return parentContractCodeLike;
+ }
+
+ public void setParentContractCodeLike(String parentContractCodeLike) {
+ this.parentContractCodeLike = parentContractCodeLike;
+ }
}
diff --git a/java110-db/src/main/resources/mapper/store/ContractServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/store/ContractServiceDaoImplMapper.xml
index b42882c..dd46a1a 100755
--- a/java110-db/src/main/resources/mapper/store/ContractServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/store/ContractServiceDaoImplMapper.xml
@@ -74,6 +74,9 @@
<if test="partyB !=null and partyB != ''">
and t.party_b= #{partyB}
</if>
+ <if test="partyBLike !=null and partyBLike != ''">
+ and t.party_b like concat('%',#{partyBLike},'%')
+ </if>
<if test="contractId !=null and contractId != ''">
and t.contract_id= #{contractId}
</if>
@@ -101,6 +104,12 @@
<if test="endTime !=null ">
and t.end_time <= #{endTime}
</if>
+ <if test="queryStartTime !=null">
+ and t.create_time > #{queryStartTime}
+ </if>
+ <if test="queryEndTime !=null">
+ and t.create_time < #{queryEndTime}
+ </if>
<if test="state !=null and state != ''">
and t.state= #{state}
</if>
@@ -113,6 +122,9 @@
<if test="contractCode !=null and contractCode != ''">
and t.contract_code= #{contractCode}
</if>
+ <if test="contractCodeLike !=null and contractCodeLike != ''">
+ and t.contract_code like concat('%',#{contractCodeLike},'%')
+ </if>
<if test="objType !=null and objType != ''">
and t.obj_type= #{objType}
</if>
@@ -121,6 +133,9 @@
</if>
<if test="contractParentId !=null and contractParentId != ''">
and t.contract_parent_id= #{contractParentId}
+ </if>
+ <if test="parentContractCodeLike !=null and parentContractCodeLike != ''">
+ and tt.contract_code like concat('%',#{parentContractCodeLike},'%')
</if>
order by t.create_time desc
<if test="page != -1 and page != null ">
@@ -216,6 +231,7 @@
<select id="queryContractsCount" parameterType="Map" resultType="Map">
select count(1) count
from contract t
+ 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}
@@ -253,8 +269,17 @@
<if test="partyB !=null and partyB != ''">
and t.party_b= #{partyB}
</if>
+ <if test="partyBLike !=null and partyBLike != ''">
+ and t.party_b like concat('%',#{partyBLike},'%')
+ </if>
<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}
@@ -268,11 +293,19 @@
<if test="contractNameLike !=null and contractNameLike != ''">
and t.contract_name like concat('%',#{contractNameLike},'%')
</if>
- <if test="startTime !=null ">
+
+
+ <if test="startTime !=null">
and t.start_time= #{startTime}
</if>
<if test="endTime !=null ">
and t.end_time <= #{endTime}
+ </if>
+ <if test="queryStartTime !=null">
+ and t.create_time > #{queryStartTime}
+ </if>
+ <if test="queryEndTime !=null">
+ and t.create_time < #{queryEndTime}
</if>
<if test="state !=null and state != ''">
and t.state= #{state}
@@ -286,6 +319,9 @@
<if test="contractCode !=null and contractCode != ''">
and t.contract_code= #{contractCode}
</if>
+ <if test="contractCodeLike !=null and contractCodeLike != ''">
+ and t.contract_code like concat('%',#{contractCodeLike},'%')
+ </if>
<if test="objType !=null and objType != ''">
and t.obj_type= #{objType}
</if>
@@ -295,7 +331,9 @@
<if test="contractParentId !=null and contractParentId != ''">
and t.contract_parent_id= #{contractParentId}
</if>
-
+ <if test="parentContractCodeLike !=null and parentContractCodeLike != ''">
+ and tt.contract_code like concat('%',#{parentContractCodeLike},'%')
+ </if>
</select>
--
Gitblit v1.8.0