insert into tb_device(device_name,device_type,device_code,user_id,status,remark) values(#{deviceName},#{deviceType},#{deviceCode},#{userId},#{status},#{remark}) insert into tb_device_record(device_id,user_id,start_time) values(#{deviceId},#{userId},#{startTime}) UPDATE tb_device device_name = #{deviceName}, device_type = #{deviceType}, device_code = #{deviceCode}, user_id = #{userId}, status = #{status}, remark = #{remark}, WHERE id = #{id} update tb_device set status = #{status} where id = #{deviceId} update tb_device_record set end_time = #{endTime} where device_id = #{deviceId} and end_time is null delete from tb_device where id = #{id}