select a.label_id,a.label_type,a.label_code,c.type_name,d.type_name,f.type_name,b.ma_code,a.is_bind
from ma_machine_label a
left JOIN ma_machine b on a.type_id=b.type_id
left Join ma_type c on a.type_id=c.type_id
left Join ma_type d on a.type_id=d.type_id
left Join ma_type f on a.type_id=f.type_id
left join ma_label_bind e on a.type_id=e.type_id
insert into ma_label_bind
ma_id,label_code,type_id,binder,label_type,company_id,binder_time,status,#{maId},#{labelCode},#{typeId},#{binder},#{labelType},#{companyId},#{bindTime},#{status},
insert into ma_label_bind
ma_id,label_code,type_id,binder,label_type,company_id,bind_time,status,#{maId},#{labelCode},#{typeId},#{binder},#{labelType},#{companyId},#{bindTime},#{status},
update ma_label_bind
ma_id = #{maId},label_code = #{labelCode},type_id = #{typeId},binder = #{binder},label_type = #{labelType},company_id = #{companyId},
update ma_label_bind
label_code = #{labelCode},type_id = #{typeId},binder = #{binder},label_type = #{labelType},company_id = #{companyId},
where ma_id = #{maId}
delete from ma_label_bind where ma_id = #{maId}
update ma_label_bind set status = '0' where id = #{id}
update ma_machine_label set
ma_id = #{maId},is_bind =#{isBind}
where label_id =#{labelId}