|
@@ -265,29 +265,18 @@
|
|
|
resultMap="XmTechnicianSalaryVOMap">
|
|
resultMap="XmTechnicianSalaryVOMap">
|
|
|
SELECT
|
|
SELECT
|
|
|
m.xm_id,xm.XMBH,xm.XMMC,
|
|
m.xm_id,xm.XMBH,xm.XMMC,
|
|
|
- m.unicode,t.name, t.number,t.id_card, t.personnel_type,t.year_and_month,
|
|
|
|
|
- (SELECT IFNULL(SUM(work_hours),0) FROM kd_attendance_records kar WHERE kar.unicode= m.unicode AND LEFT ( work_date, 4 ) = LEFT(m.year_and_month,4)) AS attendanceHours,
|
|
|
|
|
- (SELECT IFNULL(SUM(work_hours),0) FROM kd_xm_technician_hours kxth WHERE kxth.xm_id = m.xm_id AND kxth.unicode = m.unicode AND LEFT ( work_date, 4 ) = LEFT(m.year_and_month,4)) AS workHours,
|
|
|
|
|
- (SELECT IFNULL( sum( s.average_monthly_salary ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS average_monthly_salary,
|
|
|
|
|
- (SELECT IFNULL( sum( s.pension_insurance ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS pension_insurance,
|
|
|
|
|
- (SELECT IFNULL( sum( s.medical_insurance ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS medical_insurance,
|
|
|
|
|
- (SELECT IFNULL( sum( s.unemployment_insurance ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS unemployment_insurance,
|
|
|
|
|
- (SELECT IFNULL( sum( s.injury_insurance ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS injury_insurance,
|
|
|
|
|
- (SELECT IFNULL( sum( s.maternity_insurance ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS maternity_insurance,
|
|
|
|
|
- (SELECT IFNULL( sum( s.provident_fund ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS provident_fund,
|
|
|
|
|
- (SELECT IFNULL( sum( s.bonus ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS bonus,
|
|
|
|
|
- (SELECT IFNULL( sum( s.benefit ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS benefit,
|
|
|
|
|
- (SELECT IFNULL( sum( s.pension_insurance_bc ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS pension_insurance_bc,
|
|
|
|
|
- (SELECT IFNULL( sum( s.medical_insurance_bc ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS medical_insurance_bc
|
|
|
|
|
|
|
+ m.unicode,t.name, t.number,t.id_card, t.personnel_type,t.year_and_month
|
|
|
FROM kd_xm_technician m
|
|
FROM kd_xm_technician m
|
|
|
LEFT JOIN
|
|
LEFT JOIN
|
|
|
(
|
|
(
|
|
|
- select unicode,name,number,id_card,personnel_type,year_and_month
|
|
|
|
|
|
|
+ select
|
|
|
|
|
+ unicode,name,number,id_card,personnel_type,year_and_month
|
|
|
from kd_technician temp
|
|
from kd_technician temp
|
|
|
where temp.unicode = unicode and year_and_month = (select max(year_and_month) from kd_technician where unicode = temp.unicode and left(year_and_month,4) = #{ew.yearAndMonth} order by year_and_month desc limit 1)
|
|
where temp.unicode = unicode and year_and_month = (select max(year_and_month) from kd_technician where unicode = temp.unicode and left(year_and_month,4) = #{ew.yearAndMonth} order by year_and_month desc limit 1)
|
|
|
) as t on t.unicode = m.unicode
|
|
) as t on t.unicode = m.unicode
|
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|
|
|
- SELECT temp.id, XMBH,
|
|
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ temp.id, XMBH,
|
|
|
COALESCE(get_xm_info(temp.id, 'XMMC', #{ew.yearAndMonth}), temp.XMMC ) AS XMMC
|
|
COALESCE(get_xm_info(temp.id, 'XMMC', #{ew.yearAndMonth}), temp.XMMC ) AS XMMC
|
|
|
FROM kd_xm temp
|
|
FROM kd_xm temp
|
|
|
) xm ON m.xm_id = xm.id
|
|
) xm ON m.xm_id = xm.id
|
|
@@ -301,6 +290,46 @@
|
|
|
order by m.xm_id, m.unicode
|
|
order by m.xm_id, m.unicode
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
+<!-- <select id="meiyueyanfarengongfeiyongfeifenpeibiaoYear"-->
|
|
|
|
|
+<!-- resultMap="XmTechnicianSalaryVOMap">-->
|
|
|
|
|
+<!-- SELECT-->
|
|
|
|
|
+<!-- m.xm_id,xm.XMBH,xm.XMMC,-->
|
|
|
|
|
+<!-- m.unicode,t.name, t.number,t.id_card, t.personnel_type,t.year_and_month,-->
|
|
|
|
|
+<!-- (SELECT IFNULL(SUM(work_hours),0) FROM kd_attendance_records kar WHERE kar.unicode= m.unicode AND LEFT ( work_date, 4 ) = LEFT(m.year_and_month,4)) AS attendanceHours,-->
|
|
|
|
|
+<!-- (SELECT IFNULL(SUM(work_hours),0) FROM kd_xm_technician_hours kxth WHERE kxth.xm_id = m.xm_id AND kxth.unicode = m.unicode AND LEFT ( work_date, 4 ) = LEFT(m.year_and_month,4)) AS workHours,-->
|
|
|
|
|
+<!-- (SELECT IFNULL( sum( s.average_monthly_salary ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS average_monthly_salary,-->
|
|
|
|
|
+<!-- (SELECT IFNULL( sum( s.pension_insurance ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS pension_insurance,-->
|
|
|
|
|
+<!-- (SELECT IFNULL( sum( s.medical_insurance ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS medical_insurance,-->
|
|
|
|
|
+<!-- (SELECT IFNULL( sum( s.unemployment_insurance ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS unemployment_insurance,-->
|
|
|
|
|
+<!-- (SELECT IFNULL( sum( s.injury_insurance ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS injury_insurance,-->
|
|
|
|
|
+<!-- (SELECT IFNULL( sum( s.maternity_insurance ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS maternity_insurance,-->
|
|
|
|
|
+<!-- (SELECT IFNULL( sum( s.provident_fund ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS provident_fund,-->
|
|
|
|
|
+<!-- (SELECT IFNULL( sum( s.bonus ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS bonus,-->
|
|
|
|
|
+<!-- (SELECT IFNULL( sum( s.benefit ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS benefit,-->
|
|
|
|
|
+<!-- (SELECT IFNULL( sum( s.pension_insurance_bc ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS pension_insurance_bc,-->
|
|
|
|
|
+<!-- (SELECT IFNULL( sum( s.medical_insurance_bc ), 0 ) FROM kd_salary s WHERE s.unicode = m.unicode AND LEFT ( s.year_and_month, 4 ) = LEFT(m.year_and_month,4)) AS medical_insurance_bc-->
|
|
|
|
|
+<!-- FROM kd_xm_technician m-->
|
|
|
|
|
+<!-- LEFT JOIN-->
|
|
|
|
|
+<!-- (-->
|
|
|
|
|
+<!-- select unicode,name,number,id_card,personnel_type,year_and_month-->
|
|
|
|
|
+<!-- from kd_technician temp-->
|
|
|
|
|
+<!-- where temp.unicode = unicode and year_and_month = (select max(year_and_month) from kd_technician where unicode = temp.unicode and left(year_and_month,4) = #{ew.yearAndMonth} order by year_and_month desc limit 1)-->
|
|
|
|
|
+<!-- ) as t on t.unicode = m.unicode-->
|
|
|
|
|
+<!-- LEFT JOIN (-->
|
|
|
|
|
+<!-- SELECT temp.id, XMBH,-->
|
|
|
|
|
+<!-- COALESCE(get_xm_info(temp.id, 'XMMC', #{ew.yearAndMonth}), temp.XMMC ) AS XMMC-->
|
|
|
|
|
+<!-- FROM kd_xm temp-->
|
|
|
|
|
+<!-- ) xm ON m.xm_id = xm.id-->
|
|
|
|
|
+<!-- WHERE m.tenant_id = #{ew.tenantId} and LEFT(m.year_and_month,4) = #{ew.yearAndMonth}-->
|
|
|
|
|
+<!-- <if test="ew.xmmc!=null and ew.xmmc!=''">and xm.XMMC like concat('%',#{ew.xmmc},'%')</if>-->
|
|
|
|
|
+<!-- <if test="ew.name!=null and ew.name!=''">and t.name like concat('%', #{ew.name},'%')</if>-->
|
|
|
|
|
+<!-- <if test="ew.number!=null and ew.number!=''">and t.number like concat('%',#{ew.number}, '%')</if>-->
|
|
|
|
|
+<!-- <if test="ew.idCard!=null and ew.idCard!=''">and t.id_card like concat('%', #{ew.idCard}, '%')</if>-->
|
|
|
|
|
+<!-- <if test="ew.personnelType!=null and ew.personnelType!=''">and t.personnel_type = #{ew.personnelType}</if>-->
|
|
|
|
|
+<!-- GROUP BY m.xm_id, m.unicode-->
|
|
|
|
|
+<!-- order by m.xm_id, m.unicode-->
|
|
|
|
|
+<!-- </select>-->
|
|
|
|
|
+
|
|
|
<!-- <select id="meiyueyanfaxiangmurengongfenpeihuizongbiao" resultType="org.sky.scientific.pojo.vo.XmSalaryVO">-->
|
|
<!-- <select id="meiyueyanfaxiangmurengongfenpeihuizongbiao" resultType="org.sky.scientific.pojo.vo.XmSalaryVO">-->
|
|
|
<!-- SELECT-->
|
|
<!-- SELECT-->
|
|
|
<!-- t.xm_id,-->
|
|
<!-- t.xm_id,-->
|