a.id,
a.standard_plan_id AS "standardPlanId",
a.sys_office_id AS "sysOfficeId",
a.sort,
a.create_by AS "createBy.id",
a.create_date,
a.update_by AS "updateBy.id",
a.update_date,
a.remarks,
a.del_flag,
a.status,
p.title AS "plan.title",
s.name AS "plan.assessmentSystem.name",
o.name AS "office.name",
st.final_score as "subtask.finalScore"
LEFT JOIN standard_plan p ON p.id= a.standard_plan_id
LEFT JOIN assessment_system s ON s.id = p.assessment_system_id
LEFT JOIN sys_office o ON o.id = a.sys_office_id
LEFT JOIN (SELECT max(a.final_score) AS "final_score",a.standard_task_id as "standard_task_id" from standard_subtask a GROUP BY a.standard_task_id) st
ON st.standard_task_id = a.id
INSERT INTO standard_task(
id,
standard_plan_id,
sys_office_id,
sort,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag,
status
) VALUES (
#{id},
#{standardPlanId},
#{sysOfficeId},
#{sort},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag},
#{status}
)
INSERT INTO standard_task(
id,
standard_plan_id,
sys_office_id,
sort,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag,
status
) VALUES (
#{id},
#{standardPlanId},
#{sysOfficeId},
#{sort},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{delFlag},
#{status}
)
UPDATE standard_task SET
standard_plan_id = #{standardPlanId},
sys_office_id = #{sysOfficeId},
sort = #{sort},
create_by = #{createBy.id},
create_date = #{createDate},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks},
del_flag = #{delFlag},
status =#{status}
WHERE id = #{id}
UPDATE standard_task SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
UPDATE standard_task SET
status = #{status}
WHERE id = #{id}