insert into contract_type_template( context,store_id,contract_type_id,template_id ) values ( #{context},#{storeId},#{contractTypeId},#{templateId} ) update contract_type_template t set t.status_cd = #{statusCd} ,t.b_id = #{newBId} , t.context= #{context} , t.store_id= #{storeId} , t.contract_type_id= #{contractTypeId} where 1=1 and t.template_id= #{templateId}