首页查询数据问题修改

This commit is contained in:
fl 2025-02-27 15:13:47 +08:00
parent a53921de80
commit f2adef8a99
3 changed files with 39 additions and 35 deletions

View File

@ -413,24 +413,23 @@
<select id="getAttDayList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
SELECT
su.user_name, so.org_name, a.*
su.user_name,
so.org_name,
v.*
FROM
sys_user su
LEFT JOIN v_att_update_data a ON a.user_id = su.user_id
LEFT JOIN att_group_person_relation agpr ON agpr.user_id = su.user_id
(select * FROM att_setting_history WHERE current_day = #{attCurrentDay}) ash
LEFT JOIN sys_user su ON ash.user_id = su.user_id
LEFT JOIN ( SELECT * FROM v_att_update_data WHERE att_current_day = #{attCurrentDay} ) v on su.user_id = v.user_id
LEFT JOIN sys_user_org org ON org.user_id = su.user_id
left join sys_organization so on so.id = org.org_id
WHERE su.is_active = 1 AND agpr.is_active = 1
<if test="attCurrentDay != null and attCurrentDay != ''">
AND att_current_day = #{attCurrentDay}
</if>
<if test="attendType == 1 || attendType == '1'">
<if test='attStatus == "1"'>
and ( toWorkAttStatus = #{attStatus} OR offWorkAttStatus = #{attStatus} )
LEFT JOIN sys_organization so ON so.id = org.org_id
<where>
<if test="attendType == 1 || attendType == '1'">
<if test='attStatus == "1"'>
and ( toWorkAttStatus = #{attStatus} OR offWorkAttStatus = #{attStatus} )
</if>
</if>
</if>
<if test="attendType == 2 || attendType == '2'">
AND su.user_id not in (
<if test="attendType == 2 || attendType == '2'">
AND su.user_id not in (
SELECT su.user_id FROM sys_user su
LEFT JOIN v_att_update_data a ON a.user_id = su.user_id
LEFT JOIN att_group_person_relation agpr ON agpr.user_id = su.user_id
@ -439,15 +438,18 @@
WHERE su.is_active = 1 AND agpr.is_active = 1
AND att_current_day = #{attCurrentDay}
and ( toWorkAttStatus = #{attStatus} OR offWorkAttStatus = #{attStatus} )
)
</if>
<if test="attStatusToday != null and attStatusToday != ''">
and ( toWorkAttStatus = #{attStatusToday} or offWorkAttStatus = #{attStatusToday} )
</if>
<if test="userName != null and userName != ''">
AND su.user_name like concat('%', #{userName}, '%')
</if>
GROUP BY agpr.user_id
)
</if>
<if test="attStatusToday != null and attStatusToday != ''">
and ( toWorkAttStatus = #{attStatusToday} or offWorkAttStatus = #{attStatusToday} )
</if>
<if test="userName != null and userName != ''">
AND su.user_name like concat('%', #{userName}, '%')
</if>
</where>
GROUP BY
ash.user_id
</select>
<select id="getAttDayReportDetailsListData" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
select su.user_name, so.org_name, v.* from v_att_update_data v

View File

@ -5,16 +5,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.bonus.system.index.dao.HomePageDao">
<select id="getTodayAttData" resultType="com.bonus.system.index.entity.IndexTodayAttBean">
select a.shouldAttNum, a.actualAttNum,(a.shouldAttNum - a.actualAttNum) as noActualAttNum, TRUNCATE(a.actualAttNum /
a.shouldAttNum * 100, 0) as attRate from (
select count(agpr.user_id ) as shouldAttNum, count(a.user_id) as actualAttNum
from sys_user su left join (
select * from v_att_update_data where att_current_day = #{date}
and (toWorkAttStatus = 1 or offWorkAttStatus = 1)
) a on a.user_id = su.user_id
LEFT JOIN att_group_person_relation agpr on agpr.user_id = su.user_id and agpr.is_active = 1
where su.is_active = 1
) a
SELECT a.shouldAttNum, a.actualAttNum,( a.shouldAttNum - a.actualAttNum ) AS noActualAttNum,
TRUNCATE ( a.actualAttNum / a.shouldAttNum * 100, 0 ) AS attRate
FROM
(
SELECT
count( ash.user_id ) AS shouldAttNum,
count( v.user_id ) AS actualAttNum
FROM
( SELECT * FROM att_setting_history WHERE current_day = #{date} ) ash
LEFT JOIN sys_user su ON ash.user_id = su.user_id
LEFT JOIN ( SELECT * FROM v_att_update_data WHERE att_current_day = #{date} AND ( toWorkAttStatus = 1 OR offWorkAttStatus = 1 ) ) v ON su.user_id = v.user_id
) a
</select>
<select id="getTodayAbnormalData" resultType="com.bonus.system.index.entity.IndexAbnormalBean">

View File

@ -2,4 +2,4 @@
2.AttSourceDataMapper.xml 中 gz_cloud_test -> gz_cloud
3.WechatPushMapper.xml 中 gz_cloud_test -> gz_cloud
4.com.bonus.system.att.utils.IpAndPathConfig 修改对应环境
5.com.bonus.system.att.tasks AttTasks 与 WechatTasks 定时器开启
5.com.bonus.system.att.tasks NewAttTask 与 WechatTasks 定时器开启