|
|
@@ -420,39 +420,35 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="queryEmployeeSubmitDays" resultType="com.wx.blink.backend.domain.vo.MateEmployeeRankVO">
|
|
|
- SELECT o1.position_staff,
|
|
|
- SUM(IFNULL(t1.submit_days,0)) AS normal_days,
|
|
|
- COALESCE(
|
|
|
- ( SELECT SUM(ab.submit_days)
|
|
|
- FROM mate_delivery_day_report_abnormal ab
|
|
|
- JOIN mate_delivery_day_report r ON r.id = ab.report_id
|
|
|
- WHERE r.position_staff = o1.position_staff
|
|
|
- AND r.submit_date = #{date}
|
|
|
- ),0) AS abnormal_days,
|
|
|
- COALESCE(
|
|
|
- ( SELECT GROUP_CONCAT(
|
|
|
- CONCAT(ab.submit_days,':',ab.submit_describe)
|
|
|
- ORDER BY ab.id
|
|
|
+ SELECT o1.position_staff,
|
|
|
+ SUM(IFNULL(t1.submit_days, 0)) AS normalSubmitDays,
|
|
|
+ COALESCE(
|
|
|
+ (SELECT SUM(ab.submit_days)
|
|
|
+ FROM mate_delivery_day_report_abnormal ab
|
|
|
+ JOIN mate_delivery_day_report r ON r.id = ab.report_id
|
|
|
+ WHERE r.position_staff = o1.position_staff
|
|
|
+ AND r.submit_date = #{date}), 0) AS unNormalSubmitDays,
|
|
|
+ COALESCE(
|
|
|
+ (SELECT GROUP_CONCAT(
|
|
|
+ CONCAT(ab.submit_days, ':', ab.submit_describe) ORDER BY ab.id
|
|
|
SEPARATOR '|')
|
|
|
- FROM mate_delivery_day_report_abnormal ab
|
|
|
- JOIN mate_delivery_day_report r ON r.id = ab.report_id
|
|
|
- WHERE r.position_staff = o1.position_staff
|
|
|
- AND r.submit_date = #{date}
|
|
|
- ),'') AS abnormal_desc,
|
|
|
-
|
|
|
- CASE WHEN ANY_VALUE(o1.site_state) = 1
|
|
|
- THEN ANY_VALUE(t2.subsidy_amount)
|
|
|
- ELSE 0 END AS residentFixedSubsidy
|
|
|
+ FROM mate_delivery_day_report_abnormal ab
|
|
|
+ JOIN mate_delivery_day_report r ON r.id = ab.report_id
|
|
|
+ WHERE r.position_staff = o1.position_staff
|
|
|
+ AND r.submit_date = #{date}), '') AS unNormalSubmitDaysDescribe,
|
|
|
+
|
|
|
+ CASE
|
|
|
+ WHEN ANY_VALUE(o1.site_state) = 1
|
|
|
+ THEN ANY_VALUE(t2.subsidy_amount)
|
|
|
+ ELSE 0 END AS residentFixedSubsidy
|
|
|
FROM mate_delivery_day_report o1
|
|
|
- LEFT JOIN mate_delivery_day_report_normal t1 ON t1.report_id = o1.id
|
|
|
- LEFT JOIN mate_delivery t2 ON t2.id = o1.delivery_id
|
|
|
- JOIN (
|
|
|
- SELECT position_staff, submit_date, MAX(create_time) AS latest_date
|
|
|
- FROM mate_delivery_day_report
|
|
|
- GROUP BY position_staff, submit_date
|
|
|
- ) o2
|
|
|
+ LEFT JOIN mate_delivery_day_report_normal t1 ON t1.report_id = o1.id
|
|
|
+ LEFT JOIN mate_delivery t2 ON t2.id = o1.delivery_id
|
|
|
+ JOIN (SELECT position_staff, submit_date, MAX(create_time) AS latest_date
|
|
|
+ FROM mate_delivery_day_report
|
|
|
+ GROUP BY position_staff, submit_date) o2
|
|
|
ON o1.position_staff = o2.position_staff
|
|
|
- AND o1.create_time = o2.latest_date
|
|
|
+ AND o1.create_time = o2.latest_date
|
|
|
WHERE o1.submit_date = #{date}
|
|
|
GROUP BY o1.position_staff
|
|
|
</select>
|
|
|
@@ -469,6 +465,113 @@
|
|
|
ON o1.position_staff = o2.position_staff AND o1.create_time = o2.latest_date
|
|
|
where o1.submit_date = #{date}
|
|
|
and t1.id is not null
|
|
|
- group by t2.delivery_category,o1.position_staff
|
|
|
+ group by t2.delivery_category, o1.position_staff
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryEmployeeMonthDutyDays" resultType="com.wx.blink.backend.domain.vo.MateEmployeeRankVO">
|
|
|
+ select position_staff, actual_name employeeName, sum(work_hour) dutyDays
|
|
|
+ from mate_delivery_day_report_require t1
|
|
|
+ left join mate_employee t2 on t1.position_staff = t2.login_name
|
|
|
+ where require_state = 0
|
|
|
+ and work_state = 0
|
|
|
+ <if test="firstDayThisMonth != null and firstDayThisMonth != ''">
|
|
|
+ and submit_day >= #{firstDayThisMonth}
|
|
|
+ </if>
|
|
|
+ <if test="firstDayNextMonth != null and firstDayNextMonth != ''">
|
|
|
+ and submit_day <![CDATA[<=]]> #{firstDayNextMonth}
|
|
|
+ </if>
|
|
|
+ group by position_staff,actual_name
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryEmployeeMonthSubmitDays" resultType="com.wx.blink.backend.domain.vo.MateEmployeeRankVO">
|
|
|
+ SELECT o1.position_staff,
|
|
|
+ SUM(IFNULL(t1.submit_days,0)) AS normalSubmitDays,
|
|
|
+ COALESCE(
|
|
|
+ ( SELECT SUM(ab.submit_days)
|
|
|
+ FROM mate_delivery_day_report_abnormal ab
|
|
|
+ JOIN mate_delivery_day_report r ON r.id = ab.report_id
|
|
|
+ WHERE r.position_staff = o1.position_staff
|
|
|
+ <if test="firstDayThisMonth != null and firstDayThisMonth != ''">
|
|
|
+ and r.submit_date >= #{firstDayThisMonth}
|
|
|
+ </if>
|
|
|
+ <if test="firstDayNextMonth != null and firstDayNextMonth != ''">
|
|
|
+ and r.submit_date <![CDATA[<=]]> #{firstDayNextMonth}
|
|
|
+ </if>
|
|
|
+ ),0) AS unNormalSubmitDays,
|
|
|
+ COALESCE(
|
|
|
+ ( SELECT GROUP_CONCAT(
|
|
|
+ CONCAT(r.submit_date,",",ab.submit_days,':',ab.submit_describe)
|
|
|
+ ORDER BY ab.id
|
|
|
+ SEPARATOR '|')
|
|
|
+ FROM mate_delivery_day_report_abnormal ab
|
|
|
+ JOIN mate_delivery_day_report r ON r.id = ab.report_id
|
|
|
+ WHERE r.position_staff = o1.position_staff
|
|
|
+ <if test="firstDayThisMonth != null and firstDayThisMonth != ''">
|
|
|
+ and r.submit_date >= #{firstDayThisMonth}
|
|
|
+ </if>
|
|
|
+ <if test="firstDayNextMonth != null and firstDayNextMonth != ''">
|
|
|
+ and r.submit_date <![CDATA[<=]]> #{firstDayNextMonth}
|
|
|
+ </if>
|
|
|
+ ),'') AS unNormalSubmitDaysDescribe,
|
|
|
+
|
|
|
+ sum(CASE WHEN ANY_VALUE(o1.site_state) = 1
|
|
|
+ THEN ANY_VALUE(t2.subsidy_amount)
|
|
|
+ ELSE 0 END) AS residentFixedSubsidy
|
|
|
+ FROM mate_delivery_day_report o1
|
|
|
+ LEFT JOIN mate_delivery_day_report_normal t1 ON t1.report_id = o1.id
|
|
|
+ LEFT JOIN mate_delivery t2 ON t2.id = o1.delivery_id
|
|
|
+ JOIN (
|
|
|
+ SELECT position_staff, submit_date, MAX(create_time) AS latest_date
|
|
|
+ FROM mate_delivery_day_report
|
|
|
+ GROUP BY position_staff, submit_date
|
|
|
+ ) o2
|
|
|
+ ON o1.position_staff = o2.position_staff
|
|
|
+ AND o1.create_time = o2.latest_date
|
|
|
+ <where>
|
|
|
+ <if test="firstDayThisMonth != null and firstDayThisMonth != ''">
|
|
|
+ and o1.submit_date >= #{firstDayThisMonth}
|
|
|
+ </if>
|
|
|
+ <if test="firstDayNextMonth != null and firstDayNextMonth != ''">
|
|
|
+ and o1.submit_date <![CDATA[<=]]> #{firstDayNextMonth}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY o1.position_staff
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryEmployeeMonthSalaryList" resultType="com.wx.blink.backend.domain.vo.MateEmployeeDaySalaryVO">
|
|
|
+ select t1.position_staff, grant_month, work_hour, salary + insurance + accumulation_fund salary
|
|
|
+ from mate_delivery_day_report_require t1
|
|
|
+ left join mate_employee_salary t2
|
|
|
+ on t1.position_staff = t2.position_staff and grant_month = #{yearMonth}
|
|
|
+ where require_state = 0
|
|
|
+ and work_state = 0
|
|
|
+ <if test="firstDayThisMonth != null and firstDayThisMonth != ''">
|
|
|
+ and t1.submit_day >= #{firstDayThisMonth}
|
|
|
+ </if>
|
|
|
+ <if test="firstDayNextMonth != null and firstDayNextMonth != ''">
|
|
|
+ and t1.submit_day <![CDATA[<=]]> #{firstDayNextMonth}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryCategoryEmployeeMonthSubmitDaysList"
|
|
|
+ resultType="com.wx.blink.backend.domain.vo.MateDeliveryCategoryEmployeeSubmitDaysVO">
|
|
|
+ SELECT o1.position_staff, t2.delivery_category deliveryCategory, sum(t1.submit_days) submitDays
|
|
|
+ FROM mate_delivery_day_report o1
|
|
|
+ left join mate_delivery_day_report_normal t1 on o1.id = t1.report_id
|
|
|
+ left join mate_delivery t2 on t1.project_id = t2.id
|
|
|
+ INNER JOIN (SELECT position_staff, submit_date, MAX(create_time) AS latest_date
|
|
|
+ FROM mate_delivery_day_report
|
|
|
+ GROUP BY position_staff, submit_date) o2
|
|
|
+ ON o1.position_staff = o2.position_staff AND o1.create_time = o2.latest_date
|
|
|
+ <where>
|
|
|
+ <if test="firstDayThisMonth != null and firstDayThisMonth != ''">
|
|
|
+ and o1.submit_date >= #{firstDayThisMonth}
|
|
|
+ </if>
|
|
|
+ <if test="firstDayNextMonth != null and firstDayNextMonth != ''">
|
|
|
+ and o1.submit_date <![CDATA[<=]]> #{firstDayNextMonth}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ and t1.id is not null
|
|
|
+ group by t2.delivery_category, o1.position_staff
|
|
|
</select>
|
|
|
</mapper>
|