用户采集数据考核

This commit is contained in:
2025-08-04 16:11:54 +08:00
parent 7514482e33
commit 55ac707a8c
17 changed files with 728 additions and 41 deletions

View File

@ -90,7 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ELSE xm -- 可选:处理 rysfzs 不是 0 或 1 的情况
END AS xm,xh, xb,bj, zy,xy,sydsh, sydshi, bynf, zgyl, gzdw, dwxz, dwdz, zwjb, shjz, dbry, rysfzs,sj, yx, qt, sfqr from cj_student
<where>
dbry is not null and dbry != '' and dbry != '无'
dbry is not null and dbry != '' and dbry != '无' and dbry != '暂无'
</where>
</select>

View File

@ -0,0 +1,30 @@
<?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.ruoyi.dw.mapper.DataCheckMapper">
<resultMap type="DataCheckStatus" id="dataCheckStatus">
<result property="id" column="id" />
<result property="checkStatus" column="check_status" />
<result property="beginDate" column="begin_date" />
<result property="endDate" column="end_date" />
</resultMap>
<select id="getStatus" resultMap="dataCheckStatus">
select id,check_status,begin_date,end_date from data_check_status where id = 1
</select>
<update id="startCheck" parameterType="date">
update data_check_status set check_status = 1,begin_date = #{checkDate},end_date = null
</update>
<update id="endCheck" parameterType="date">
update data_check_status set check_status = 2,end_date = #{checkDate}
</update>
<update id="updateCheck" parameterType="date">
update data_check_status set begin_date = #{startCheckDate},end_date = #{endCheckDate}
</update>
</mapper>

View File

@ -104,32 +104,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBynf" resultMap="bynfVo" parameterType="int">
select bynf,count(0) as bynf_count
from cj_student
where sfqr = 1
where sfqr = 1 and bynf is not null
and cast(bynf as unsigned)
between YEAR(CURRENT_DATE) - #{year} and YEAR(CURRENT_DATE)
group by bynf order by bynf desc
</select>
<select id="selectSyd" resultMap="sydVo" parameterType="int">
SELECT
select sc.city_name as city,ifnull(rc.student_count, 0) as student_count from sd_citys sc left join (SELECT
CASE
WHEN sydsh = '山东' THEN sydshi
ELSE '省外'
END AS city,
COUNT(*) AS student_count
FROM cj_student
where sfqr = 1 and sydsh is not null
where sfqr = 1 and sydsh is not null and bynf is not null
and cast(bynf as unsigned)
between YEAR(CURRENT_DATE) - #{year} and YEAR(CURRENT_DATE)
GROUP BY
CASE
WHEN sydsh = '山东' THEN sydshi
ELSE '省外'
END
END) as rc on sc.city_name = rc.city order by sc.id asc
</select>
<select id="selectDwxz" resultMap="dwxzVo">
select dwxz,count(0) as dwxz_count from cj_student where sfqr = 1 and dwxz is not null group by dwxz
SELECT
dz.dwxz,
ifnull( dw.dwxz_count, 0 ) AS dwxz_count
FROM
dwxz dz
LEFT JOIN ( SELECT dwxz, count( 0 ) AS dwxz_count FROM cj_student WHERE sfqr = 1 AND dwxz IS NOT NULL GROUP BY dwxz ) AS dw ON dz.dwxz = dw.dwxz
ORDER BY
dz.id ASC
</select>
</mapper>

View File

@ -9,6 +9,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="dwCount" column="dw_count" />
</resultMap>
<resultMap type="XyDataCheck" id="xyDataCheck">
<result property="xy" column="xy" />
<result property="dataCount" column="data_count" />
</resultMap>
<select id="selectXyCheckDw" resultMap="xyCheckDw">
SELECT
re.xy,re.order_index,
@ -20,10 +26,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL( dw.dw_count, 0 ) AS dw_count
FROM
xy_zy xz
LEFT JOIN ( SELECT answer, count( 0 ) AS dw_count FROM dw_answer WHERE question_id IN ( 3, 43, 71 ) GROUP BY answer ) AS dw ON dw.answer = xz.zy
LEFT JOIN ( SELECT answer, count( 0 ) AS dw_count FROM dw_answer
WHERE question_id IN ( 3, 43, 71 )
<if test="startDate != null"> and create_time &gt;= #{startDate}</if>
<if test="endDate != null"> and create_time &lt;= #{endDate} </if>
GROUP BY answer ) AS dw ON dw.answer = xz.zy
) AS re
GROUP BY re.xy,re.order_index
order by re.order_index
</select>
<select id="selectAllCount" resultMap="xyDataCheck">
SELECT
x.xy,
IFNULL( re.data_count, 0 ) AS data_count
FROM
xy x
LEFT JOIN ( SELECT xy, count( 0 ) AS data_count FROM cj_student WHERE sfqr = 1 GROUP BY xy ) AS re ON x.xy = re.xy
ORDER BY
x.id ASC
</select>
<select id="selectGxCount" resultMap="xyDataCheck">
SELECT
x.xy,
IFNULL( re.data_count, 0 ) AS data_count
FROM
xy x
LEFT JOIN ( SELECT xy, count( 0 ) AS data_count FROM cj_student
WHERE sfqr = 1
<if test="startDate != null"> and update_time &gt; #{startDate}</if>
<if test="endDate != null"> and update_time &lt; #{endDate} </if> GROUP BY xy ) AS re ON x.xy = re.xy
ORDER BY x.id ASC
</select>
<select id="selectYxCount" resultMap="xyDataCheck">
SELECT
x.xy,
IFNULL( re.data_count, 0 ) AS data_count
FROM
xy x
LEFT JOIN ( SELECT xy, count( 0 ) AS data_count FROM cj_student
WHERE sfqr = 1
<if test="startDate != null"> and update_time &gt; #{startDate}</if>
<if test="endDate != null"> and update_time &lt; #{endDate} </if>
and sydshi is not null and dwxz in (SELECT dwxz from dwxz) and xy in (SELECT xy from xy) and bynf is not null
GROUP BY xy ) AS re ON x.xy = re.xy
ORDER BY x.id ASC
</select>
</mapper>