insert into business_attendance_classes_attr(
classes_id,attr_id,operate,spec_cd,store_id,b_id,value
) values (
#{classesId},#{attrId},#{operate},#{specCd},#{storeId},#{bId},#{value}
)
insert into attendance_classes_attr(
classes_id,attr_id,spec_cd,status_cd,store_id,b_id,value
) select t.classes_id,t.attr_id,t.spec_cd,'0',t.store_id,t.b_id,t.value from business_attendance_classes_attr t
where 1=1
and t.classes_id= #{classesId}
and t.attr_id= #{attrId}
and t.operate= 'ADD'
and t.spec_cd= #{specCd}
and t.store_id= #{storeId}
and t.b_id= #{bId}
and t.value= #{value}
update attendance_classes_attr t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.classes_id= #{classesId}
, t.spec_cd= #{specCd}
, t.store_id= #{storeId}
, t.value= #{value}
where 1=1
and t.attr_id= #{attrId}
and t.b_id= #{bId}