huliguo
2025-05-06 03e22f45b1b06b68a3ba8b9390e9a5f1ddda752a
src/main/resources/mapper/DataMapper.xml
@@ -92,6 +92,7 @@
    </select>
    <select id="pageList" resultType="com.cl.pojo.vo.DataVO">
        SELECT
            d.id,
            d.county,
            d.investigate_time,
            d.create_time,
@@ -106,8 +107,11 @@
            t_user updater ON d.update_by = updater.id
        WHERE
            d.del_flag=0
        <if test="county != null and county != 0">
            and d.county =#{county}
        <if test="countyList != null and countyList.size() > 0">
            AND d.county IN
            <foreach collection="countyList" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="name!=null and ''!=name">
            and creator.name like concat('%',#{name},'%')
@@ -124,4 +128,94 @@
        LIMIT 1;
    </select>
    <select id="selectByCounty" resultType="com.cl.pojo.entity.DataEntity">
    </select>
    <select id="getAddDetail" resultType="com.cl.pojo.entity.DataEntity">
        WITH latest_records AS (
            SELECT
                *,
                ROW_NUMBER() OVER (PARTITION BY county ORDER BY create_time DESC) AS rn
            FROM t_data
            WHERE county=#{county} or #{county}=0 AND del_flag = 0
        )
        SELECT
            create_time,
            sum(certificate_eyesight) AS certificate_eyesight,
            sum(certificate_intellect) AS certificate_intellect ,
            sum(certificate_limb) AS certificate_limb ,
            sum(certificate_speech) AS certificate_speech,
            sum(certificate_hearing) AS certificate_hearing,
            sum(certificate_spirit) AS certificate_spirit,
            sum(certificate_multiple) AS certificate_multiple,
            sum(worker_city) AS worker_city,
            sum(worker_association) AS worker_association,
            sum(worker_service_corps) AS worker_service_corps,
            sum(worker_county  ) AS worker_county,
            sum(worker_township  ) AS worker_township,
            sum(worker_village  ) AS worker_village,
            sum(drill_autism  ) AS drill_autism,
            sum(drill_intellect  ) AS drill_intellect,
            sum(drill_limb  ) AS drill_limb,
            sum(drill_speech  ) AS drill_speech,
            sum(drill_hearing  ) AS drill_hearing,
            sum(drill_spirit  ) AS drill_spirit,
            sum(salvation_before_seven  ) AS salvation_before_seven,
            sum(salvation_after_seven  ) AS salvation_after_seven,
            sum(salvation_autism  ) AS salvation_autism,
            sum(salvation_intellect  ) AS salvation_intellect,
            sum(salvation_limb  ) AS salvation_limb,
            sum(salvation_speech  ) AS salvation_speech,
            sum(difficulty_medication  ) AS difficulty_medication,
            sum(difficulty_hospitalisation  ) AS difficulty_hospitalisation,
            sum(assistive_device_total  ) AS assistive_device_total,
            sum(assistive_device_one  ) AS assistive_device_one,
            sum(assistive_device_two  ) AS assistive_device_two,
            sum(assistive_device_three  ) AS assistive_device_three,
            sum(assistive_device_other  ) AS assistive_device_other,
            sum(assistive_device_type_one  ) AS assistive_device_type_one,
            sum(assistive_device_type_two  ) AS assistive_device_type_two,
            sum(assistive_device_type_three  ) AS assistive_device_type_three,
            sum(assistive_device_type_four  ) AS assistive_device_type_four,
            sum(assistive_device_grade_one  ) AS assistive_device_grade_one ,
            sum( assistive_device_grade_two) as  assistive_device_grade_two,
            sum(assistive_device_grade_three ) as  assistive_device_grade_three,
            sum(assistive_device_grade_four ) as assistive_device_grade_four ,
            sum(technical_training ) as technical_training ,
            sum(home_allowance ) as home_allowance  ,
            sum(statutory_certificate_eyesight ) as statutory_certificate_eyesight ,
            sum(statutory_certificate_intellect ) as  statutory_certificate_intellect,
            sum(statutory_certificate_limb ) as  statutory_certificate_limb,
            sum(statutory_certificate_speech ) as statutory_certificate_speech ,
            sum(statutory_certificate_hearing ) as statutory_certificate_hearing  ,
            sum(employed_employment ) as  employed_employment,
            sum(employed_concentrated ) as employed_concentrated ,
            sum(employed_public_welfare ) as employed_public_welfare ,
            sum(employed_auxiliary ) as employed_auxiliary ,
            sum(employed_individual ) as employed_individual ,
            sum(high_school_employment ) as high_school_employment ,
            sum(high_school_individual ) as high_school_individual ,
            sum(high_school_flexible ) as  high_school_flexible,
            sum(education_one ) as  education_one,
            sum(education_two ) as education_two ,
            sum( education_three) as education_three ,
            sum(education_four ) as  education_four,
            sum(education_five ) as education_five ,
            sum(education_six ) as education_six ,
            sum(education_seven ) as education_seven ,
            sum(education_eight ) as education_eight ,
            sum(education_nine ) as education_nine ,
            sum(education_subsidy ) as education_subsidy ,
            sum(activity_frequency ) as  activity_frequency,
            sum(education_number ) as education_number,
            sum(matter) as matter,
            sum(doctor_apprecitation) as doctor_apprecitation,
            sum(remould) as remould,
            sum(interviews_office) as interviews_office,
            sum(interviews_phone) as interviews_phone ,
            sum(interviews_superior) as interviews_superior,
            sum(interviews_hotline) as interviews_hotline
        FROM latest_records
        WHERE rn = 1;
    </select>
</mapper>