2024-08-05 17:16:54 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
< !DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace= "com.ruoyi.quot.mapper.QuotMapper" >
<resultMap type= "Quot" id= "QuotResult" >
<result property= "quotId" column= "quot_id" />
<result property= "quotCode" column= "quot_code" />
<result property= "quotJswCode" column= "quot_jsw_code" />
<result property= "quotSalesmanCode" column= "quot_salesman_code" />
<result property= "quotSalesmanBm" column= "quot_salesman_bm" />
<result property= "quotSalesmanName" column= "quot_salesman_name" />
<result property= "quotCustomerBm" column= "quot_customer_bm" />
<result property= "quotCustomerName" column= "quot_customer_name" />
<result property= "quotSalesmanDeptId" column= "quot_salesman_dept_id" />
<result property= "quotSalesmanDeptName" column= "quot_salesman_dept_name" />
<result property= "quotAddress" column= "quot_address" />
<result property= "quotContacts" column= "quot_contacts" />
<result property= "quotPhone" column= "quot_phone" />
<result property= "quotInquiryDate" column= "quot_inquiry_date" />
<result property= "quotProject" column= "quot_project" />
<result property= "quotQuotationDate" column= "quot_quotation_date" />
<result property= "quotQuotationFrom" column= "quot_quotation_from" />
<result property= "quotQuotationRequire" column= "quot_quotation_require" />
<result property= "quotFeedbackExplanation" column= "quot_feedback_explanation" />
<result property= "quotQuantity" column= "quot_quantity" />
<result property= "quotTotalPrice" column= "quot_total_price" />
<result property= "quotCheckUserName" column= "quot_check_user_name" />
<result property= "quotCheckUserNickname" column= "quot_check_user_nickname" />
<result property= "quotJswCheckUserNickname" column= "quot_jsw_check_user_nickname" />
<result property= "quotBzrUserNickname" column= "quot_bzr_user_nickname" />
<result property= "quotApprovalStatus" column= "quot_approval_status" />
<result property= "quotMaterialsCount" column= "quot_materials_count" />
<result property= "quotRbDateUid" column= "quot_rbDateUid" />
<result property= "quotLvPrice" column= "quot_lv_price" />
<result property= "quotTongPrice" column= "quot_tong_price" />
<result property= "quotMatpriceDiff" column= "quot_matprice_diff" />
<result property= "quotMatpriceDiff2" column= "quot_matprice_diff2" />
<result property= "quotPrint" column= "quot_print" />
<result property= "quotPrintUserName" column= "quot_print_user_name" />
<result property= "quotPrintUserNickName" column= "quot_print_user_nickName" />
<result property= "createBy" column= "create_by" />
<result property= "createName" column= "create_name" />
<result property= "createTime" column= "create_time" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
<result property= "quotHandle" column= "quot_handle" />
<result property= "quotDistinguish" column= "quot_distinguish" />
2024-08-08 15:09:48 +08:00
<result property= "quotBjyRemark" column= "quot_bjy_remark" />
2024-08-05 17:16:54 +08:00
<result property= "quotJsxzStandard" column= "quot_jsxz_standard" />
<result property= "quotJsxzApprovalStatus" column= "quot_jsxz_approval_status" />
<result property= "quotJsxzChapter" column= "quot_jsxz_chapter" />
<result property= "quotJsxzTechnicalRequirement" column= "quot_jsxz_technical_requirement" />
<result property= "quotJsxzGroupValues" column= "quot_jsxz_group_values" />
<result property= "quotJsxzConfirmId" column= "quot_jsxz_confirm_id" />
<result property= "quotJsxzConfirmCode" column= "quot_jsxz_confirm_code" />
<result property= "quotJsqrTlApprovalStatus" column= "quot_jsqr_tl_approval_status" />
<result property= "quotJsqrTlRemark" column= "quot_jsqr_tl_remark" />
<result property= "quotJsqrDyApprovalStatus" column= "quot_jsqr_dy_approval_status" />
<result property= "quotJsqrDyRemark" column= "quot_jsqr_dy_remark" />
<result property= "quotJsqrZyApprovalStatus" column= "quot_jsqr_zy_approval_status" />
<result property= "quotJsqrZyRemark" column= "quot_jsqr_zy_remark" />
<result property= "quotJsqrQtApprovalStatus" column= "quot_jsqr_qt_approval_status" />
<result property= "quotJsqrQtRemark" column= "quot_jsqr_qt_remark" />
<result property= "quotHjId" column= "quot_hj_id" />
<result property= "quotHjCode" column= "quot_hj_code" />
<result property= "quotHjApprovalStatus" column= "quot_hj_approval_status" />
<result property= "quotHjPricingDate" column= "quot_hj_pricing_date" />
<result property= "quotHjRemark" column= "quot_hj_remark" />
<result property= "quotJswApprovalStatus" column= "quot_jsw_approval_status" />
<result property= "quotOAApprovalStatus" column= "quot_oa_approval_status" />
<result property= "quotOAApprovalStatusRemark" column= "quot_oa_approval_remark" />
</resultMap>
<resultMap id= "QuotQuotMaterialResult" type= "Quot" extends= "QuotResult" >
<collection property= "quotMaterialList" notNullColumn= "sub_mat_id" javaType= "java.util.List" resultMap= "QuotMaterialResult" />
</resultMap>
<resultMap type= "QuotMaterial" id= "QuotMaterialResult" >
<result property= "matId" column= "sub_mat_id" />
<result property= "matXingh" column= "sub_mat_xingh" />
<result property= "matGuig" column= "sub_mat_guig" />
<result property= "matDiany" column= "sub_mat_diany" />
<result property= "matStandard" column= "sub_mat_standard" />
<result property= "matDanw" column= "sub_mat_danw" />
<result property= "matSl" column= "sub_mat_sl" />
<result property= "matRemark" column= "sub_mat_remark" />
<result property= "matMatprice" column= "sub_mat_matprice" />
<result property= "matPrice" column= "sub_mat_price" />
<result property= "matPerc" column= "sub_mat_perc" />
<result property= "matPerc2" column= "sub_mat_perc2" />
<result property= "matQuotPrice" column= "sub_mat_quot_price" />
<result property= "matQuotTp" column= "sub_mat_quot_tp" />
<result property= "matQuotAllPrice" column= "sub_mat_quot_allPrice" />
<result property= "matMatpriceDiff" column= "sub_mat_matprice_diff" />
<result property= "xh" column= "sub_xh" />
<result property= "index" column= "sub_number" />
<result property= "quotId" column= "sub_quot_id" />
</resultMap>
<sql id= "quotJoins" >
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
</sql>
<sql id= "selectQuotVo" >
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_jsw_check_user_nickname,a.quot_bzr_user_nickname, a.quot_approval_status,a.quot_materials_count,a.quot_rbDateUid,
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,
2024-08-08 15:09:48 +08:00
a.create_by, a.create_time, a.update_by, a.update_time, u.nick_name create_name,a.quot_handle,a.quot_distinguish,a.quot_bjy_remark,
2024-08-05 17:16:54 +08:00
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
<include refid= "quotJoins" />
</sql>
<select id= "selectQuotList" parameterType= "Quot" resultMap= "QuotResult" >
<include refid= "selectQuotVo" />
<where >
<if test= "quotCode != null and quotCode != ''" > and quot_code like concat('%', #{quotCode}, '%')</if>
<if test= "quotCustomerName != null and quotCustomerName != ''" > and quot_customer_name like concat('%', #{quotCustomerName}, '%')</if>
<if test= "quotProject != null and quotProject != ''" > and quot_project like concat('%', #{quotProject}, '%')</if>
<if test= "quotQuotationRequire != null and quotQuotationRequire != ''" > and quot_quotation_require like concat('%', #{quotQuotationRequire}, '%')</if>
<if test= "quotSalesmanName != null and quotSalesmanName != ''" > and quot_salesman_name like concat('%', #{quotSalesmanName}, '%')</if>
<if test= "quotPrint != null and quotPrint != ''" > and quot_print = #{quotPrint}</if>
<if test= "quotApprovalStatus != null and quotApprovalStatus != ''" > and quot_approval_status = #{quotApprovalStatus}</if>
<if test= "quotOAApprovalStatus != null and quotOAApprovalStatus != ''" > and quot_oa_approval_status = #{quotOAApprovalStatus}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
<!-- order by a.quot_inquiry_date desc -->
</select>
<select id= "selectQuotListCount" resultType= "String" >
select count(1) from quot where quot_approval_status in ('1','2') and CONVERT(DATE, quot_inquiry_date) = CONVERT(DATE, GETDATE())
</select>
<select id= "selectQuotByQuotId" parameterType= "String" resultMap= "QuotQuotMaterialResult" >
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_jsw_check_user_nickname,a.quot_bzr_user_nickname,a.quot_approval_status,a.quot_rbDateUid,
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,
2024-08-09 15:39:40 +08:00
a.create_by, a.create_time, a.update_by, a.update_time,a.quot_handle,a.quot_distinguish,a.quot_bjy_remark,
2024-08-05 17:16:54 +08:00
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,
b.mat_id as sub_mat_id, b.mat_xingh as sub_mat_xingh, b.mat_guig as sub_mat_guig,
b.mat_diany as sub_mat_diany, b.mat_standard as sub_mat_standard, b.mat_danw as sub_mat_danw, b.mat_sl as sub_mat_sl,
b.mat_remark as sub_mat_remark,
b.mat_matprice as sub_mat_matprice,
b.mat_price as sub_mat_price,
b.mat_perc as sub_mat_perc,
b.mat_perc2 as sub_mat_perc2,
b.mat_quot_price as sub_mat_quot_price,
b.mat_quot_tp as sub_mat_quot_tp,
b.mat_quot_allPrice as sub_mat_quot_allPrice,
b.mat_matprice_diff as sub_mat_matprice_diff,
b.xh as sub_xh,
b.number as sub_number,
b.quot_id as sub_quot_id
from quot a
left join quot_material b on b.quot_id = a.quot_id
<include refid= "quotJoins" />
where a.quot_id = #{quotId}
order by b.number
</select>
<select id= "selectQuotByQuotCode" resultType= "String" >
select top 1 quot_id from quot where quot_code = #{quotCode}
</select>
<select id= "checkExistQuot" parameterType= "String" resultType= "String" >
select count(1) from quot where quot_salesman_code != #{quotSalesmanCode}
and quot_customer_bm = #{quotCustomerBm} and quot_project = #{quotProject}
and quot_approval_status in ('1','2')
</select>
<select id= "selectRegisteredCompanyByTax" parameterType= "String" resultType= "String" >
2024-08-09 14:31:55 +08:00
select count(1) from registered_company where reg_tax = #{tax} and reg_state = '0' and reg_allow_tp_state = '1'
2024-08-05 17:16:54 +08:00
</select>
2024-08-09 14:31:55 +08:00
<select id= "selectRegisteredCompanyByTax2" parameterType= "String" resultType= "String" >
select count(1) from registered_company where reg_tax = #{tax} and reg_state = '0' and reg_allow_quot_state = '1'
</select>
2024-08-05 17:16:54 +08:00
<insert id= "insertQuot" parameterType= "Quot" >
insert into quot
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "quotId != null and quotId != ''" > quot_id,</if>
<if test= "quotCode != null and quotCode != ''" > quot_code,</if>
<if test= "quotJswCode != null and quotJswCode != ''" > quot_jsw_code,</if>
<if test= "quotSalesmanCode != null and quotSalesmanCode != ''" > quot_salesman_code,</if>
<if test= "quotSalesmanBm != null and quotSalesmanBm != ''" > quot_salesman_bm,</if>
<if test= "quotSalesmanName != null and quotSalesmanName != ''" > quot_salesman_name,</if>
<if test= "quotCustomerBm != null and quotCustomerBm != ''" > quot_customer_bm,</if>
<if test= "quotCustomerName != null and quotCustomerName != ''" > quot_customer_name,</if>
<if test= "quotSalesmanDeptId != null and quotSalesmanDeptId != ''" > quot_salesman_dept_id,</if>
<if test= "quotSalesmanDeptName != null and quotSalesmanDeptName != ''" > quot_salesman_dept_name,</if>
<if test= "quotAddress != null and quotAddress != ''" > quot_address,</if>
<if test= "quotContacts != null and quotContacts != ''" > quot_contacts,</if>
<if test= "quotPhone != null and quotPhone != ''" > quot_phone,</if>
<if test= "quotInquiryDate != null" > quot_inquiry_date,</if>
<if test= "quotProject != null and quotProject != ''" > quot_project,</if>
<if test= "quotQuotationDate != null" > quot_quotation_date,</if>
<if test= "quotQuotationFrom != null and quotQuotationFrom != ''" > quot_quotation_from,</if>
<if test= "quotQuotationRequire != null and quotQuotationRequire != ''" > quot_quotation_require,</if>
<if test= "quotFeedbackExplanation != null and quotFeedbackExplanation != ''" > quot_feedback_explanation,</if>
<if test= "quotQuantity != null and quotQuantity != ''" > quot_quantity,</if>
<if test= "quotTotalPrice != null and quotTotalPrice != ''" > quot_total_price,</if>
<if test= "quotCheckUserName != null and quotCheckUserName != ''" > quot_check_user_name,</if>
<if test= "quotApprovalStatus != null and quotApprovalStatus != ''" > quot_approval_status,</if>
<if test= "quotMaterialsCount != null and quotMaterialsCount != ''" > quot_materials_count,</if>
<if test= "quotRbDateUid != null and quotRbDateUid != ''" > quot_rbDateUid,</if>
<if test= "quotLvPrice != null and quotLvPrice != ''" > quot_lv_price,</if>
<if test= "quotTongPrice != null and quotTongPrice != ''" > quot_tong_price,</if>
<if test= "quotMatpriceDiff != null and quotMatpriceDiff != ''" > quot_matprice_diff,</if>
<if test= "quotMatpriceDiff2 != null and quotMatpriceDiff2 != ''" > quot_matprice_diff2,</if>
<if test= "quotPrint != null and quotPrint != ''" > quot_print,</if>
<if test= "quotPrintUserName != null and quotPrintUserName != ''" > quot_print_user_name,</if>
<if test= "quotDistinguish != null and quotDistinguish != ''" > quot_distinguish,</if>
2024-08-08 15:09:48 +08:00
<if test= "quotBjyRemark != null and quotBjyRemark != ''" > quot_bjy_remark,</if>
2024-08-05 17:16:54 +08:00
<if test= "createBy != null and createBy != ''" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "updateBy != null and updateBy != ''" > update_by,</if>
<if test= "updateTime != null" > update_time,</if>
<if test= "quotJsxzStandard != null and quotJsxzStandard != ''" > quot_jsxz_standard,</if>
<if test= "quotJsxzApprovalStatus != null and quotJsxzApprovalStatus != ''" > quot_jsxz_approval_status,</if>
<if test= "quotJsxzChapter != null and quotJsxzChapter != ''" > quot_jsxz_chapter,</if>
<if test= "quotJsxzTechnicalRequirement != null and quotJsxzTechnicalRequirement != ''" > quot_jsxz_technical_requirement,</if>
<if test= "quotJsxzGroupValues != null and quotJsxzGroupValues != ''" > quot_jsxz_group_values,</if>
<if test= "quotJsxzConfirmId != null and quotJsxzConfirmId != ''" > quot_jsxz_confirm_id,</if>
<if test= "quotHjId != null and quotHjId != ''" > quot_hj_id,</if>
<if test= "quotHjApprovalStatus != null and quotHjApprovalStatus != ''" > quot_hj_approval_status,</if>
<if test= "quotJswApprovalStatus != null and quotJswApprovalStatus != ''" > quot_jsw_approval_status,</if>
<if test= "quotOAApprovalStatus != null and quotOAApprovalStatus != ''" > quot_oa_approval_status,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "quotId != null and quotId != ''" > #{quotId},</if>
<if test= "quotCode != null and quotCode != ''" > #{quotCode},</if>
<if test= "quotJswCode != null and quotJswCode != ''" > #{quotJswCode},</if>
<if test= "quotSalesmanCode != null and quotSalesmanCode != ''" > #{quotSalesmanCode},</if>
<if test= "quotSalesmanBm != null and quotSalesmanBm != ''" > #{quotSalesmanBm},</if>
<if test= "quotSalesmanName != null and quotSalesmanName != ''" > #{quotSalesmanName},</if>
<if test= "quotCustomerBm != null and quotCustomerBm != ''" > #{quotCustomerBm},</if>
<if test= "quotCustomerName != null and quotCustomerName != ''" > #{quotCustomerName},</if>
<if test= "quotSalesmanDeptId != null and quotSalesmanDeptId != ''" > #{quotSalesmanDeptId},</if>
<if test= "quotSalesmanDeptName != null and quotSalesmanDeptName != ''" > #{quotSalesmanDeptName},</if>
<if test= "quotAddress != null and quotAddress != ''" > #{quotAddress},</if>
<if test= "quotContacts != null and quotContacts != ''" > #{quotContacts},</if>
<if test= "quotPhone != null and quotPhone != ''" > #{quotPhone},</if>
<if test= "quotInquiryDate != null" > #{quotInquiryDate},</if>
<if test= "quotProject != null and quotProject != ''" > #{quotProject},</if>
<if test= "quotQuotationDate != null" > #{quotQuotationDate},</if>
<if test= "quotQuotationFrom != null and quotQuotationFrom != ''" > #{quotQuotationFrom},</if>
<if test= "quotQuotationRequire != null and quotQuotationRequire != ''" > #{quotQuotationRequire},</if>
<if test= "quotFeedbackExplanation != null and quotFeedbackExplanation != ''" > #{quotFeedbackExplanation},</if>
<if test= "quotQuantity != null and quotQuantity != ''" > #{quotQuantity},</if>
<if test= "quotTotalPrice != null and quotTotalPrice != ''" > #{quotTotalPrice},</if>
<if test= "quotCheckUserName != null and quotCheckUserName != ''" > #{quotCheckUserName},</if>
<if test= "quotApprovalStatus != null and quotApprovalStatus != ''" > #{quotApprovalStatus},</if>
<if test= "quotMaterialsCount != null and quotMaterialsCount != ''" > #{quotMaterialsCount},</if>
<if test= "quotRbDateUid != null and quotRbDateUid != ''" > #{quotRbDateUid},</if>
<if test= "quotLvPrice != null and quotLvPrice != ''" > #{quotLvPrice},</if>
<if test= "quotTongPrice != null and quotTongPrice != ''" > #{quotTongPrice},</if>
<if test= "quotMatpriceDiff != null and quotMatpriceDiff != ''" > #{quotMatpriceDiff},</if>
<if test= "quotMatpriceDiff2 != null and quotMatpriceDiff2 != ''" > #{quotMatpriceDiff2},</if>
<if test= "quotPrint != null and quotPrint != ''" > #{quotPrint},</if>
<if test= "quotPrintUserName != null and quotPrintUserName != ''" > #{quotPrintUserName},</if>
<if test= "quotDistinguish != null and quotDistinguish != ''" > #{quotDistinguish},</if>
2024-08-08 15:09:48 +08:00
<if test= "quotBjyRemark != null and quotBjyRemark != ''" > #{quotBjyRemark},</if>
2024-08-05 17:16:54 +08:00
<if test= "createBy != null and createBy != ''" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "updateBy != null and updateBy != ''" > #{updateBy},</if>
<if test= "updateTime != null" > #{updateTime},</if>
<if test= "quotJsxzStandard != null and quotJsxzStandard != ''" > #{quotJsxzStandard},</if>
<if test= "quotJsxzApprovalStatus != null and quotJsxzApprovalStatus != ''" > #{quotJsxzApprovalStatus},</if>
<if test= "quotJsxzChapter != null and quotJsxzChapter != ''" > #{quotJsxzChapter},</if>
<if test= "quotJsxzTechnicalRequirement != null and quotJsxzTechnicalRequirement != ''" > #{quotJsxzTechnicalRequirement},</if>
<if test= "quotJsxzGroupValues != null and quotJsxzGroupValues != ''" > #{quotJsxzGroupValues},</if>
<if test= "quotJsxzConfirmId != null and quotJsxzConfirmId != ''" > #{quotJsxzConfirmId},</if>
<if test= "quotHjId != null and quotHjId != ''" > #{quotHjId},</if>
<if test= "quotHjApprovalStatus != null and quotHjApprovalStatus != ''" > #{quotHjApprovalStatus},</if>
<if test= "quotJswApprovalStatus != null and quotJswApprovalStatus != ''" > #{quotJswApprovalStatus},</if>
<if test= "quotOAApprovalStatus != null and quotOAApprovalStatus != ''" > #{quotOAApprovalStatus},</if>
</trim>
</insert>
<select id= "selectOAUserByUserName" resultType= "SysOaQuot" >
select top 1 id as userId,departmentid as departmentId from HrmResource where loginid = #{loginid}
</select>
<insert id= "insertSysOAQuot" parameterType= "SysOaQuot" >
insert into sys_oa_quot
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "userId != null and userId != ''" > user_id,</if>
<if test= "departmentId != null and departmentId != ''" > department_id,</if>
<if test= "submissionTime != null and submissionTime != ''" > submission_time,</if>
<if test= "quotId != null and quotId != ''" > quot_id,</if>
<if test= "quotCode != null and quotCode != ''" > quot_code,</if>
<if test= "quotSalesmanName != null and quotSalesmanName != ''" > quot_salesman_name,</if>
<if test= "quotCustomerName != null and quotCustomerName != ''" > quot_customer_name,</if>
<if test= "quotAddress != null and quotAddress != ''" > quot_address,</if>
<if test= "quotPhone != null and quotPhone != ''" > quot_phone,</if>
<if test= "quotInquiryDate != null" > quot_inquiry_date,</if>
<if test= "quotProject != null and quotProject != ''" > quot_project,</if>
<if test= "quotQuotationRequire != null and quotQuotationRequire != ''" > quot_quotation_require,</if>
<if test= "quotLvPrice != null and quotLvPrice != ''" > quot_lv_price,</if>
<if test= "quotTongPrice != null and quotTongPrice != ''" > quot_tong_price,</if>
<if test= "quotMatpriceDiff != null and quotMatpriceDiff != ''" > quot_matprice_diff,</if>
<if test= "quotMatpriceDiff2 != null and quotMatpriceDiff2 != ''" > quot_matprice_diff2,</if>
<if test= "quotFkFile != null and quotFkFile != ''" > quot_fk_file,</if>
<if test= "quotTotalPrice != null and quotTotalPrice != ''" > quot_total_price,</if>
2024-08-08 15:09:48 +08:00
<if test= "quotBjyRemark != null and quotBjyRemark != ''" > quot_bjy_remark,</if>
2024-08-05 17:16:54 +08:00
<if test= "createTime != null" > create_time,</if>
<if test= "isFinish != null and isFinish != ''" > isFinish,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "userId != null and userId != ''" > #{userId},</if>
<if test= "departmentId != null and departmentId != ''" > #{departmentId},</if>
<if test= "submissionTime != null and submissionTime != ''" > #{submissionTime},</if>
<if test= "quotId != null and quotId != ''" > #{quotId},</if>
<if test= "quotCode != null and quotCode != ''" > #{quotCode},</if>
<if test= "quotSalesmanName != null and quotSalesmanName != ''" > #{quotSalesmanName},</if>
<if test= "quotCustomerName != null and quotCustomerName != ''" > #{quotCustomerName},</if>
<if test= "quotAddress != null and quotAddress != ''" > #{quotAddress},</if>
<if test= "quotPhone != null and quotPhone != ''" > #{quotPhone},</if>
<if test= "quotInquiryDate != null" > #{quotInquiryDate},</if>
<if test= "quotProject != null and quotProject != ''" > #{quotProject},</if>
<if test= "quotQuotationRequire != null and quotQuotationRequire != ''" > #{quotQuotationRequire},</if>
<if test= "quotLvPrice != null and quotLvPrice != ''" > #{quotLvPrice},</if>
<if test= "quotTongPrice != null and quotTongPrice != ''" > #{quotTongPrice},</if>
<if test= "quotMatpriceDiff != null and quotMatpriceDiff != ''" > #{quotMatpriceDiff},</if>
<if test= "quotMatpriceDiff2 != null and quotMatpriceDiff2 != ''" > #{quotMatpriceDiff2},</if>
<if test= "quotFkFile != null and quotFkFile != ''" > #{quotFkFile},</if>
<if test= "quotTotalPrice != null and quotTotalPrice != ''" > #{quotTotalPrice},</if>
2024-08-08 15:09:48 +08:00
<if test= "quotBjyRemark != null and quotBjyRemark != ''" > #{quotBjyRemark},</if>
2024-08-05 17:16:54 +08:00
<if test= "createTime != null" > #{createTime},</if>
<if test= "isFinish != null and isFinish != ''" > #{isFinish},</if>
</trim>
</insert>
<update id= "updateQuot" parameterType= "Quot" >
update quot
<trim prefix= "SET" suffixOverrides= "," >
<if test= "quotCode != null and quotCode != ''" > quot_code = #{quotCode},</if>
<if test= "quotJswCode != null and quotJswCode != ''" > quot_jsw_code = #{quotJswCode},</if>
<if test= "quotSalesmanCode != null and quotSalesmanCode != ''" > quot_salesman_code = #{quotSalesmanCode},</if>
<if test= "quotSalesmanBm != null and quotSalesmanBm != ''" > quot_salesman_bm = #{quotSalesmanBm},</if>
<if test= "quotSalesmanName != null and quotSalesmanName != ''" > quot_salesman_name = #{quotSalesmanName},</if>
<if test= "quotCustomerBm != null and quotCustomerBm != ''" > quot_customer_bm = #{quotCustomerBm},</if>
<if test= "quotCustomerName != null and quotCustomerName != ''" > quot_customer_name = #{quotCustomerName},</if>
<if test= "quotSalesmanDeptId != null and quotSalesmanDeptId != ''" > quot_salesman_dept_id = #{quotSalesmanDeptId},</if>
<if test= "quotSalesmanDeptName != null and quotSalesmanDeptName != ''" > quot_salesman_dept_name = #{quotSalesmanDeptName},</if>
<if test= "quotAddress != null and quotAddress != ''" > quot_address = #{quotAddress},</if>
<if test= "quotContacts != null and quotContacts != ''" > quot_contacts = #{quotContacts},</if>
<if test= "quotPhone != null and quotPhone != ''" > quot_phone = #{quotPhone},</if>
<if test= "quotInquiryDate != null" > quot_inquiry_date = #{quotInquiryDate},</if>
<if test= "quotProject != null and quotProject != ''" > quot_project = #{quotProject},</if>
<if test= "quotQuotationDate != null" > quot_quotation_date = #{quotQuotationDate},</if>
<if test= "quotQuotationFrom != null and quotQuotationFrom != ''" > quot_quotation_from = #{quotQuotationFrom},</if>
<if test= "quotQuotationRequire != null and quotQuotationRequire != ''" > quot_quotation_require = #{quotQuotationRequire},</if>
<if test= "quotFeedbackExplanation != null and quotFeedbackExplanation != ''" > quot_feedback_explanation = #{quotFeedbackExplanation},</if>
<if test= "quotQuantity != null and quotQuantity != ''" > quot_quantity = #{quotQuantity},</if>
<if test= "quotTotalPrice != null and quotTotalPrice != ''" > quot_total_price = #{quotTotalPrice},</if>
<if test= "quotCheckUserName != null and quotCheckUserName != ''" > quot_check_user_name = #{quotCheckUserName},</if>
<if test= "quotApprovalStatus != null and quotApprovalStatus != ''" > quot_approval_status = #{quotApprovalStatus},</if>
<if test= "quotMaterialsCount != null and quotMaterialsCount != ''" > quot_materials_count = #{quotMaterialsCount},</if>
<if test= "quotRbDateUid != null and quotRbDateUid != ''" > quot_rbDateUid = #{quotRbDateUid},</if>
<if test= "quotLvPrice != null and quotLvPrice != ''" > quot_lv_price = #{quotLvPrice},</if>
<if test= "quotTongPrice != null and quotTongPrice != ''" > quot_tong_price = #{quotTongPrice},</if>
<if test= "quotMatpriceDiff != null and quotMatpriceDiff != ''" > quot_matprice_diff = #{quotMatpriceDiff},</if>
<if test= "quotMatpriceDiff2 != null and quotMatpriceDiff2 != ''" > quot_matprice_diff2 = #{quotMatpriceDiff2},</if>
<if test= "quotPrint != null and quotPrint != ''" > quot_print = #{quotPrint},</if>
<if test= "quotPrintUserName != null and quotPrintUserName != ''" > quot_print_user_name = #{quotPrintUserName},</if>
<if test= "quotJswCheckUserNickname != null and quotJswCheckUserNickname != ''" > quot_jsw_check_user_nickname = #{quotJswCheckUserNickname},</if>
<if test= "quotBzrUserNickname != null and quotBzrUserNickname != ''" > quot_bzr_user_nickname = #{quotBzrUserNickname},</if>
2024-08-08 15:09:48 +08:00
<if test= "quotBjyRemark != null and quotBjyRemark != ''" > quot_bjy_remark = #{quotBjyRemark},</if>
2024-08-05 17:16:54 +08:00
<if test= "createBy != null and createBy != ''" > create_by = #{createBy},</if>
<if test= "createTime != null" > create_time = #{createTime},</if>
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "quotJsxzStandard != null and quotJsxzStandard != ''" > quot_jsxz_standard = #{quotJsxzStandard},</if>
<if test= "quotJsxzApprovalStatus != null and quotJsxzApprovalStatus != ''" > quot_jsxz_approval_status = #{quotJsxzApprovalStatus},</if>
<if test= "quotJsxzChapter != null and quotJsxzChapter != ''" > quot_jsxz_chapter = #{quotJsxzChapter},</if>
<if test= "quotJsxzTechnicalRequirement != null and quotJsxzTechnicalRequirement != ''" > quot_jsxz_technical_requirement = #{quotJsxzTechnicalRequirement},</if>
<if test= "quotJsxzGroupValues != null and quotJsxzGroupValues != ''" > quot_jsxz_group_values = #{quotJsxzGroupValues},</if>
<if test= "quotJsxzConfirmId != null and quotJsxzConfirmId != ''" > quot_jsxz_confirm_id = #{quotJsxzConfirmId},</if>
<if test= "quotHjId != null and quotHjId != ''" > quot_hj_id = #{quotHjId},</if>
<if test= "quotHjApprovalStatus != null and quotHjApprovalStatus != ''" > quot_hj_approval_status = #{quotHjApprovalStatus},</if>
<if test= "quotJswApprovalStatus != null and quotJswApprovalStatus != ''" > quot_jsw_approval_status = #{quotJswApprovalStatus},</if>
<if test= "quotOAApprovalStatus != null and quotOAApprovalStatus != ''" > quot_oa_approval_status = #{quotOAApprovalStatus},</if>
</trim>
where quot_id = #{quotId}
</update>
<delete id= "deleteQuotByQuotId" parameterType= "String" >
delete from quot where quot_id = #{quotId}
</delete>
<delete id= "deleteQuotByQuotIds" parameterType= "String" >
delete from quot where quot_id in
<foreach item= "quotId" collection= "array" open= "(" separator= "," close= ")" >
#{quotId}
</foreach>
</delete>
<delete id= "deleteQuotMaterialByQuotIds" parameterType= "String" >
delete from quot_material where quot_id in
<foreach item= "quotId" collection= "array" open= "(" separator= "," close= ")" >
#{quotId}
</foreach>
</delete>
<delete id= "deleteQuotMaterialByQuotId" parameterType= "String" >
delete from quot_material where quot_id = #{quotId}
</delete>
<insert id= "batchQuotMaterial" >
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_perc,mat_perc2,mat_quot_price,mat_quot_tp,mat_quot_allPrice,mat_matprice_diff) values
<foreach item= "item" index= "index" collection= "list" separator= "," >
( #{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.matPerc,jdbcType=DECIMAL} as decimal(18,2)),cast(#{item.matPerc2,jdbcType=DECIMAL} as decimal(18,2)),cast(#{item.matQuotPrice,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.matQuotTp,jdbcType=DECIMAL} as decimal(18,4)),cast(#{item.matQuotAllPrice,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.matMatpriceDiff,jdbcType=DECIMAL} as decimal(18,3)))
</foreach>
</insert>
<insert id= "batchSysOaQuotMaterial" >
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
<foreach item= "item" index= "index" collection= "list" separator= "," >
( #{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)))
</foreach>
</insert>
<select id= "selectQuotByQuotJsqrId" parameterType= "String" resultMap= "QuotQuotMaterialResult" >
select a.quot_id, a.quot_code, a.quot_salesman_bm, a.quot_salesman_name, a.quot_customer_name,
a.quot_salesman_dept_id, a.quot_salesman_dept_name, a.quot_address, 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.create_by, a.create_time, a.update_by, a.update_time,
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,
b.mat_id as sub_mat_id, b.mat_xingh as sub_mat_xingh, b.mat_guig as sub_mat_guig,
b.mat_diany as sub_mat_diany, b.mat_danw as sub_mat_danw, b.mat_sl as sub_mat_sl,
b.quot_id as sub_quot_id
from quot a
left join quot_material b on b.quot_id = a.quot_id
<include refid= "quotJoins" />
where a.quot_jsxz_confirm_id = #{quotJsqrId}
</select>
<select id= "selectQuotByQuotHjId" parameterType= "String" resultMap= "QuotQuotMaterialResult" >
select a.quot_id, a.quot_code, a.quot_salesman_bm, a.quot_salesman_name, a.quot_customer_name,
a.quot_salesman_dept_id, a.quot_salesman_dept_name, a.quot_address, 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.create_by, a.create_time, a.update_by, a.update_time,
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,
b.mat_id as sub_mat_id, b.mat_xingh as sub_mat_xingh, b.mat_guig as sub_mat_guig,
b.mat_diany as sub_mat_diany, b.mat_danw as sub_mat_danw, b.mat_sl as sub_mat_sl,
b.quot_id as sub_quot_id
from quot a
left join quot_material b on b.quot_id = a.quot_id
<include refid= "quotJoins" />
where a.quot_hj_id = #{quotHjId}
</select>
<select id= "getCode" resultType= "String" statementType= "CALLABLE" >
{call GetSerialNo(#{type,mode=IN,jdbcType=VARCHAR})}
</select>
<update id= "setHandle" parameterType= "String" >
update quot set quot_handle = '1' where quot_id = #{quotId}
</update>
<update id= "saveQuotFeedbackExplanation" parameterType= "Quot" >
update quot set quot_feedback_explanation = #{quotFeedbackExplanation} where quot_id = #{quotId}
</update>
2024-08-09 15:39:40 +08:00
<update id= "saveQuotBjyRemark" parameterType= "Quot" >
update quot set quot_bjy_remark = #{quotBjyRemark} where quot_id = #{quotId}
</update>
2024-08-05 17:16:54 +08:00
2024-08-08 11:25:41 +08:00
<select id= "selectStatisticsQuotList" parameterType= "Quot" resultType= "QuotSecDiff" >
<!-- <include refid="selectQuotVo"/>
<where >
<if test= "quotCode != null and quotCode != ''" > and quot_code like concat('%', #{quotCode}, '%')</if>
<if test= "quotCustomerName != null and quotCustomerName != ''" > and quot_customer_name like concat('%', #{quotCustomerName}, '%')</if>
<if test= "quotProject != null and quotProject != ''" > and quot_project like concat('%', #{quotProject}, '%')</if>
<if test= "quotSalesmanName != null and quotSalesmanName != ''" > and quot_salesman_name like concat('%', #{quotSalesmanName}, '%')</if>
<if test= "params.beginTime != null and params.beginTime != ''" > < !– 开始时间检索 – >
and datediff(d, a.quot_quotation_date, #{params.beginTime}) <![CDATA[<=]]> 0
</if>
<if test= "params.endTime != null and params.endTime != ''" > < !– 结束时间检索 – >
and datediff(d, a.quot_quotation_date, #{params.endTime}) <![CDATA[>=]]> 0
</if>
and (a.quot_approval_status = '2' or (a.quot_approval_status = '3' and a.quot_oa_approval_status = '3'))
</where>
order by a.quot_quotation_date desc-->
select a.quot_code quotCode,a.quot_salesman_name quotSalesmanName,a.quot_customer_name quotCustomerName,
a.quot_project quotProject, a.quot_materials_count quotMaterialsCount,
a.quot_total_price quotTotalPrice,a.quot_inquiry_date quotInquiryDate,a.quot_quotation_date quotQuotationDate,
a.quot_check_user_nickname quotCheckUserNickname,
a.create_name createName,a.create_time createTime,
ROUND(
<!-- 询价时间不超过11:30 并且 报价时间超过13:00 报价时间 - 询价时间 - 1.5h -->
(case when a.dayDiff = 0 and a.secDiff1 <![CDATA[>=]]> 0 and a.secDiff2 <![CDATA[>=]]> 0 then a.secDiff1+a.secDiff2
<!-- 询价时间超过11:30 并且 不超过13:00 并且 报价时间超过13:00 报价时间 - 1点 -->
when a.dayDiff = 0 and a.secDiff1 <![CDATA[<]]> 0 and a.secDiff3 <![CDATA[<]]> 0 and a.secDiff2 <![CDATA[>=]]> 0 then a.secDiff2
<!-- 报价时间不超过11:30 报价时间 - 询价时间*//**询价时间超过13:00 报价时间 - 询价时间 -->
when a.dayDiff = 0 then a.secDiff
<!-- 跨一天 减14个小时 -->
when a.dayDiff = 1 then a.secDiff-14*3600
<!-- 跨n,n>1天 减(n - 1)*24个小时 -->
when a.dayDiff > 1 then a.secDiff-(a.dayDiff-1)*24*3600
else 0 end) / 3600.00, 2) secDiff
FROM (
select a.quot_code,a.quot_salesman_name,a.quot_customer_name,a.quot_project, a.quot_materials_count,
a.quot_total_price,a.quot_inquiry_date,a.quot_quotation_date,u2.nick_name quot_check_user_nickname,
u.nick_name create_name,a.create_time,
<!-- 询价时间与11:30的差值 -->
datediff(second,quot_inquiry_date,CONVERT(DATETIME, CONVERT(VARCHAR(10),quot_inquiry_date,111) + ' ' + '11:30:00')) secDiff1,
<!-- 报价时间与13:00的差值 -->
datediff(second,CONVERT(DATETIME, CONVERT(VARCHAR(10),quot_quotation_date,111) + ' ' + '13:00:00'),quot_quotation_date) secDiff2,
<!-- 询价时间与13:00的差值 -->
datediff(second,CONVERT(DATETIME, CONVERT(VARCHAR(10),quot_inquiry_date,111) + ' ' + '13:00:00'),quot_inquiry_date) secDiff3,
datediff(day,quot_inquiry_date,quot_quotation_date) dayDiff,
datediff(second,quot_inquiry_date,quot_quotation_date) secDiff
from quot a
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
2024-08-05 17:16:54 +08:00
<where >
<if test= "quotCode != null and quotCode != ''" > and quot_code like concat('%', #{quotCode}, '%')</if>
<if test= "quotCustomerName != null and quotCustomerName != ''" > and quot_customer_name like concat('%', #{quotCustomerName}, '%')</if>
<if test= "quotProject != null and quotProject != ''" > and quot_project like concat('%', #{quotProject}, '%')</if>
<if test= "quotSalesmanName != null and quotSalesmanName != ''" > and quot_salesman_name like concat('%', #{quotSalesmanName}, '%')</if>
<if test= "params.beginTime != null and params.beginTime != ''" > <!-- 开始时间检索 -->
and datediff(d, a.quot_quotation_date, #{params.beginTime}) <![CDATA[<=]]> 0
</if>
<if test= "params.endTime != null and params.endTime != ''" > <!-- 结束时间检索 -->
and datediff(d, a.quot_quotation_date, #{params.endTime}) <![CDATA[>=]]> 0
</if>
and (a.quot_approval_status = '2' or (a.quot_approval_status = '3' and a.quot_oa_approval_status = '3'))
</where>
2024-08-08 11:25:41 +08:00
)a
2024-08-05 17:16:54 +08:00
order by a.quot_quotation_date desc
</select>
<select id= "selectZbInfo" resultType= "QuotZb" >
select quot_distinguish,
CAST(count * 100.0 / SUM(count) OVER() AS DECIMAL(10, 2)) AS quot_percentage
from (
select quot_distinguish,count(1) count
from quot
<where >
<if test= "params.beginTime != null and params.beginTime != ''" > <!-- 开始时间检索 -->
and datediff(d, quot_quotation_date, #{params.beginTime}) <![CDATA[<=]]> 0
</if>
<if test= "params.endTime != null and params.endTime != ''" > <!-- 结束时间检索 -->
and datediff(d, quot_quotation_date, #{params.endTime}) <![CDATA[>=]]> 0
</if>
and quot_distinguish is not null
and quot_distinguish in ('1','2')
and (quot_approval_status = '2' or (quot_approval_status = '3' and quot_oa_approval_status = '3'))
</where>
group by quot_distinguish) a
</select>
2024-08-07 15:30:48 +08:00
<select id= "selectHandleTime" resultType= "String" >
select ROUND(sum(secDiff)/ 3600.00 /count(1), 2) diff from (
2024-08-08 11:25:41 +08:00
select a.quot_code,
<!-- 询价时间不超过11:30 并且 报价时间超过13:00 报价时间 - 询价时间 - 1.5h -->
case when a.dayDiff = 0 and a.secDiff1 <![CDATA[>=]]> 0 and a.secDiff2 <![CDATA[>=]]> 0 then a.secDiff1+a.secDiff2
<!-- 询价时间超过11:30 并且 不超过13:00 并且 报价时间超过13:00 报价时间 - 1点 -->
when a.dayDiff = 0 and a.secDiff1 <![CDATA[<]]> 0 and a.secDiff3 <![CDATA[<]]> 0 and a.secDiff2 <![CDATA[>=]]> 0 then a.secDiff2
<!-- 报价时间不超过11:30 报价时间 - 询价时间 -->
<!-- 询价时间超过13:00 报价时间 - 询价时间 -->
when a.dayDiff = 0 then a.secDiff
<!-- 跨一天 减14个小时 -->
2024-08-07 15:30:48 +08:00
when a.dayDiff = 1 then a.secDiff-14*3600
2024-08-08 11:25:41 +08:00
<!-- 跨n,n>1天 减(n - 1)*24个小时 -->
when a.dayDiff <![CDATA[>]]> 1 then a.secDiff-(a.dayDiff-1)*24*3600
2024-08-07 15:30:48 +08:00
else 0 end secDiff
from (
2024-08-08 11:25:41 +08:00
select quot_code,quot_inquiry_date, quot_quotation_date,
<!-- 询价时间与11:30的差值 -->
datediff(second,quot_inquiry_date,CONVERT(DATETIME, CONVERT(VARCHAR(10),quot_inquiry_date,111) + ' ' + '11:30:00')) secDiff1,
<!-- 报价时间与13:00的差值 -->
datediff(second,CONVERT(DATETIME, CONVERT(VARCHAR(10),quot_quotation_date,111) + ' ' + '13:00:00'),quot_quotation_date) secDiff2,
<!-- 询价时间与13:00的差值 -->
datediff(second,CONVERT(DATETIME, CONVERT(VARCHAR(10),quot_inquiry_date,111) + ' ' + '13:00:00'),quot_inquiry_date) secDiff3,
2024-08-07 15:30:48 +08:00
datediff(day,quot_inquiry_date,quot_quotation_date) dayDiff,
datediff(second,quot_inquiry_date,quot_quotation_date) secDiff
2024-08-08 11:25:41 +08:00
from quot a
<where >
and quot_approval_status = '2' and quot_jsxz_approval_status='0'
<if test= "params.beginTime != null and params.beginTime != ''" > <!-- 开始时间检索 -->
and datediff(d, quot_quotation_date, #{params.beginTime}) <![CDATA[<=]]> 0
</if>
<if test= "params.endTime != null and params.endTime != ''" > <!-- 结束时间检索 -->
and datediff(d, quot_quotation_date, #{params.endTime}) <![CDATA[>=]]> 0
</if>
</where>
)a
2024-08-07 15:30:48 +08:00
)a
</select>
2024-08-05 17:16:54 +08:00
</mapper>