zhongrj
2024-03-16 aca33b1ff34ea0f2db3290d4c0b5d898f66de108
src/main/java/org/springblade/modules/place/mapper/PlacePractitionerMapper.xml
@@ -5,7 +5,27 @@
    <!--自定义分页查询-->
    <select id="selectPlacePractitionerPage" resultType="org.springblade.modules.place.vo.PlacePractitionerVO">
        SELECT
        *
        jpp.id,
        jpp.place_id,
        jpp.name,
        jpp.telephone,
        jpp.temp_address,
        TRUNCATE( DATEDIFF( CURDATE(), jpp.birthday )/ 365.2422,0 ) age,
        jpp.gender,
        jpp.id_card,
        jpp.card_type,
        jp.place_name employer,
        jpp.registered_address,
        jpp.job_nature,
        jpp.employer_img,
        jpp.wx_account,
        jpp.create_time,
        jpp.birthday,
        jpp.ethnicity,
        jpp.is_deleted,
        jpp.criminal_record_flag,
        jpp.fake_id_card,
        jc.category_name
        FROM
        jczz_place_practitioner jpp
        LEFT JOIN jczz_place jp ON jp.id = jpp.place_id
@@ -14,13 +34,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 +63,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 =
@@ -51,16 +75,19 @@
            <if test="placePractitioner.ethnicity != null ">and jpp.ethnicity = #{placePractitioner.ethnicity}</if>
            <if test="placePractitioner.type == 1">
                and (YEAR(CURDATE()) - YEAR(jpp.birthday)) &lt; 18
                and (CURDATE() &lt; DATE_ADD( jpp.birthday, INTERVAL 18 YEAR )
                and jc.category_no in (180202,180201)
            </if>
            <if test="placePractitioner.type == 2">
                and jpp.ethnicity != 1
                and jc.category_no in (180202,180201)
            </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
            order by jpp.id desc
        </where>
    </select>
@@ -108,15 +135,20 @@
        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
                and jc.category_no in (180202,180201)
            </if>
            and is_deleted = 0
            and jpp.is_deleted = 0
        </where>
    </select>