-
向json类型字段添加数据
json字段为present
<update id="updateMeetingPresent" parameterType="HashMap">
UPDATE tb_meeting
SET present = JSON_ARRAY_APPEND ( IFNULL( present, JSON_ARRAY() ), '$', #{userId} )
WHERE id = #{meetingId}
AND NOW() >= DATE_SUB(CONCAT(date," ",`start`), INTERVAL 15 MINUTE)
AND NOW() < DATE_SUB(CONCAT(date," ",`end`),INTERVAL 15 MINUTE)
AND JSON_CONTAINS ( IFNULL( members, JSON_ARRAY ( ) ), CAST( #{userId} AS CHAR ) )
AND NOT JSON_CONTAINS ( IFNULL( present, JSON_ARRAY ( ) ), CAST( #{userId} AS CHAR ) )
</update>