From 86d67bf56643c8cdf79cd247f7e8027c4f63c45f Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Fri, 15 Mar 2024 11:24:53 +0800
Subject: [PATCH] 从业人员统计优化

---
 src/main/java/org/springblade/modules/place/mapper/PlacePractitionerMapper.xml |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/springblade/modules/place/mapper/PlacePractitionerMapper.xml b/src/main/java/org/springblade/modules/place/mapper/PlacePractitionerMapper.xml
index c44a83d..db045ec 100644
--- a/src/main/java/org/springblade/modules/place/mapper/PlacePractitionerMapper.xml
+++ b/src/main/java/org/springblade/modules/place/mapper/PlacePractitionerMapper.xml
@@ -14,13 +14,16 @@
         <where>
             <if test="placePractitioner.id != null ">and jpp.id = #{placePractitioner.id}</if>
             <if test="placePractitioner.placeId != null ">and jpp.place_id = #{placePractitioner.placeId}</if>
-            <if test="placePractitioner.name != null  and placePractitioner.name != ''">and jpp.name =
-                #{placePractitioner.name}
+            <if test="placePractitioner.name != null  and placePractitioner.name != ''">and jpp.name like concat('%',
+                #{placePractitioner.name},'%')
+
             </if>
-            <if test="placePractitioner.telephone != null  and placePractitioner.telephone != ''">and jpp.telephone =
-                #{placePractitioner.telephone}
+            <if test="placePractitioner.telephone != null  and placePractitioner.telephone != ''">and jpp.telephone like
+                concat('%', #{placePractitioner.telephone},'%')
+
             </if>
-            <if test="placePractitioner.tempAddress != null  and placePractitioner.tempAddress != ''">and jpp.temp_address =
+            <if test="placePractitioner.tempAddress != null  and placePractitioner.tempAddress != ''">and
+                jpp.temp_address =
                 #{placePractitioner.tempAddress}
             </if>
             <if test="placePractitioner.age != null ">and jpp.age = #{placePractitioner.age}</if>
@@ -40,7 +43,8 @@
             <if test="placePractitioner.jobNature != null  and placePractitioner.jobNature != ''">and jpp.job_nature =
                 #{placePractitioner.jobNature}
             </if>
-            <if test="placePractitioner.employerImg != null  and placePractitioner.employerImg != ''">and jpp.employer_img =
+            <if test="placePractitioner.employerImg != null  and placePractitioner.employerImg != ''">and
+                jpp.employer_img =
                 #{placePractitioner.employerImg}
             </if>
             <if test="placePractitioner.wxAccount != null  and placePractitioner.wxAccount != ''">and jpp.wx_account =
@@ -57,7 +61,7 @@
                 and jpp.ethnicity != 1
             </if>
             <if test="placePractitioner.type == 3">
-                and (CURDATE() &lt; DATE_ADD( birthday, INTERVAL 18 YEAR ) or ( jpp.ethnicity != 1))
+                and (CURDATE() &lt; DATE_ADD( jpp.birthday, INTERVAL 18 YEAR ) or ( jpp.ethnicity != 1))
                 and jc.category_no in (180202,180201)
             </if>
             and jpp.is_deleted = 0
@@ -108,15 +112,19 @@
         select
         count(1)
         from
-        jczz_place_practitioner
+        jczz_place_practitioner jpp
+        LEFT JOIN jczz_place jp ON jp.id = jpp.place_id
+        LEFT JOIN jczz_place_poi_label jppl on jppl.place_id = jp.id and type = 3
+        LEFT JOIN jczz_category jc on jc.category_no = jppl.poi_code
         <where>
             <if test="type == 1">
-                and CURDATE() &lt; DATE_ADD( birthday, INTERVAL 18 YEAR )
+                and (CURDATE() &lt; DATE_ADD( jpp.birthday, INTERVAL 18 YEAR ) or ( jpp.ethnicity != 1))
+                and jc.category_no in (180202,180201)
             </if>
             <if test="type == 2">
-                and ethnicity != 1
+                and jpp.ethnicity != 1
             </if>
-            and is_deleted = 0
+            and jpp.is_deleted = 0
         </where>
     </select>
 

--
Gitblit v1.9.3