From 70a29ae28b85643e00a4b7fbf111a95646a24dc2 Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Wed, 20 Mar 2024 17:20:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/org/springblade/modules/place/mapper/PlacePractitionerMapper.xml |  133 ++++++++++++++++++++++----------------------
 1 files changed, 67 insertions(+), 66 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 927abd8..afb67cc 100644
--- a/src/main/java/org/springblade/modules/place/mapper/PlacePractitionerMapper.xml
+++ b/src/main/java/org/springblade/modules/place/mapper/PlacePractitionerMapper.xml
@@ -10,20 +10,19 @@
         jpp.name,
         jpp.telephone,
         jpp.temp_address,
-        TRUNCATE( DATEDIFF( CURDATE(), jpp.birthday )/ 365.2422,0 ) age,
+        TIMESTAMPDIFF(year, substring(jpp.id_card, 7, 8), now()) as age,
         jpp.gender,
         jpp.id_card,
-        jpp.card_type,
         jp.place_name employer,
         jpp.employer_img,
         jpp.create_time,
-        jpp.birthday,
         jpp.ethnicity,
         jpp.is_deleted,
         jpp.criminal_record_flag,
         jpp.fake_id_card,
         jpp.employment_time,
         jpp.resignation_time,
+        jpp.resignation_flag,
         jc.category_name
         FROM
         jczz_place_practitioner jpp
@@ -50,19 +49,8 @@
             <if test="placePractitioner.idCard != null  and placePractitioner.idCard != ''">and jpp.id_card =
                 #{placePractitioner.idCard}
             </if>
-            <if test="placePractitioner.cardType != null  and placePractitioner.cardType != ''">and jpp.card_type =
-                #{placePractitioner.cardType}
-            </if>
-            <if test="placePractitioner.employer != null  and placePractitioner.employer != ''">and jpp.employer =
-                #{placePractitioner.employer}
-            </if>
-
-            <if test="placePractitioner.resignation != null  and placePractitioner.resignation == 1">
-                and jpp.resignation_time is  null
-            </if>
-
-            <if test="placePractitioner.resignation != null  and placePractitioner.resignation == 2">
-                and jpp.resignation_time is not null
+            <if test="placePractitioner.resignationFlag != null  and placePractitioner.resignationFlag !='' ">
+                and jpp.resignation_flag = #{placePractitioner.resignationFlag}
             </if>
 
             <if test="placePractitioner.employerImg != null  and placePractitioner.employerImg != ''">and
@@ -71,11 +59,10 @@
             </if>
 
             <if test="placePractitioner.createTime != null ">and jpp.create_time = #{placePractitioner.createTime}</if>
-            <if test="placePractitioner.birthday != null ">and jpp.birthday = #{placePractitioner.birthday}</if>
             <if test="placePractitioner.ethnicity != null ">and jpp.ethnicity = #{placePractitioner.ethnicity}</if>
 
             <if test="placePractitioner.type == 1">
-                and (CURDATE() &lt; DATE_ADD( jpp.birthday, INTERVAL 18 YEAR )
+                and TIMESTAMPDIFF(year, substring(jpp.id_card, 7, 8), now()) &lt; 18
                 and jc.category_no in (180202,180201)
             </if>
             <if test="placePractitioner.type == 2">
@@ -83,7 +70,7 @@
                 and jc.category_no in (180202,180201)
             </if>
             <if test="placePractitioner.type == 3">
-                and (CURDATE() &lt; DATE_ADD( jpp.birthday, INTERVAL 18 YEAR ) or ( jpp.ethnicity != 1))
+                and (TIMESTAMPDIFF(year, substring(jpp.id_card, 7, 8), now()) &lt; 18  or jpp.ethnicity != 1)
                 and jc.category_no in (180202,180201)
             </if>
             and jpp.is_deleted = 0
@@ -93,52 +80,46 @@
 
 
     <resultMap type="org.springblade.modules.place.dto.PlacePractitionerDTO" id="JczzPlacePractitionerDTOResult">
-        <result property="id"    column="id"    />
-        <result property="placeId"    column="place_id"    />
-        <result property="name"    column="name"    />
-        <result property="telephone"    column="telephone"    />
-        <result property="tempAddress"    column="temp_address"    />
-        <result property="age"    column="age"    />
-        <result property="gender"    column="gender"    />
-        <result property="idCard"    column="id_card"    />
-        <result property="cardType"    column="card_type"    />
-        <result property="jobNature"    column="job_nature"    />
-        <result property="employerImg"    column="employer_img"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="birthday"    column="birthday"    />
-        <result property="ethnicity"    column="ethnicity"    />
-        <result property="isDeleted"    column="is_deleted"    />
-        <result property="criminalRecordFlag"    column="criminal_record_flag"    />
-        <result property="fakeIdCard"    column="fake_id_card"    />
-        <result property="anoTypeName"    column="ano_type_name"    />
-        <result property="employmentTime"    column="employment_time"    />
-        <result property="resignationTime"    column="resignation_time"    />
+        <result property="id" column="id"/>
+        <result property="placeId" column="place_id"/>
+        <result property="name" column="name"/>
+        <result property="telephone" column="telephone"/>
+        <result property="tempAddress" column="temp_address"/>
+        <result property="age" column="age"/>
+        <result property="gender" column="gender"/>
+        <result property="idCard" column="id_card"/>
+        <result property="jobNature" column="job_nature"/>
+        <result property="employerImg" column="employer_img"/>
+        <result property="createTime" column="create_time"/>
+        <result property="ethnicity" column="ethnicity"/>
+        <result property="isDeleted" column="is_deleted"/>
+        <result property="criminalRecordFlag" column="criminal_record_flag"/>
+        <result property="fakeIdCard" column="fake_id_card"/>
+        <result property="anoTypeName" column="ano_type_name"/>
+        <result property="employmentTime" column="employment_time"/>
+        <result property="resignationTime" column="resignation_time"/>
     </resultMap>
 
     <sql id="selectJczzPlacePractitioner">
-        select
-            id,
-            place_id,
-            name,
-            telephone,
-            temp_address,
-            age,
-            gender,
-            id_card,
-            card_type,
-            job_nature,
-            employer_img,
-            create_time,
-            birthday,
-            ethnicity,
-            is_deleted,
-            criminal_record_flag,
-            fake_id_card,
-            ano_type_name,
-            employment_time,
-            resignation_time
-        from
-            jczz_place_practitioner
+        select id,
+               place_id,
+               name,
+               telephone,
+               temp_address,
+               age,
+               gender,
+               id_card,
+               job_nature,
+               employer_img,
+               create_time,
+               ethnicity,
+               is_deleted,
+               criminal_record_flag,
+               fake_id_card,
+               ano_type_name,
+               employment_time,
+               resignation_time
+        from jczz_place_practitioner
     </sql>
 
     <select id="selectPlaceCountByType" parameterType="long" resultType="integer">
@@ -150,16 +131,36 @@
         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( jpp.birthday, INTERVAL 18 YEAR ) or ( jpp.ethnicity != 1))
+            <if test="placePractitioner.type == 1">
+                and TIMESTAMPDIFF(year, substring(jpp.id_card, 7, 8), now()) &lt; 18
                 and jc.category_no in (180202,180201)
             </if>
-            <if test="type == 2">
+            <if test="placePractitioner.type == 2">
                 and jpp.ethnicity != 1
                 and jc.category_no in (180202,180201)
             </if>
+            <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 like concat('%',
+                #{placePractitioner.name},'%')
+            </if>
+            <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 =
+                #{placePractitioner.tempAddress}
+            </if>
+            <if test="placePractitioner.age != null ">and jpp.age = #{placePractitioner.age}</if>
+            <if test="placePractitioner.gender != null ">and jpp.gender = #{placePractitioner.gender}</if>
+            <if test="placePractitioner.idCard != null  and placePractitioner.idCard != ''">and jpp.id_card =
+                #{placePractitioner.idCard}
+            </if>
+            <if test="placePractitioner.resignationFlag != null  and placePractitioner.resignationFlag !='' ">
+                and jpp.resignation_flag = #{placePractitioner.resignationFlag}
+            </if>
             and jpp.is_deleted = 0
-            and jpp.resignation_time is  null
         </where>
     </select>
 

--
Gitblit v1.9.3