INSERT INTO t_decision_task (task_id, name, start_time, end_time, create_time, status, shape_area, geom,type_id, report_path, file_path) VALUES (#{id}, #{name}, #{startTime}, #{endTime}, #{createTime}, #{status}, #{shapeArea}, ST_GeomFromEWKT(#{geom}),#{typeId}, #{reportPath}, #{filePath}) UPDATE t_decision_task name = #{name}, start_time = #{startTime}, end_time = #{endTime}, status = #{status}, shape_area = #{shapeArea}, geom = ST_GeomFromEWKT(#{geom}), type_id = #{typeId}, report_path = #{reportPath}, file_path = #{filePath}, WHERE task_id = #{id} DELETE FROM t_decision_task WHERE task_id IN #{id} INSERT INTO t_decision_task_details ( id, task_id, type, source_id, details_name, shape_area, geom ) SELECT REPLACE(uuid_generate_v1()::varchar, '-', '') AS id, #{taskId}, #{type}, t.source_id, t.details_name, public.ST_Area(t.geom::public.geography), t.geom FROM ( SELECT inTbale.${sourceId} as source_id, inTbale.${detailsName} as details_name, public.ST_Intersection(inTbale.geom,public.ST_GeomFromEWKT(#{ewkt})) AS geom FROM vector.${tableName} inTbale WHERE public.ST_Intersects( inTbale.geom,public.ST_GeomFromEWKT(#{ewkt})) AND inTbale.${sourceId}::varchar IN #{tableId} ) t