| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577 |
- <?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.wx.blink.backend.repository.MateDeliveryDayReportRepository">
- <select id="queryDayReportSubmitCountByParam"
- resultType="com.wx.blink.backend.domain.dataobject.MateDeliveryDayReportDO">
- select *
- from mate_delivery_day_report
- where deleted_flag = 0
- and position_staff = #{positionStaff}
- and submit_date = #{currentDay}
- </select>
- <select id="createDayReportNormal" resultType="boolean">
- INSERT INTO mate_delivery_day_report_normal(report_id, project_id, task_position_id, task_progress,
- accumulate_days, submit_days, submit_describe, create_user_id, create_time) VALUES
- <foreach collection="list" separator="," item="item">
- ( #{item.reportId} , #{item.projectId}, #{item.taskPositionId},#{item.taskProgress}
- ,#{item.accumulateDays},#{item.submitDays},#{item.submitDescribe},#{item.createUserId},#{item.createTime})
- </foreach>
- </select>
- <insert id="createDayReportAbnormal">
- INSERT INTO mate_delivery_day_report_abnormal(report_id, submit_days, submit_describe,
- delivery_id,delivery_name,create_user_id,
- create_time) VALUES
- <foreach collection="list" separator="," item="item">
- ( #{item.reportId} , #{item.submitDays},
- #{item.submitDescribe},#{item.deliveryId},#{item.deliveryName},#{item.createUserId},#{item.createTime})
- </foreach>
- </insert>
- <select id="supportsDeliveryDayReportQueryPage"
- resultType="com.wx.blink.backend.domain.dto.MateDeliveryDayReportDTO">
- SELECT o1.*
- FROM mate_delivery_day_report o1
- 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="query.submitDate != null and query.submitDate != ''">
- and o1.submit_date like concat('%', #{query.submitDate}, '%')
- </if>
- </where>
- order by create_time desc
- </select>
- <select id="getDayReportNormalListByReportId"
- resultType="com.wx.blink.backend.domain.dto.MateDeliveryDayReportNormalDTO">
- select t1.id,
- t1.id taskPositionId,
- t1.delivery_id projectId,
- t2.delivery_name,
- t1.task_id,
- t3.task_name,
- t1.position_id,
- t1.position_staff,
- t1.task_grade,
- t1.task_status,
- t1.task_progress,
- t1.plan_days,
- t1.actual_days accumulateDays,
- t1.plan_start_date,
- t1.plan_end_date,
- t1.actual_start_date,
- t1.actual_end_date,
- t4.submit_days,
- t4.submit_describe
- from mate_delivery_task_positions t1
- left join mate_delivery t2 on t1.delivery_id = t2.id
- left join mate_delivery_task t3 on t1.task_id = t3.id
- left join mate_delivery_day_report_normal t4
- on t4.project_id = t1.delivery_id and task_position_id = t1.id
- where t1.deleted_flag = 0
- and t2.deleted_flag = 0
- and t3.deleted_flag = 0
- and t4.report_id = #{id}
- </select>
- <select id="getDayReportAbnormalListByReportId"
- resultType="com.wx.blink.backend.domain.dto.MateDeliveryDayReportAbnormalDTO">
- select *
- from mate_delivery_day_report_abnormal
- where report_id = #{id}
- </select>
- <select id="getDayReportListByPositionStaff" resultType="com.wx.blink.backend.domain.dto.MateDeliveryDayReportDTO">
- SELECT *
- FROM mate_delivery_day_report
- where position_staff = #{positionStaff}
- and deleted_flag = 0
- order by create_time
- desc
- </select>
- <select id="supportsDeliveryDayReportTask"
- resultType="com.wx.blink.backend.domain.dto.MateDeliveryDayReportNormalDTO">
- select t1.id,
- t1.id taskPositionId,
- t1.delivery_id projectId,
- t2.delivery_name,
- t1.task_id,
- t3.task_name,
- t1.position_id,
- t1.position_staff,
- t1.task_grade,
- t1.task_status,
- t1.task_progress,
- t1.plan_days,
- t1.actual_days accumulateDays,
- t1.plan_start_date,
- t1.plan_end_date,
- t1.actual_start_date,
- t1.actual_end_date
- from mate_delivery_task_positions t1
- left join mate_delivery t2 on t1.delivery_id = t2.id
- left join mate_delivery_task t3 on t1.task_id = t3.id
- where t1.deleted_flag = 0
- and t2.deleted_flag = 0
- and t3.deleted_flag = 0
- and t1.position_staff = #{query.createUserId}
- <if test="query.deliveryName != null and query.deliveryName != ''">
- and t2.delivery_name like concat('%', #{query.deliveryName}, '%')
- </if>
- <if test="query.taskName != null and query.taskName != ''">
- and t3.task_name like concat('%', #{query.taskName}, '%')
- </if>
- </select>
- <select id="getTaskListByReportIdWithDayReport"
- resultType="com.wx.blink.backend.domain.dto.MateDeliveryDayReportNormalDTO">
- select t1.id,
- t1.id taskPositionId,
- t1.delivery_id projectId,
- t2.delivery_name,
- t1.task_id,
- t3.task_name,
- t1.position_id,
- t1.position_staff,
- t1.task_grade,
- t1.task_status,
- t1.task_progress,
- t1.plan_days,
- t1.actual_days accumulateDays,
- t1.plan_start_date,
- t1.plan_end_date,
- t1.actual_start_date,
- t1.actual_end_date,
- t4.submit_days,
- t4.submit_describe
- from mate_delivery_task_positions t1
- left join mate_delivery t2 on t1.delivery_id = t2.id
- left join mate_delivery_task t3 on t1.task_id = t3.id
- left join mate_delivery_day_report_normal t4
- on t4.project_id = t1.delivery_id and task_position_id = t1.id
- where t1.deleted_flag = 0
- and t2.deleted_flag = 0
- and t3.deleted_flag = 0
- and t1.position_staff = #{positionStaff}
- and t4.report_id = #{id}
- </select>
- <select id="getDayReportNormal" resultType="com.wx.blink.backend.domain.dto.MateDeliveryDayReportNormalDTO">
- select *
- from mate_delivery_day_report_normal
- where report_id = #{id}
- and task_position_id = #{taskPositionId}
- and deleted_flag = 0
- </select>
- <select id="supportsDeliveryDayReportValid"
- resultType="com.wx.blink.backend.domain.vo.MateDeliveryDayReportSummary">
- SELECT o1.submit_date submitDate,count(1) submitCount,sum(site_state) siteCount,
- COALESCE (GROUP_CONCAT(CASE WHEN o1.site_state = 1 THEN CONCAT( t1.actual_name, ':', o1.customer_name ) END
- ORDER BY t1.actual_name SEPARATOR '|' ), '' ) AS residentSituation
- FROM mate_delivery_day_report o1
- left join mate_employee t1 on t1.login_name = o1.position_staff
- 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="query.firstDayThisMonth != null and query.firstDayThisMonth != ''">
- and o1.submit_date >= #{query.firstDayThisMonth}
- </if>
- <if test="query.firstDayNextMonth != null and query.firstDayNextMonth != ''">
- and o1.submit_date <![CDATA[<]]> #{query.firstDayNextMonth}
- </if>
- </where>
- GROUP BY o1.submit_date
- order by o1.submit_date desc
- </select>
- <select id="supportsDeliveryDayReportValidForNormal"
- resultType="com.wx.blink.backend.domain.vo.MateDeliveryDayReportSummary">
- select submit_date submitDate, FORMAT(sum(submit_days), 1) normalSubmitDays
- from mate_delivery_day_report t1
- left join
- mate_delivery_day_report_normal t2 on t1.id = t2.report_id
- where t1.deleted_flag = 0
- and t2.deleted_flag = 0
- and report_id in (SELECT o1.id
- FROM mate_delivery_day_report o1
- 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 deleted_flag = 0
- order by o1.submit_date desc)
- <if test="firstDayThisMonth != null and firstDayThisMonth != ''">
- and t1.submit_date >= #{firstDayThisMonth}
- </if>
- <if test="firstDayNextMonth != null and firstDayNextMonth != ''">
- and t1.submit_date <![CDATA[<]]> #{firstDayNextMonth}
- </if>
- GROUP BY submit_date
- </select>
- <select id="supportsDeliveryDayReportValidForAbnormal"
- resultType="com.wx.blink.backend.domain.vo.MateDeliveryDayReportSummary">
- select submit_date submitDate, FORMAT(sum(submit_days), 1) abnormalSubmitDays
- from mate_delivery_day_report t1
- left join
- mate_delivery_day_report_abnormal t2 on t1.id = t2.report_id
- where t1.deleted_flag = 0
- and t2.deleted_flag = 0
- and report_id in (SELECT o1.id
- FROM mate_delivery_day_report o1
- 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 deleted_flag = 0
- order by o1.submit_date desc)
- <if test="firstDayThisMonth != null and firstDayThisMonth != ''">
- and t1.submit_date >= #{firstDayThisMonth}
- </if>
- <if test="firstDayNextMonth != null and firstDayNextMonth != ''">
- and t1.submit_date <![CDATA[<]]> #{firstDayNextMonth}
- </if>
- GROUP BY submit_date
- </select>
- <select id="supportsDeliveryDayReportValidForRequireSubmit"
- resultType="com.wx.blink.backend.domain.vo.MateDeliveryDayReportSummary">
- select submit_day submitDate, count(1) requireSubmitCount,
- sum(case when work_state = '0' then 1 else 0 end ) dutyCount
- from mate_delivery_day_report_require
- where require_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 submit_day
- </select>
- <select id="supportsDeliveryDayReportUnSubmitList"
- resultType="com.wx.blink.backend.domain.vo.MateDeliveryDayReportUnSubmitVO">
- SELECT r.submit_day submitDate,
- GROUP_CONCAT(t.actual_name ORDER BY t.actual_name) AS unSubmitStaff
- FROM mate_delivery_day_report_require AS r
- left join mate_employee t on t.login_name = r.position_staff
- WHERE r.require_state = '0'
- AND r.work_state = '0'
- AND NOT EXISTS (SELECT 1
- FROM (SELECT position_staff, submit_date, MAX(create_time) AS latest_time
- FROM mate_delivery_day_report
- GROUP BY position_staff, submit_date) AS latest
- WHERE latest.position_staff = r.position_staff
- AND latest.submit_date = r.submit_day)
- <if test="firstDayThisMonth != null and firstDayThisMonth != ''">
- and r.submit_day >= #{firstDayThisMonth}
- </if>
- <if test="firstDayNextMonth != null and firstDayNextMonth != ''">
- and r.submit_day <![CDATA[<]]> #{firstDayNextMonth}
- </if>
- GROUP BY r.submit_day
- ORDER BY r.submit_day
- </select>
- <select id="supportsDeliveryDayReportLeaveSituation"
- resultType="com.wx.blink.backend.domain.vo.MateDeliveryDayReportSummary">
- SELECT
- t1.submit_day submitDate,
- GROUP_CONCAT(CONCAT(t2.actual_name, ':', CAST(t1.leave_hour AS UNSIGNED))
- ORDER BY t2.actual_name
- SEPARATOR '|') AS leaveSituation
- FROM mate_delivery_day_report_require t1
- LEFT JOIN mate_employee t2 ON t1.position_staff = t2.login_name
- WHERE t1.require_state = '0'
- AND t1.leave_hour > 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>
- GROUP BY t1.submit_day
- ORDER BY t1.submit_day
- </select>
- <select id="queryEmployeeDaySalaryList" 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
- and t1.submit_day = #{date}
- </select>
- <select id="queryExpenseAmountByDate" resultType="java.math.BigDecimal">
- select sum(expense_amount) expenseAmount
- from l_expense_statement t1
- left join st_instance t2 on t1.flow_id = t2.biz_objectid
- where state = 4
- and DATE_FORMAT(finish_time, '%Y-%m-%d') = #{date}
- </select>
- <select id="queryResidentFixedSubsidyByDate" resultType="java.math.BigDecimal">
- select sum(subsidy_amount) subsidyAmount
- from mate_delivery_day_report t1
- left join mate_delivery t2 on t2.id = t1.delivery_id
- where site_state = 1
- and t1.submit_date = #{date}
- and t1.deleted_flag = '0'
- and t2.deleted_flag = '0'
- </select>
- <select id="queryCategorySubmitDaysList"
- resultType="com.wx.blink.backend.domain.vo.MateDeliveryCategorySubmitDaysVO">
- SELECT 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 o1.submit_date = #{date}
- and t1.id is not null
- group by t2.delivery_category
- </select>
- <select id="queryEmployeeSalaryListByMonth" resultType="com.wx.blink.backend.domain.vo.MateEmployeeDaySalaryVO">
- select 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 = #{paramMonth}
- 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="queryResidentFixedSubsidyByDateRange" resultType="java.math.BigDecimal">
- select sum(subsidy_amount) subsidyAmount
- from mate_delivery_day_report t1
- left join mate_delivery t2 on t2.id = t1.delivery_id
- where site_state = 1
- <if test="firstDayThisMonth != null and firstDayThisMonth != ''">
- and t1.submit_date >= #{firstDayThisMonth}
- </if>
- <if test="firstDayNextMonth != null and firstDayNextMonth != ''">
- and t1.submit_date <![CDATA[<=]]> #{firstDayNextMonth}
- </if>
- and t1.deleted_flag = '0'
- and t2.deleted_flag = '0'
- </select>
- <select id="queryExpenseAmountByDateRange" resultType="java.math.BigDecimal">
- select sum(expense_amount) expenseAmount
- from l_expense_statement t1
- left join st_instance t2 on t1.flow_id = t2.biz_objectid
- where state = 4
- <if test="firstDayThisMonth != null and firstDayThisMonth != ''">
- and DATE_FORMAT(finish_time, '%Y-%m-%d') >= #{firstDayThisMonth}
- </if>
- <if test="firstDayNextMonth != null and firstDayNextMonth != ''">
- and DATE_FORMAT(finish_time, '%Y-%m-%d') <![CDATA[<=]]> #{firstDayNextMonth}
- </if>
- </select>
- <select id="queryCategorySubmitDaysListByDateRange"
- resultType="com.wx.blink.backend.domain.vo.MateDeliveryCategorySubmitDaysVO">
- SELECT 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
- t1.id is not null
- <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>
- group by t2.delivery_category
- </select>
- <select id="queryEmployeeDutyDays" resultType="com.wx.blink.backend.domain.vo.MateEmployeeRankVO">
- select submit_day, position_staff, actual_name employeeName, 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
- and submit_day = #{date}
- </select>
- <select id="queryEmployeeSubmitDays" 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
- 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 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
- ON o1.position_staff = o2.position_staff
- AND o1.create_time = o2.latest_date
- WHERE o1.submit_date = #{date}
- GROUP BY o1.position_staff
- </select>
- <select id="queryCategoryEmployeeSubmitDaysList"
- 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 o1.submit_date = #{date}
- and t1.id is not null
- 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>
|