数据看板

Signed-off-by: lSun <15893999301@qq.com>
This commit is contained in:
lSun 2024-12-18 21:31:00 +08:00
parent 588098c00a
commit e7a4871b18
2 changed files with 240 additions and 241 deletions

View File

@ -107,6 +107,9 @@ public class AttDetailBean {
*/ */
private String endDate; private String endDate;
//所属月份
private String attCurrentMonth;
public void setParams(Map<String, Object> params) public void setParams(Map<String, Object> params)
{ {
this.params = params; this.params = params;

View File

@ -1,257 +1,253 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.system.att.dao.AttDetailByMonthDao"> <mapper namespace="com.bonus.system.att.dao.AttDetailByMonthDao">
<select id="getAllParentId" resultType="com.bonus.system.att.entity.AttDetailByMonthBean"> <select id="getAllParentId" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select select id as orgId
id as orgId from sys_organization so
from sys_organization so where so.is_active = 1
where so.is_active = 1 and so.parent_id is null
and so.parent_id is null </select>
</select>
<select id="selectAttDetailList" resultType="com.bonus.system.att.entity.AttDetailByMonthBean"> <select id="selectAttDetailList" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select select
user_id as userId, user_id as userId,
name as name, name as name,
org_id as orgId, org_id as orgId,
org_name as orgName, org_name as orgName,
att_current_month as attCurrentMonth, att_current_month as attCurrentMonth,
coalesce(required_days,0) as requiredDays, coalesce(required_days,0) as requiredDays,
coalesce(normal_num,0) as normalNum, coalesce(normal_num,0) as normalNum,
coalesce(late_num,0) as lateNum, coalesce(late_num,0) as lateNum,
coalesce(early_num,0) as earlyNum, coalesce(early_num,0) as earlyNum,
coalesce(skipping_num,0) as skippingNum, coalesce(skipping_num,0) as skippingNum,
coalesce(leave_num,0) as leaveNum, coalesce(leave_num,0) as leaveNum,
coalesce(address_error_num,0) as addressErrorNum, coalesce(address_error_num,0) as addressErrorNum,
coalesce(ein_error_num,0) as einErrorNum coalesce(ein_error_num,0) as einErrorNum
from att_month_report amr from att_month_report amr
where amr.is_active = 1 where amr.is_active = 1
and amr.required_days != amr.normal_num and amr.required_days != amr.normal_num
<if test="attCurrentMonth != null and attCurrentMonth != '' "> <if test="attCurrentMonth != null and attCurrentMonth != '' ">
and amr.att_current_month = #{attCurrentMonth} and amr.att_current_month = #{attCurrentMonth}
</if> </if>
<if test="name != null and name != '' "> <if test="name != null and name != '' ">
and INSTR(amr.name,#{name}) > 0 and INSTR(amr.name,#{name}) > 0
</if> </if>
<if test="orgId != null and orgId != ''"> <if test="orgId != null and orgId != ''">
AND amr.org_id = #{orgId} AND amr.org_id = #{orgId}
</if> </if>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
AND amr.name like concat('%', #{name}, '%') AND amr.name like concat('%', #{name}, '%')
</if> </if>
group by user_id group by user_id
</select> </select>
<select id="selectAttAllList" resultType="com.bonus.system.att.entity.AttDetailByMonthBean"> <select id="selectAttAllList" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select select
user_id as userId,
name as name,
org_id as orgId,
org_name as orgName,
att_current_month as attCurrentMonth,
count(awa.user_id) as outCount,
coalesce(required_days,0) as requiredDays,
coalesce(normal_num,0) as normalNum,
coalesce(late_num,0) as lateNum,
coalesce(early_num,0) as earlyNum,
coalesce(skipping_num,0) as skippingNum,
coalesce(leave_num,0) as leaveNum,
coalesce(address_error_num,0) as addressErrorNum,
coalesce(ein_error_num,0) as einErrorNum
from att_month_report amr
LEFT JOIN att_work_abnormal awa ON LOCATE(amr.att_current_month,awa.att_current_day) and awa.user_id = amr.user_id
where amr.is_active = 1
and amr.required_days != amr.normal_num
<if test="attCurrentMonth != null and attCurrentMonth != '' ">
and amr.att_current_month = #{attCurrentMonth}
</if>
<if test="orgId != null and orgId != '' ">
and amr.org_id = #{orgId}
</if>
<if test="name != null and name != '' ">
and INSTR(amr.name,#{name}) > 0
</if>
GROUP BY amr.att_current_month,amr.user_id
</select>
<select id="getOrgParentId" resultType="com.bonus.system.basic.domain.SysOrg">
select
id as id,
org_name as orgName,
parent_id as parentId
from sys_organization so
where so.is_active = 1
and so.id = #{orgId}
</select>
<select id="selectAttParentId" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select
amr.id as id,
amr.user_id as userId, amr.user_id as userId,
amr.name as name, name as name,
amr.org_id as orgId, amr.org_id as orgId,
amr.org_name as orgName, amr.org_name as orgName,
amr.att_current_month as attCurrentMonth, att_current_month as attCurrentMonth,
coalesce(required_days,0) as requiredDays, count(awa.user_id) as outCount,
coalesce(normal_num,0) as normalNum, coalesce(required_days,0) as requiredDays,
coalesce(late_num,0) as lateNum, coalesce(normal_num,0) as normalNum,
coalesce(early_num,0) as earlyNum, coalesce(late_num,0) as lateNum,
coalesce(skipping_num,0) as skippingNum, coalesce(early_num,0) as earlyNum,
coalesce(leave_num,0) as leaveNum, coalesce(skipping_num,0) as skippingNum,
coalesce(address_error_num,0) as addressErrorNum, coalesce(leave_num,0) as leaveNum,
coalesce(ein_error_num,0) as einErrorNum coalesce(address_error_num,0) as addressErrorNum,
from att_month_report amr coalesce(ein_error_num,0) as einErrorNum
left join sys_organization so on amr.org_id = so.id and so.is_active = 1 from att_month_report amr
where amr.is_active = 1 LEFT JOIN att_work_abnormal awa ON LOCATE(amr.att_current_month,awa.att_current_day) and awa.user_id =
and amr.required_days != amr.normal_num amr.user_id
and so.parent_id = 2 where amr.is_active = 1
<if test="attCurrentMonth != null and attCurrentMonth != '' "> and amr.required_days != amr.normal_num
and amr.att_current_month = #{attCurrentMonth} <if test="attCurrentMonth != null and attCurrentMonth != '' ">
</if> and amr.att_current_month = #{attCurrentMonth}
<if test="name != null and name != '' "> </if>
and INSTR(amr.name,#{name}) > 0 <if test="orgId != null and orgId != '' ">
</if> and amr.org_id = #{orgId}
group by user_id </if>
</select> <if test="name != null and name != '' ">
and INSTR(amr.name,#{name}) > 0
</if>
GROUP BY amr.att_current_month,amr.user_id
</select>
<select id="selectAttSonsId" resultType="com.bonus.system.att.entity.AttDetailByMonthBean"> <select id="getOrgParentId" resultType="com.bonus.system.basic.domain.SysOrg">
select select id as id,
amr.id as id, org_name as orgName,
amr.user_id as userId, parent_id as parentId
amr.name as name, from sys_organization so
amr.org_id as orgId, where so.is_active = 1
amr.org_name as orgName, and so.id = #{orgId}
amr.att_current_month as attCurrentMonth, </select>
coalesce(required_days,0) as requiredDays,
coalesce(normal_num,0) as normalNum,
coalesce(late_num,0) as lateNum,
coalesce(early_num,0) as earlyNum,
coalesce(skipping_num,0) as skippingNum,
coalesce(leave_num,0) as leaveNum,
coalesce(address_error_num,0) as addressErrorNum,
coalesce(ein_error_num,0) as einErrorNum
from att_month_report amr
left join sys_organization so on amr.org_id = so.id and so.is_active = 1
where amr.is_active = 1
and amr.required_days != amr.normal_num
<if test="attCurrentMonth != null and attCurrentMonth != '' ">
and amr.att_current_month = #{attCurrentMonth}
</if>
<if test="name != null and name != '' ">
and INSTR(amr.name,#{name}) > 0
</if>
group by user_id
</select>
<select id="getDetailList" resultType="com.bonus.system.att.entity.AttDetailBean"> <select id="selectAttParentId" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select select
vat.user_id as userId, amr.id as id,
su.user_name as name, amr.user_id as userId,
vat.org_id as orgId, amr.name as name,
so.org_name as orgName, amr.org_id as orgId,
vat.toWorkAttCurrentTime as goWorkTime , amr.org_name as orgName,
vat.toWorkAttStatus as goWorkStatus, amr.att_current_month as attCurrentMonth,
vat.toWorkAttAddress as goWorkAddress, coalesce(required_days,0) as requiredDays,
vat.offWorkAttCurrentTime as offWorkTime, coalesce(normal_num,0) as normalNum,
vat.offWorkAttStatus as offWorkStatus, coalesce(late_num,0) as lateNum,
vat.offWorkAttAddress as offWorkAddress, coalesce(early_num,0) as earlyNum,
vat.att_current_day as attCurrent coalesce(skipping_num,0) as skippingNum,
from v_att_update_data vat coalesce(leave_num,0) as leaveNum,
left join sys_user su on vat.user_id = su.user_id and su.is_active = 1 coalesce(address_error_num,0) as addressErrorNum,
left join sys_organization so on vat.org_id = so.id and so.is_active = 1 coalesce(ein_error_num,0) as einErrorNum
where 1=1 from att_month_report amr
<if test="userId != null "> left join sys_organization so on amr.org_id = so.id and so.is_active = 1
and vat.user_id = #{userId} where amr.is_active = 1
</if> and amr.required_days != amr.normal_num
<if test='attStatis != null and attStatis == "6"'> and so.parent_id = 2
and (vat.toWorkAttStatus in (12,13,14,15,16,17,18,19) or vat.offWorkAttStatus in (12,13,14,15,16,17,18,19)) <if test="attCurrentMonth != null and attCurrentMonth != '' ">
</if> and amr.att_current_month = #{attCurrentMonth}
<if test='attStatis != null and attStatis != "6"'> </if>
<if test='attStatis == "1"'> <if test="name != null and name != '' ">
and (vat.toWorkAttStatus = #{attStatis} and vat.offWorkAttStatus = #{attStatis} ) and INSTR(amr.name,#{name}) > 0
</if> </if>
<if test='attStatis != "1"'> group by user_id
and (vat.toWorkAttStatus = #{attStatis} or vat.offWorkAttStatus = #{attStatis} ) </select>
</if>
</if>
<if test="orgId != null and orgId != '' ">
and vat.org_id = #{orgId}
</if>
<if test="attCurrent != null and attCurrent != ''"><!-- 结束时间检索 -->
and
(vat.att_current_day &gt;= CONCAT(#{attCurrent}, '-01') AND
vat.att_current_day &lt; LAST_DAY(CONCAT(#{attCurrent}, '-01')))
</if>
<if test="startDate != null and startDate != ''">
and vat.att_current_day between #{startDate} and #{endDate}
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(vat.att_current_day,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(vat.att_current_day,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</select>
<select id="getDetailLeaveList" resultType="com.bonus.system.att.entity.AttDetailLeaveBean"> <select id="selectAttSonsId" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select select
id as id, amr.id as id,
user_id as userId, amr.user_id as userId,
user_name as name, amr.name as name,
org_id as orgId, amr.org_id as orgId,
org_name as orgName, amr.org_name as orgName,
leave_type as leaveType, amr.att_current_month as attCurrentMonth,
leave_reason as leaveReason, coalesce(required_days,0) as requiredDays,
leave_start_date as leaveStartDate, coalesce(normal_num,0) as normalNum,
leave_start_interval as leaveStartInterval, coalesce(late_num,0) as lateNum,
leave_end_date as leaveEndDate, coalesce(early_num,0) as earlyNum,
leave_end_interval as leaveEndInterval, coalesce(skipping_num,0) as skippingNum,
leave_duration as leaveDuration coalesce(leave_num,0) as leaveNum,
from leave_apply la coalesce(address_error_num,0) as addressErrorNum,
where coalesce(ein_error_num,0) as einErrorNum
la.is_active = 1 from att_month_report amr
# and (la.leave_type not like '%临时外出%' and la.leave_type not like '%轮休%') left join sys_organization so on amr.org_id = so.id and so.is_active = 1
<if test="userId != null "> where amr.is_active = 1
and la.user_id = #{userId} and amr.required_days != amr.normal_num
</if> <if test="attCurrentMonth != null and attCurrentMonth != '' ">
<if test="orgId != null and orgId != '' "> and amr.att_current_month = #{attCurrentMonth}
and la.org_id = #{orgId} </if>
</if> <if test="name != null and name != '' ">
</select> and INSTR(amr.name,#{name}) > 0
</if>
group by user_id
</select>
<select id="getDepartmentById" parameterType="java.util.Map" resultType="java.util.Map"> <select id="getDetailList" resultType="com.bonus.system.att.entity.AttDetailBean">
select select
so.id as id, vat.user_id as userId,
so.parent_id as parentId, su.user_name as name,
concat(so.org_name,'/',#{orgName}) as orgName vat.org_id as orgId,
from sys_organization so so.org_name as orgName,
where vat.toWorkAttCurrentTime as goWorkTime ,
so.id = #{parentId} vat.toWorkAttStatus as goWorkStatus,
and is_active = 1 vat.toWorkAttAddress as goWorkAddress,
</select> vat.offWorkAttCurrentTime as offWorkTime,
vat.offWorkAttStatus as offWorkStatus,
vat.offWorkAttAddress as offWorkAddress,
vat.att_current_day as attCurrent
from v_att_update_data vat
left join sys_user su on vat.user_id = su.user_id and su.is_active = 1
left join sys_organization so on vat.org_id = so.id and so.is_active = 1
where 1=1
<if test="userId != null ">
and vat.user_id = #{userId}
</if>
<if test='attStatis != null and attStatis == "6"'>
and (vat.toWorkAttStatus in (12,13,14,15,16,17,18,19) or vat.offWorkAttStatus in (12,13,14,15,16,17,18,19))
</if>
<if test='attStatis != null and attStatis != "6"'>
<if test='attStatis == "1"'>
and (vat.toWorkAttStatus = #{attStatis} and vat.offWorkAttStatus = #{attStatis} )
</if>
<if test='attStatis != "1"'>
and (vat.toWorkAttStatus = #{attStatis} or vat.offWorkAttStatus = #{attStatis} )
</if>
</if>
<if test="orgId != null and orgId != '' ">
and vat.org_id = #{orgId}
</if>
<if test="attCurrentMonth != null and attCurrentMonth != '' ">
and LEFT(vat.att_current_day, 7) = #{attCurrentMonth}
</if>
<if test="attCurrent != null and attCurrent != ''"><!-- 结束时间检索 -->
and
(vat.att_current_day &gt;= CONCAT(#{attCurrent}, '-01') AND
vat.att_current_day &lt; LAST_DAY(CONCAT(#{attCurrent}, '-01')))
</if>
<if test="startDate != null and startDate != ''">
and vat.att_current_day between #{startDate} and #{endDate}
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(vat.att_current_day,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(vat.att_current_day,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</select>
<select id="getSonsById" parameterType="java.lang.Integer" resultType="java.util.Map"> <select id="getDetailLeaveList" resultType="com.bonus.system.att.entity.AttDetailLeaveBean">
select select
so.id as id, id as id,
so.parent_id as parentId, user_id as userId,
so.org_name as orgName user_name as name,
from sys_organization so org_id as orgId,
where org_name as orgName,
so.parent_id = #{orgId} leave_type as leaveType,
and is_active = 1 leave_reason as leaveReason,
</select> leave_start_date as leaveStartDate,
leave_start_interval as leaveStartInterval,
leave_end_date as leaveEndDate,
leave_end_interval as leaveEndInterval,
leave_duration as leaveDuration
from leave_apply la
where
la.is_active = 1
# and (la.leave_type not like '%临时外出%' and la.leave_type not like '%轮休%')
<if test="userId != null ">
and la.user_id = #{userId}
</if>
<if test="orgId != null and orgId != '' ">
and la.org_id = #{orgId}
</if>
</select>
<select id="getSonsFinish" parameterType="java.lang.Integer" resultType="java.util.Map"> <select id="getDepartmentById" parameterType="java.util.Map" resultType="java.util.Map">
select select so.id as id,
so.id as id, so.parent_id as parentId,
so.parent_id as parentId, concat(so.org_name, '/', #{orgName}) as orgName
so.org_name as orgName from sys_organization so
from sys_organization so where so.id = #{parentId}
where and is_active = 1
so.id = #{orgId} </select>
and is_active = 1
</select> <select id="getSonsById" parameterType="java.lang.Integer" resultType="java.util.Map">
select so.id as id,
so.parent_id as parentId,
so.org_name as orgName
from sys_organization so
where so.parent_id = #{orgId}
and is_active = 1
</select>
<select id="getSonsFinish" parameterType="java.lang.Integer" resultType="java.util.Map">
select so.id as id,
so.parent_id as parentId,
so.org_name as orgName
from sys_organization so
where so.id = #{orgId}
and is_active = 1
</select>
</mapper> </mapper>