left join sys_user u on u.user_name=a.create_by
left join sys_user u2 on u2.user_name=a.quot_check_user_name
left join sys_user u3 on u3.user_name=a.quot_print_user_name
left join sys_dept d on u.dept_id = d.dept_id
left join quot_jsqr q on q.quot_jsqr_id = a.quot_jsxz_confirm_id
left join quot_hj h on h.quot_hj_id = a.quot_hj_id
select a.quot_id, a.quot_code,a.quot_jsw_code, a.quot_salesman_code, a.quot_salesman_bm, a.quot_salesman_name, a.quot_customer_bm,
a.quot_customer_name,a.quot_salesman_dept_id, a.quot_salesman_dept_name, a.quot_address, a.quot_contacts,
a.quot_phone, a.quot_inquiry_date, a.quot_project, a.quot_quotation_date, a.quot_quotation_from,
a.quot_quotation_require, a.quot_feedback_explanation, a.quot_quantity, a.quot_total_price,
a.quot_check_user_name, u2.nick_name quot_check_user_nickname, a.quot_approval_status,a.quot_materials_count,
a.quot_lv_price,a.quot_tong_price,a.quot_matprice_diff,a.quot_matprice_diff2,a.quot_print,a.quot_print_user_name,u3.nick_name quot_print_user_nickName,
a.create_by, a.create_time, a.update_by, a.update_time, u.nick_name create_name,a.quot_handle,
a.quot_jsxz_standard,a.quot_jsxz_approval_status,a.quot_jsxz_chapter,
a.quot_jsxz_technical_requirement,a.quot_jsxz_group_values,a.quot_jsxz_confirm_id,
q.quot_jsqr_code quot_jsxz_confirm_code,
q.quot_jsqr_tl_approval_status,q.quot_jsqr_tl_remark,
q.quot_jsqr_dy_approval_status,q.quot_jsqr_dy_remark,
q.quot_jsqr_zy_approval_status,q.quot_jsqr_zy_remark,
q.quot_jsqr_qt_approval_status,q.quot_jsqr_qt_remark,
a.quot_hj_id,a.quot_hj_approval_status,
h.quot_hj_code,h.quot_hj_pricing_date,
h.quot_hj_remark,
a.quot_jsw_approval_status,a.quot_oa_approval_status,a.quot_oa_approval_remark
from quot a
insert into quot
quot_id,
quot_code,
quot_jsw_code,
quot_salesman_code,
quot_salesman_bm,
quot_salesman_name,
quot_customer_bm,
quot_customer_name,
quot_salesman_dept_id,
quot_salesman_dept_name,
quot_address,
quot_contacts,
quot_phone,
quot_inquiry_date,
quot_project,
quot_quotation_date,
quot_quotation_from,
quot_quotation_require,
quot_feedback_explanation,
quot_quantity,
quot_total_price,
quot_check_user_name,
quot_approval_status,
quot_materials_count,
quot_lv_price,
quot_tong_price,
quot_matprice_diff,
quot_matprice_diff2,
quot_print,
quot_print_user_name,
create_by,
create_time,
update_by,
update_time,
quot_jsxz_standard,
quot_jsxz_approval_status,
quot_jsxz_chapter,
quot_jsxz_technical_requirement,
quot_jsxz_group_values,
quot_jsxz_confirm_id,
quot_hj_id,
quot_hj_approval_status,
quot_jsw_approval_status,
quot_oa_approval_status,
#{quotId},
#{quotCode},
#{quotJswCode},
#{quotSalesmanCode},
#{quotSalesmanBm},
#{quotSalesmanName},
#{quotCustomerBm},
#{quotCustomerName},
#{quotSalesmanDeptId},
#{quotSalesmanDeptName},
#{quotAddress},
#{quotContacts},
#{quotPhone},
#{quotInquiryDate},
#{quotProject},
#{quotQuotationDate},
#{quotQuotationFrom},
#{quotQuotationRequire},
#{quotFeedbackExplanation},
#{quotQuantity},
#{quotTotalPrice},
#{quotCheckUserName},
#{quotApprovalStatus},
#{quotMaterialsCount},
#{quotLvPrice},
#{quotTongPrice},
#{quotMatpriceDiff},
#{quotMatpriceDiff2},
#{quotPrint},
#{quotPrintUserName},
#{createBy},
#{createTime},
#{updateBy},
#{updateTime},
#{quotJsxzStandard},
#{quotJsxzApprovalStatus},
#{quotJsxzChapter},
#{quotJsxzTechnicalRequirement},
#{quotJsxzGroupValues},
#{quotJsxzConfirmId},
#{quotHjId},
#{quotHjApprovalStatus},
#{quotJswApprovalStatus},
#{quotOAApprovalStatus},
insert into sys_oa_quot
user_id,
department_id,
submission_time,
quot_id,
quot_code,
quot_salesman_name,
quot_customer_name,
quot_address,
quot_phone,
quot_inquiry_date,
quot_project,
quot_quotation_require,
quot_lv_price,
quot_tong_price,
quot_matprice_diff,
quot_matprice_diff2,
quot_fk_file,
create_time,
isFinish,
#{userId},
#{departmentId},
#{submissionTime},
#{quotId},
#{quotCode},
#{quotSalesmanName},
#{quotCustomerName},
#{quotAddress},
#{quotPhone},
#{quotInquiryDate},
#{quotProject},
#{quotQuotationRequire},
#{quotLvPrice},
#{quotTongPrice},
#{quotMatpriceDiff},
#{quotMatpriceDiff2},
#{quotFkFile},
#{createTime},
#{isFinish},
update quot
quot_code = #{quotCode},
quot_jsw_code = #{quotJswCode},
quot_salesman_code = #{quotSalesmanCode},
quot_salesman_bm = #{quotSalesmanBm},
quot_salesman_name = #{quotSalesmanName},
quot_customer_bm = #{quotCustomerBm},
quot_customer_name = #{quotCustomerName},
quot_salesman_dept_id = #{quotSalesmanDeptId},
quot_salesman_dept_name = #{quotSalesmanDeptName},
quot_address = #{quotAddress},
quot_contacts = #{quotContacts},
quot_phone = #{quotPhone},
quot_inquiry_date = #{quotInquiryDate},
quot_project = #{quotProject},
quot_quotation_date = #{quotQuotationDate},
quot_quotation_from = #{quotQuotationFrom},
quot_quotation_require = #{quotQuotationRequire},
quot_feedback_explanation = #{quotFeedbackExplanation},
quot_quantity = #{quotQuantity},
quot_total_price = #{quotTotalPrice},
quot_check_user_name = #{quotCheckUserName},
quot_approval_status = #{quotApprovalStatus},
quot_materials_count = #{quotMaterialsCount},
quot_lv_price = #{quotLvPrice},
quot_tong_price = #{quotTongPrice},
quot_matprice_diff = #{quotMatpriceDiff},
quot_matprice_diff2 = #{quotMatpriceDiff2},
quot_print = #{quotPrint},
quot_print_user_name = #{quotPrintUserName},
create_by = #{createBy},
create_time = #{createTime},
update_by = #{updateBy},
update_time = #{updateTime},
quot_jsxz_standard = #{quotJsxzStandard},
quot_jsxz_approval_status = #{quotJsxzApprovalStatus},
quot_jsxz_chapter = #{quotJsxzChapter},
quot_jsxz_technical_requirement = #{quotJsxzTechnicalRequirement},
quot_jsxz_group_values = #{quotJsxzGroupValues},
quot_jsxz_confirm_id = #{quotJsxzConfirmId},
quot_hj_id = #{quotHjId},
quot_hj_approval_status = #{quotHjApprovalStatus},
quot_jsw_approval_status = #{quotJswApprovalStatus},
quot_oa_approval_status = #{quotOAApprovalStatus},
where quot_id = #{quotId}
delete from quot where quot_id = #{quotId}
delete from quot where quot_id in
#{quotId}
delete from quot_material where quot_id in
#{quotId}
delete from quot_material where quot_id = #{quotId}
insert into quot_material( mat_id, mat_xingh, mat_guig, mat_diany,mat_standard, mat_danw, mat_sl,mat_remark, quot_id,xh,number,mat_matprice,mat_price,mat_quot_price,mat_quot_tp,mat_quot_allPrice,mat_matprice_diff) values
( #{item.matId}, #{item.matXingh}, #{item.matGuig}, #{item.matDiany}, #{item.matStandard}, #{item.matDanw}, cast(#{item.matSl,jdbcType=DECIMAL} as decimal(18,3)),#{item.matRemark}, #{item.quotId}, #{item.xh}, #{item.index}, cast(#{item.matMatprice,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.matPrice,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.matQuotPrice,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.matQuotTp,jdbcType=DECIMAL} as decimal(18,3)),cast(#{item.matQuotAllPrice,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.matMatpriceDiff,jdbcType=DECIMAL} as decimal(18,3)))
insert into sys_oa_quot_material( mat_id, mat_xingh, mat_guig, mat_diany,mat_standard, mat_danw, mat_sl,mat_remark, quot_id,xh,number,mat_matprice,mat_price,mat_quot_price,mat_quot_allPrice,mat_matprice_diff) values
( #{item.matId}, #{item.matXingh}, #{item.matGuig}, #{item.matDiany}, #{item.matStandard}, #{item.matDanw}, cast(#{item.matSl,jdbcType=DECIMAL} as decimal(18,3)),#{item.matRemark}, #{item.quotId}, #{item.xh}, #{item.index}, cast(#{item.matMatprice,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.matPrice,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.matQuotPrice,jdbcType=DECIMAL} as decimal(18,3)),cast(#{item.matQuotAllPrice,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.matMatpriceDiff,jdbcType=DECIMAL} as decimal(18,3)))
update quot set quot_handle = '1' where quot_id = #{quotId}