update visitor_special
set
endTime = case mac
when 'a' then now()
when 'b' then now()
when 'c' then now()
end,
remain = case mac
when 'a' then TIMESTAMPDIFF(Minute, startTime, now())
when 'b' then TIMESTAMPDIFF(Minute, startTime, now())
when 'c' then TIMESTAMPDIFF(Minute, startTime, now())
end
where endTime is null and mac in ('a', 'b', 'c');
@Update("<script>" +
"update visitor_special set " +
"endTime = case " +
"<foreach item=\"visitor\" index=\"index\" collection=\"visitorSpecialList\" >" +
" when mac = #{visitor.mac} then now() " +
"</foreach> " +
" end, " +
"remain = case " +
"<foreach item=\"visitor\" index=\"index\" collection=\"visitorSpecialList\" >" +
" when mac = #{visitor.mac} then TIMESTAMPDIFF(Minute, startTime, now()) " +
"</foreach> " +
" end " +
" where endTime is null and mac in " +
"<foreach item=\"visitor\" index=\"index\" collection=\"visitorSpecialList\" " +
" open=\"(\" separator=\",\" close=\")\">" +
"#{visitor.mac} " +
"</foreach>" +
"</script>")
public void update(@Param("visitorSpecialList")List<VisitorSpecial> visitorSpecialList);