Explorar el Código

#商机列表查询优化

sunhuijun hace 1 mes
padre
commit
bbcad41e8b

+ 3 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/OpportunityQueryParam.java

@@ -9,7 +9,9 @@ public class OpportunityQueryParam {
     private String opportunityName;
     private String opportunityCode;
     private Long naturalCustomerId;
+    private String naturalCustomerName;
     private String opportunityStage;
+    private String opportunityUnit;
     private String supportPerson;
     private String supportUnit;
     private Date signTimeStart;
@@ -17,4 +19,5 @@ public class OpportunityQueryParam {
     private Date establishTimeStart;
     private Date establishTimeEnd;
     private String keyword;
+    private String projectCode;
 }

+ 21 - 12
src/main/resources/mapper/omni/OpportunityMapper.xml

@@ -85,36 +85,45 @@
     <select id="selectPageByCondition" resultMap="OpportunityResult"
             parameterType="cn.chinaunicom.omniFlowNetCompute.pojo.OpportunityQueryParam">
         SELECT
-        *
-        FROM opportunity
+        o.*
+        FROM opportunity o left join freemarket m on
+        o.id = m.opportunity_id
         <where>
             <if test="opportunityName != null and opportunityName != ''">
-                AND opportunity_name LIKE CONCAT('%', #{opportunityName}, '%')
+                AND o.opportunity_name LIKE CONCAT('%', #{opportunityName}, '%')
             </if>
             <if test="opportunityCode != null and opportunityCode != ''">
-                AND opportunity_code LIKE CONCAT('%', #{opportunityCode}, '%')
+                AND o.opportunity_code LIKE CONCAT('%', #{opportunityCode}, '%')
             </if>
             <if test="naturalCustomerId != null">
-                AND natural_customer_id = #{naturalCustomerId}
+                AND o.natural_customer_id = #{naturalCustomerId}
+            </if>
+            <if test="naturalCustomerName != null">
+                AND (o.natural_customer_id LIKE CONCAT('%', #{naturalCustomerName}, '%') or o.natural_customer_name LIKE CONCAT('%', #{naturalCustomerName}, '%'))
             </if>
             <if test="opportunityStage != null and opportunityStage != ''">
-                AND opportunity_stage = #{opportunityStage}
+                AND o.opportunity_stage = #{opportunityStage}
+            </if>
+            <if test="opportunityUnit != null and opportunityUnit != ''">
+                AND o.opportunity_unit LIKE CONCAT('%', #{opportunityUnit}, '%')
             </if>
             <if test="supportPerson != null and supportPerson != ''">
-                AND support_person LIKE CONCAT('%', #{supportPerson}, '%')
+                AND o.support_person LIKE CONCAT('%', #{supportPerson}, '%')
             </if>
             <if test="supportUnit != null and supportUnit != ''">
-                AND support_unit = #{supportUnit}
+                AND o.support_unit = #{supportUnit}
             </if>
             <if test="signTimeStart != null or signTimeEnd != null">
-                AND estimated_sign_date BETWEEN #{signTimeStart} AND #{signTimeEnd}
+                AND o.estimated_sign_date BETWEEN #{signTimeStart} AND #{signTimeEnd}
             </if>
             <if test="establishTimeStart != null or establishTimeEnd != null">
-                AND establish_time BETWEEN #{establishTimeStart} AND #{establishTimeEnd}
+                AND o.establish_time BETWEEN #{establishTimeStart} AND #{establishTimeEnd}
             </if>
             <if test="keyword != null and keyword != ''">
-                AND (opportunity_name LIKE CONCAT('%', #{keyword}, '%') OR opportunity_code LIKE CONCAT('%', #{keyword}, '%'))
-               
+                AND (o.opportunity_name LIKE CONCAT('%', #{keyword}, '%') OR o.opportunity_code LIKE CONCAT('%', #{keyword}, '%'))
+            </if>
+            <if test="projectCode != null and projectCode != ''">
+                AND m.project_code LIKE CONCAT('%', #{projectCode}, '%')
             </if>
             
         </where>