insert into business_msg_read(
operate,msg_read_id,msg_id,user_name,b_id,user_id
) values (
#{operate},#{msgReadId},#{msgId},#{userName},#{bId},#{userId}
)
insert into msg_read(
msg_read_id,msg_id,status_cd,user_name,b_id,user_id
) select t.msg_read_id,t.msg_id,'0',t.user_name,t.b_id,t.user_id from business_msg_read t where 1=1
and t.operate= 'ADD'
and t.msg_read_id= #{msgReadId}
and t.msg_id= #{msgId}
and t.user_name= #{userName}
and t.b_id= #{bId}
and t.user_id= #{userId}
update msg_read t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.msg_id= #{msgId}
, t.user_name= #{userName}
, t.user_id= #{userId}
where 1=1
and t.msg_read_id= #{msgReadId}
and t.b_id= #{bId}