id, template_id, element_type, element_key, element_name, config,
x_position, y_position, width, height, z_index, rotation, opacity,
create_time, update_time, deleted, deleted_at
INSERT INTO puzzle_element (
template_id, element_type, element_key, element_name, config,
x_position, y_position, width, height, z_index, rotation, opacity,
create_time, update_time, deleted
) VALUES (
#{templateId}, #{elementType}, #{elementKey}, #{elementName}, #{config},
#{xPosition}, #{yPosition}, #{width}, #{height}, #{zIndex}, #{rotation}, #{opacity},
NOW(), NOW(), 0
)
INSERT INTO puzzle_element (
template_id, element_type, element_key, element_name, config,
x_position, y_position, width, height, z_index, rotation, opacity,
create_time, update_time, deleted
) VALUES
(
#{item.templateId}, #{item.elementType}, #{item.elementKey}, #{item.elementName}, #{item.config},
#{item.xPosition}, #{item.yPosition}, #{item.width}, #{item.height}, #{item.zIndex}, #{item.rotation}, #{item.opacity},
NOW(), NOW(), 0
)
UPDATE puzzle_element
element_type = #{elementType},
element_key = #{elementKey},
element_name = #{elementName},
config = #{config},
x_position = #{xPosition},
y_position = #{yPosition},
width = #{width},
height = #{height},
z_index = #{zIndex},
rotation = #{rotation},
opacity = #{opacity},
update_time = NOW()
WHERE id = #{id} AND deleted = 0
UPDATE puzzle_element
SET deleted = 1, deleted_at = NOW(), update_time = NOW()
WHERE id = #{id}
UPDATE puzzle_element
SET deleted = 1, deleted_at = NOW(), update_time = NOW()
WHERE template_id = #{templateId}