A.oc_id,
A.checklist_id,
A.hazard_id,
A.hazard_title,
A.hazard_code,
A.hazard_image,
A.hazard_desc,
B.hazard_type_title,
A.hazard_type_id,
A.hazard_level,
A.parent_id,
A.is_fixed,
A.root_id,
A.node_left,
A.node_right,
A.node_level,
A.is_leaf,
A.sort_no
INSERT INTO checklist_hazard
oc_id,
checklist_id,
hazard_id,
hazard_title,
hazard_code,
hazard_image,
hazard_desc,
hazard_cat_id,
hazard_type_id,
is_fixed,
parent_id,
root_id,
node_left,
node_right,
node_level,
is_leaf,
sort_no,
created_by,
created_at,
#{ocId ,jdbcType=BIGINT},
#{checklistId ,jdbcType=BIGINT},
#{hazardId ,jdbcType=BIGINT},
#{hazardTitle ,jdbcType=VARCHAR},
#{hazardCode ,jdbcType=VARCHAR},
#{hazardImage ,jdbcType=VARCHAR},
#{hazardDesc ,jdbcType=VARCHAR},
#{hazardCatId ,jdbcType=BIGINT},
#{hazardTypeId ,jdbcType=BIGINT},
#{isFixed ,jdbcType=BIGINT},
#{parentId ,jdbcType=BIGINT},
#{rootId ,jdbcType=BIGINT},
#{nodeLeft ,jdbcType=BIGINT},
#{nodeRight ,jdbcType=BIGINT},
#{nodeLevel ,jdbcType=BIGINT},
#{isLeaf ,jdbcType=BIGINT},
#{sortNo ,jdbcType=BIGINT},
#{createdBy ,jdbcType=BIGINT},
#{createdAt ,jdbcType=TIMESTAMP},
UPDATE checklist_hazard
hazard_title = #{hazardTitle, jdbcType=VARCHAR},
hazard_code = #{hazardCode, jdbcType=VARCHAR},
hazard_image = #{hazardImage, jdbcType=VARCHAR},
hazard_desc = #{hazardDesc, jdbcType=VARCHAR},
hazard_cat_id = #{hazardCatId, jdbcType=BIGINT},
is_leaf = #{isLeaf ,jdbcType=BIGINT},
sort_no = #{sortNo ,jdbcType=BIGINT},
updated_by = #{updatedBy ,jdbcType=BIGINT},
updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
WHERE 1 = 1
AND oc_id = #{ocId ,jdbcType=BIGINT}
AND checklist_id = #{checklistId ,jdbcType=BIGINT}
AND hazard_id = #{hazardId ,jdbcType=BIGINT}
UPDATE checklist_hazard
deleted_flag = #{deletedFlag ,jdbcType=BIGINT},
deleted_time = #{deletedTime ,jdbcType=DATE},
deleted_by = #{deletedBy,jdbcType=BIGINT},
WHERE 1 = 1
AND A.oc_id = #{ocId ,jdbcType=BIGINT}
AND checklist_id = #{checklistId ,jdbcType=BIGINT}
AND hazard_id = #{hazardId ,jdbcType=BIGINT}
= #{nodeLeft ,jdbcType=BIGINT}
AND node_right <= #{nodeRight ,jdbcType=BIGINT}
]]>