Ver código fonte

保单清单查询

cuixinpeng 2 anos atrás
pai
commit
f16e2fd4e2

+ 121 - 3
src/main/resources/mapper/modules/order/InsOrdersMapper.xml

@@ -405,7 +405,7 @@
         <result property="userName" column="username" jdbcType="VARCHAR"/>
     </resultMap>
 
-    <select id="getPolicyInsuranceReport" parameterType="java.lang.String" resultMap="PolicyInsuranceReportMap">
+    <select id="getPolicyInsuranceReport"  resultMap="PolicyInsuranceReportMap">
 
         /*交强数据*/
         SELECT a.`inscompany` AS insCompany,
@@ -429,6 +429,36 @@
         b.`username` AS userName
          FROM ins_area_company a,ins_orders b WHERE  a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!=''   AND a.`agreement_id` IS NOT NULL
          AND a.`orderno`=b.`orderno`
+        <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
+            and b.deptid = #{policyReqVo.deptId}
+        </if>
+        <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
+            and b.userid = #{policyReqVo.userId}
+        </if>
+        <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
+            and b.username = #{policyReqVo.userName}
+        </if>
+        <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
+            and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
+        </if>
+        <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
+            and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
+        </if>
+        <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
+            and b.productid = #{policyReqVo.productId}
+        </if>
+        <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
+            and a.company_id = #{policyReqVo.insCompany}
+        </if>
+        <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
+            and a.operatorid = #{policyReqVo.operatorId}
+        </if>
+        <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
+            and getValidDate(a.`orderno`,a.`id`) between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
+        </if>
+        <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
+            and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
+        </if>
          UNION ALL
         /*##商业数据*/
         SELECT  a.`inscompany` AS insCompany,
@@ -452,8 +482,36 @@
         b.`username` AS userName
          FROM ins_area_company a,ins_orders b WHERE  a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!=''   AND a.`agreement_id` IS NOT NULL
          AND a.`orderno`=b.`orderno`
-
-
+        <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
+            and b.deptid = #{policyReqVo.deptId}
+        </if>
+        <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
+            and b.userid = #{policyReqVo.userId}
+        </if>
+        <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
+            and b.username = #{policyReqVo.userName}
+        </if>
+        <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
+            and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
+        </if>
+        <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
+            and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
+        </if>
+        <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
+            and b.productid = #{policyReqVo.productId}
+        </if>
+        <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
+            and a.company_id = #{policyReqVo.insCompany}
+        </if>
+        <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
+            and a.operatorid = #{policyReqVo.operatorId}
+        </if>
+        <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
+            and getValidDate(a.`orderno`,a.`id`) between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
+        </if>
+        <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
+            and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
+        </if>
     </select>
     <select id="getPolicyInsuranceReportCount" resultType="Long">
         select
@@ -481,6 +539,36 @@
         b.`username` AS userName
          FROM ins_area_company a,ins_orders b WHERE  a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!=''   AND a.`agreement_id` IS NOT NULL
          AND a.`orderno`=b.`orderno`
+        <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
+            and b.deptid = #{policyReqVo.deptId}
+        </if>
+        <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
+            and b.userid = #{policyReqVo.userId}
+        </if>
+        <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
+            and b.username = #{policyReqVo.userName}
+        </if>
+        <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
+            and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
+        </if>
+        <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
+            and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
+        </if>
+        <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
+            and b.productid = #{policyReqVo.productId}
+        </if>
+        <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
+            and a.company_id = #{policyReqVo.insCompany}
+        </if>
+        <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
+            and a.operatorid = #{policyReqVo.operatorId}
+        </if>
+        <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
+            and getValidDate(a.`orderno`,a.`id`) between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
+        </if>
+        <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
+            and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
+        </if>
          UNION ALL
         /*##商业数据*/
         SELECT  a.`inscompany` AS insCompany,
@@ -504,6 +592,36 @@
         b.`username` AS userName
          FROM ins_area_company a,ins_orders b WHERE  a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!=''   AND a.`agreement_id` IS NOT NULL
          AND a.`orderno`=b.`orderno`
+        <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
+            and b.deptid = #{policyReqVo.deptId}
+        </if>
+        <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
+            and b.userid = #{policyReqVo.userId}
+        </if>
+        <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
+            and b.username = #{policyReqVo.userName}
+        </if>
+        <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
+            and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
+        </if>
+        <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
+            and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
+        </if>
+        <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
+            and b.productid = #{policyReqVo.productId}
+        </if>
+        <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
+            and a.company_id = #{policyReqVo.insCompany}
+        </if>
+        <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
+            and a.operatorid = #{policyReqVo.operatorId}
+        </if>
+        <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
+            and getValidDate(a.`orderno`,a.`id`) between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
+        </if>
+        <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
+            and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
+        </if>
         ) as s
     </select>
 </mapper>