lin
2024-03-14 c4e2c196aad8af656d94bc47e9f1a80bc504b5d7
src/main/java/org/springblade/modules/place/mapper/PlacePractitionerMapper.xml
@@ -4,7 +4,120 @@
    <!--自定义分页查询-->
    <select id="selectPlacePractitionerPage" resultType="org.springblade.modules.place.vo.PlacePractitionerVO">
        select * from jczz_place_practitioner where 1=1
        SELECT
        *
        FROM
        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="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>
            <if test="placePractitioner.telephone != null  and placePractitioner.telephone != ''">and jpp.telephone =
                #{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.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.registeredAddress != null  and placePractitioner.registeredAddress != ''">and
                jpp.registered_address = #{placePractitioner.registeredAddress}
            </if>
            <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 =
                #{placePractitioner.employerImg}
            </if>
            <if test="placePractitioner.wxAccount != null  and placePractitioner.wxAccount != ''">and jpp.wx_account =
                #{placePractitioner.wxAccount}
            </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 (YEAR(CURDATE()) - YEAR(jpp.birthday)) &lt; 18
            </if>
            <if test="placePractitioner.type == 2">
                and jpp.ethnicity != 1
            </if>
            <if test="placePractitioner.type == 3">
                and (CURDATE() &lt; DATE_ADD( birthday, INTERVAL 18 YEAR ) or ( jpp.ethnicity != 1))
                and jc.category_no in (180202,180201)
            </if>
            and jpp.is_deleted = 0
        </where>
    </select>
    <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="employer" column="employer"/>
        <result property="registeredAddress" column="registered_address"/>
        <result property="jobNature" column="job_nature"/>
        <result property="employerImg" column="employer_img"/>
        <result property="wxAccount" column="wx_account"/>
        <result property="createTime" column="create_time"/>
    </resultMap>
    <sql id="selectJczzPlacePractitioner">
        select id,
               place_id,
               name,
               telephone,
               temp_address,
               age,
               gender,
               id_card,
               card_type,
               employer,
               registered_address,
               job_nature,
               employer_img,
               wx_account,
               create_time,
               birthday,
               ethnicity
        from jczz_place_practitioner
    </sql>
    <select id="selectPlaceCountByType" parameterType="long" resultType="integer">
        select
        count(1)
        from
        jczz_place_practitioner
        <where>
            <if test="type == 1">
                and CURDATE() &lt; DATE_ADD( birthday, INTERVAL 18 YEAR )
            </if>
            <if test="type == 2">
                and ethnicity != 1
            </if>
            and is_deleted = 0
        </where>
    </select>