INSERT INTO issue_vote_statistical
(
id,
issue_id,
SUPPORT_COUNT,
OPPOSITION_COUNT,
VOTABLE_COUNT,
created_by,
created_time,
updated_by,
updated_time
) values
(
(SELECT REPLACE(UUID(), '-', '') AS id),
#{item.issueId},
#{item.supportCount},
#{item.oppositionCount},
#{item.votableCount},
#{item.createdBy},
now(),
#{item.createdBy},
now()
)
UPDATE issue_vote_statistical
when issue_id = #{item.issueId} then #{item.supportCount}
when issue_id = #{item.issueId} then #{item.oppositionCount}
when issue_id = #{item.issueId} then #{item.updatedBy}
when issue_id = #{item.issueId} then #{item.votableCount}
when issue_id = #{item.issueId} then #{item.delFlag}
updated_time = now()
WHERE
del_flag = '0'
issue_id = #{item.issueId}
UPDATE
issue_vote_statistical
support_count = #{supportCount}
opposition_count = #{oppositionCount}
votable_count = #{votableCount}
updated_by = #{updatedBy}
UPDATED_TIME = NOW ()
WHERE
DEL_FLAG = '0'
AND
ISSUE_ID = #{issueId}