数据看板

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 attCurrentMonth;
public void setParams(Map<String, Object> params)
{
this.params = params;

View File

@ -1,257 +1,253 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.system.att.dao.AttDetailByMonthDao">
<select id="getAllParentId" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select
id as orgId
from sys_organization so
where so.is_active = 1
and so.parent_id is null
</select>
<select id="getAllParentId" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select id as orgId
from sys_organization so
where so.is_active = 1
and so.parent_id is null
</select>
<select id="selectAttDetailList" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select
user_id as userId,
name as name,
org_id as orgId,
org_name as orgName,
att_current_month as attCurrentMonth,
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
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>
<if test="orgId != null and orgId != ''">
AND amr.org_id = #{orgId}
</if>
<if test="name != null and name != ''">
AND amr.name like concat('%', #{name}, '%')
</if>
group by user_id
</select>
<select id="selectAttDetailList" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select
user_id as userId,
name as name,
org_id as orgId,
org_name as orgName,
att_current_month as attCurrentMonth,
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
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>
<if test="orgId != null and orgId != ''">
AND amr.org_id = #{orgId}
</if>
<if test="name != null and name != ''">
AND amr.name like concat('%', #{name}, '%')
</if>
group by user_id
</select>
<select id="selectAttAllList" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
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,
<select id="selectAttAllList" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select
amr.user_id as userId,
amr.name as name,
name as name,
amr.org_id as orgId,
amr.org_name as orgName,
amr.att_current_month as attCurrentMonth,
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
and so.parent_id = 2
<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>
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="selectAttSonsId" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select
amr.id as id,
amr.user_id as userId,
amr.name as name,
amr.org_id as orgId,
amr.org_name as orgName,
amr.att_current_month as attCurrentMonth,
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="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="getDetailList" resultType="com.bonus.system.att.entity.AttDetailBean">
select
vat.user_id as userId,
su.user_name as name,
vat.org_id as orgId,
so.org_name as orgName,
vat.toWorkAttCurrentTime as goWorkTime ,
vat.toWorkAttStatus as goWorkStatus,
vat.toWorkAttAddress as goWorkAddress,
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="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="selectAttParentId" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select
amr.id as id,
amr.user_id as userId,
amr.name as name,
amr.org_id as orgId,
amr.org_name as orgName,
amr.att_current_month as attCurrentMonth,
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
and so.parent_id = 2
<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="getDetailLeaveList" resultType="com.bonus.system.att.entity.AttDetailLeaveBean">
select
id as id,
user_id as userId,
user_name as name,
org_id as orgId,
org_name as orgName,
leave_type as leaveType,
leave_reason as leaveReason,
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="selectAttSonsId" resultType="com.bonus.system.att.entity.AttDetailByMonthBean">
select
amr.id as id,
amr.user_id as userId,
amr.name as name,
amr.org_id as orgId,
amr.org_name as orgName,
amr.att_current_month as attCurrentMonth,
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="getDepartmentById" parameterType="java.util.Map" resultType="java.util.Map">
select
so.id as id,
so.parent_id as parentId,
concat(so.org_name,'/',#{orgName}) as orgName
from sys_organization so
where
so.id = #{parentId}
and is_active = 1
</select>
<select id="getDetailList" resultType="com.bonus.system.att.entity.AttDetailBean">
select
vat.user_id as userId,
su.user_name as name,
vat.org_id as orgId,
so.org_name as orgName,
vat.toWorkAttCurrentTime as goWorkTime ,
vat.toWorkAttStatus as goWorkStatus,
vat.toWorkAttAddress as goWorkAddress,
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
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="getDetailLeaveList" resultType="com.bonus.system.att.entity.AttDetailLeaveBean">
select
id as id,
user_id as userId,
user_name as name,
org_id as orgId,
org_name as orgName,
leave_type as leaveType,
leave_reason as leaveReason,
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
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>
<select id="getDepartmentById" parameterType="java.util.Map" resultType="java.util.Map">
select so.id as id,
so.parent_id as parentId,
concat(so.org_name, '/', #{orgName}) as orgName
from sys_organization so
where so.id = #{parentId}
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>