a.id AS "id",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.remarks AS "remarks",
a.del_flag AS "delFlag",
a.office_id AS "officeId",
a.company_id AS "companyId",
a.branch_office AS "branchOffice",
a.staff_id AS "staffId",
a.start_time AS "startTime",
a.end_time AS "endTime",
a.start_type AS "startType",
a.end_type AS "endType",
a.long_time AS "longTime",
a.status AS "status",
a.process_instance_id AS "processInstanceId",
a.sell_status AS "sellStatus",
a.apply_time AS "applyTime",
a.no AS "no",
a.reason AS "reason",
w.name AS "basicInfo.name",
w.id AS "basicInfo.id",
w.no AS "basicInfo.no",
w.status as "basicInfo.status",
m.top_company AS "basicInfo.office.name",
m.id AS "basicInfo.office.id",
j.name AS "basicInfo.jobGrade.name",
a.applyer,
a.back_time,
a.contrast,
a.back_start_type as "backStartType"
left join work_staff_achives w on w.id=a.staff_id
left join sys_office m on m.id=w.office_id
left join work_job_grade j on j.id=w.job_grade
LEFT JOIN sys_office o ON o.id = a.office_id
LEFT JOIN sys_office s ON s.id = a.company_id
LEFT JOIN sys_user u ON u.id = a.create_by
INSERT INTO leave_apply(
id,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag,
office_id,
company_id,
branch_office,
staff_id,
start_time,
end_time,
start_type,
end_type,
long_time,
status,
process_instance_id,
sell_status,
apply_time,
no,
reason,
applyer,
back_time,
contrast,
back_start_type
) VALUES (
#{id},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag},
#{officeId},
#{companyId},
#{branchOffice},
#{basicInfo.id},
#{startTime},
#{endTime},
#{startType},
#{endType},
#{longTime},
#{status},
#{processInstanceId},
#{sellStatus},
#{applyTime},
#{no},
#{reason},
#{applyer},
#{backTime},
#{contrast},
#{backStartType}
)
UPDATE leave_apply SET
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks},
office_id = #{officeId},
company_id = #{companyId},
branch_office = #{branchOffice},
staff_id = #{basicInfo.id},
start_time = #{startTime},
end_time = #{endTime},
start_type = #{startType},
end_type = #{endType},
long_time = #{longTime},
status = #{status},
process_instance_id = #{processInstanceId},
sell_status = #{sellStatus},
apply_time = #{applyTime},
no = #{no},
reason = #{reason},
applyer=#{applyer},
back_time = #{backTime},
contrast=#{contrast},
back_start_type = #{backStartType}
WHERE id = #{id}
DELETE FROM leave_apply
WHERE id = #{id}
UPDATE leave_apply SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
UPDATE leave_apply SET
process_instance_id = #{processInstanceId},
status = #{status}
WHERE id = #{id}
UPDATE leave_detail a SET
a.flat = '1',a.state='0'
WHERE a.leave_id=#{id}
DELETE FROM leave_detail
WHERE leave_id = #{id} and state='1'
UPDATE leave_apply a SET
a.back_time=null,
a.contrast=null
WHERE a.id=#{id}
UPDATE leave_apply a SET
a.long_time=(select ifnull(sum(days),0) from leave_detail
WHERE leave_id = #{id} and state!='1')
WHERE a.id=#{id}