<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.cl.mapper.DataMapper">
|
|
|
<select id="screen" 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 del_flag = 0
|
AND create_time < #{createTime}
|
<if test="county!=null and county !=0">
|
and county=#{county}
|
</if>
|
)
|
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>
|
<select id="pageList" resultType="com.cl.pojo.vo.DataVO">
|
SELECT
|
d.id,
|
d.county,
|
d.investigate_time,
|
d.create_time,
|
creator.name AS createName,
|
d.update_time,
|
updater.name AS updateName
|
FROM
|
t_data d
|
LEFT JOIN
|
t_user creator ON d.create_by = creator.id
|
LEFT JOIN
|
t_user updater ON d.update_by = updater.id
|
WHERE
|
d.del_flag=0
|
<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},'%')
|
</if>
|
order by d.create_time desc
|
</select>
|
<select id="beforeOne" resultType="com.cl.pojo.entity.DataEntity">
|
|
SELECT *
|
FROM t_data
|
WHERE del_flag = 0
|
AND county = (SELECT county FROM t_data WHERE id = #{id} AND del_flag = 0)
|
AND create_time < (SELECT create_time FROM t_data WHERE id = #{id} AND del_flag = 0)
|
ORDER BY create_time DESC
|
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
|
del_flag = 0
|
<if test="county!=null and county!=0">
|
and county=#{county}
|
</if>
|
|
)
|
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>
|
<select id="getYearList" resultType="java.lang.Integer">
|
SELECT
|
DISTINCT YEAR(create_time) AS year
|
FROM
|
t_data
|
where
|
del_flag=0
|
<if test="county!=null and county!=0">
|
and county=#{county}
|
</if>
|
ORDER BY
|
year ASC;
|
</select>
|
<select id="getAssistiveDeviceTotal" resultType="java.lang.Integer">
|
WITH latest_records AS (
|
SELECT
|
assistive_device_total,
|
ROW_NUMBER() OVER (PARTITION BY county ORDER BY create_time DESC) AS rn
|
FROM t_data
|
WHERE
|
del_flag = 0
|
AND create_time < #{createTime}
|
<if test="county != null and county != 0">
|
AND county = #{county}
|
</if>
|
)
|
SELECT
|
COALESCE(SUM(assistive_device_total), 0) AS total_sum
|
FROM latest_records
|
WHERE rn = 1
|
</select>
|
</mapper>
|