You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

290 lines
12 KiB

<?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.spring.modules.quotation.mapper.QuotationInformationMapper">
<!-- 报价信息列表 -->
<select id="quotationInformationSearch" parameterType="com.spring.modules.quotation.vo.QuotationInformationVo" resultType="com.spring.modules.quotation.vo.QuotationInformationVo">
SELECT
site,
quotation_no,
customer_no,
dbo.plm_get_customer_desc(site, customer_no) as customerDesc,
dbo.plm_get_customer_currency(site, customer_no) as customerCurrency,
project_id,
dbo.plm_get_project_name(site, project_id) as projectName,
tracker,
dbo.plm_get_user_display(site, tracker) as trackerName,
quoter,
dbo.plm_get_user_display(site, quoter) as quoterName,
quotation_status,
test_part_no,
dbo.plm_get_test_part_desc(site, test_part_no) as partName,
priority_level,
required_completion_date,
remark,
technical_considerations,
customer_responsible_person,
customer_responsible_person_phone,
create_date,
create_by,
update_date,
update_by,
next_to_do,
actuality_quotation_date,
quotation_result_information,
actuality_submission_date,
submission_method,
submission_remark,
actuality_reply_date,
confirm_results,
confirm_by,
confirm_information,
quotation_result_status,
quotation_batch_no,
quotation_item_no
FROM plm_quotation_information
<where>
site = #{query.site}
<if test="query.quotationNo != null and query.quotationNo != ''">
AND quotation_no = #{query.quotationNo}
</if>
<if test="query.quotationBatchNo != null and query.quotationBatchNo != ''">
AND quotation_batch_no like #{query.quotationBatchNo}
</if>
<if test="query.quotationItemNo != null and query.quotationItemNo != ''">
AND quotation_item_no = #{query.quotationItemNo}
</if>
<if test = "query.customerNo != null and query.customerNo != ''">
AND customer_no like #{query.customerNo}
</if>
<if test = "query.customerDesc != null and query.customerDesc != ''">
AND dbo.plm_get_customer_desc(site, customer_no) like #{query.customerDesc}
</if>
<if test = "query.projectId != null and query.projectId != ''">
AND project_id like #{query.projectId}
</if>
<if test = "query.projectName != null and query.projectName != ''">
AND dbo.plm_get_project_name(site, project_id) like #{query.projectName}
</if>
<if test = "query.trackerName != null and query.trackerName != ''">
AND dbo.plm_get_user_display(site, tracker) like #{query.trackerName}
</if>
<if test = "query.quoterName != null and query.quoterName != ''">
AND dbo.plm_get_user_display(site, quoter) like #{query.quoterName}
</if>
<if test = "query.testPartNo != null and query.testPartNo != ''">
AND test_part_no like #{query.testPartNo}
</if>
<if test = "query.partName != null and query.partName != ''">
AND dbo.plm_get_test_part_desc(site, test_part_no) like #{query.partName}
</if>
<if test = "query.quotationStatus != null and query.quotationStatus != ''">
AND quotation_status = #{query.quotationStatus}
</if>
<if test = "query.priorityLevel != null and query.priorityLevel != ''">
AND priority_level = #{query.priorityLevel}
</if>
<if test="query.startDate != null ">
AND required_completion_date >= #{query.startDate}
</if>
<if test="query.endDate != null ">
AND #{query.endDate} >= required_completion_date
</if>
order by quotation_batch_no desc,quotation_item_no
</where>
</select>
<!--按照orderRef1查询文件文件参数-->
<select id="getFileContentList" resultType="SysOssEntity" parameterType="SysOssEntity">
SELECT
id,
url,
create_date,
file_name,
new_file_name,
create_by,
order_ref1,
order_ref2,
order_ref3,
file_type,
file_suffix,
file_type_code,
file_remark
FROM sys_oss
<where>
<if test="orderRef1 != '' and orderRef1 != null ">
and order_ref1 = #{orderRef1}
</if>
<if test="orderRef2 != '' and orderRef2 != null ">
and order_ref2 = #{orderRef2}
</if>
<!-- <if test="orderRef2 != '' and orderRef2 != null ">-->
<!-- and order_ref2 in-->
<!-- <foreach collection="refArr" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<if test="orderRef3 != '' and orderRef3 != null ">
and order_ref3 = #{orderRef3}
</if>
</where>
</select>
<!-- 获得报价单号 -->
<select id="getQuotationNo" resultType="string" parameterType="QuotationInformationEntity">
SELECT
Right('0000000000' + convert(VARCHAR(10), isnull(max(convert(INT, SUBSTRING(quotation_batch_no, 3, 10))), 0) + 1), 8)
FROM plm_quotation_information
WHERE site = #{site}
</select>
<!-- 获取产品列表 -->
<select id="getProjectPartList" parameterType="PlmProjectPartData" resultType="PlmProjectPartData">
SELECT
ppp.id,
ppp.site,
ppp.test_part_no,
ppp.part_name,
ppp.part_desc,
ppp.part_type,
ppp.project_id,
ppi.project_name,
ppi.customer_id as customerNo,
dbo.plm_get_customer_desc(ppi.site, ppi.customer_id) as customerDesc
FROM plm_project_part as ppp
LEFT JOIN plm_project_info as ppi on ppp.site = ppi.site and ppp.project_id = ppi.project_id
<where>
ppp.site = #{site}
<if test = "projectId != null and projectId != ''">
AND ppp.project_id = #{projectId}
</if>
<if test = "testPartNo != null and testPartNo != ''">
AND ppp.test_part_no LIKE '%' + #{testPartNo}+'%'
</if>
<if test = "partName != null and partName != ''">
AND ppp.part_name LIKE '%' + #{partName}+'%'
</if>
</where>
</select>
<!-- 获取项目信息 -->
<select id="getProjectInformation" parameterType="PlmProjectInfoData" resultType="PlmProjectInfoData">
SELECT
project_id,
ori_project_id,
project_type_db,
project_name,
status,
project_source,
customer_id,
create_by,
create_date,
update_by,
update_date,
priority,
site,
id,
project_desc,
customer_remark,
remark,
dbo.get_projectTeamName(site, project_id, 'owner') projectOwnerName,
dbo.get_projectTeamName(site, project_id, 'manager') ProjectManagerName,
dbo.plm_get_dictDataLabel('project_info_type_db',project_type_db,site) projectType,
dbo.plm_get_projectBaseDesc(status,'project_status') projectStatusDesc,
dbo.plm_get_dictDataLabel('project_info_source',project_source,site) projectSourceDesc,
dbo.plm_get_customer_desc(site,customer_id) customerName,
dbo.plm_get_dictDataLabel('project_info_priority',priority,site) priorityDesc,
need_date,
dbo.get_projectUserRoleName(site,project_id) userRoleName
FROM plm_project_info
where site = #{site} and project_id = #{projectId}
</select>
<!-- 获取客户信息 -->
<select id="getCustomerInformation" parameterType="com.spring.modules.customer.vo.CustomerInformationVo" resultType="com.spring.modules.customer.vo.CustomerInformationVo">
SELECT
site,
customer_no,
customer_desc,
customer_currency,
turnover_of_year,
potential_revenue_of_year,
important_customer,
customer_status,
customer_description,
customer_industry,
company_name,
job_description,
remark,
create_date,
create_by,
update_date,
update_by,
dbo.plm_get_contactName(site, customer_no, 'Y') as contactName,
dbo.plm_get_contactPhoneNumber(site, customer_no, 'Y') as contactPhoneNumber1,
dbo.plm_get_addressName(site, customer_no, 'Y') as addressName,
dbo.plm_get_position(site, customer_no, 'Y') as position,
dbo.plm_get_addressType(site, customer_no, 'Y') as addressType
FROM plm_customer_information
where site = #{site} and customer_no = #{customerNo}
</select>
<!-- 批量删除文件-->
<delete id="batchDeleteQuotationFile" parameterType="com.spring.modules.quotation.vo.SysOssVo">
DELETE FROM sys_oss
<where>
order_ref1 = #{orderRef1} and order_ref2 = #{orderRef2}
<if test = "fileName != null and fileName != ''">
AND file_name = #{fileName}
</if>
</where>
</delete>
<select id="searchQuotationByQuotationNo" resultType="com.spring.modules.quotation.vo.QuotationInformationVo">
SELECT
site,
quotation_no,
customer_no,
dbo.plm_get_customer_desc(site, customer_no) as customerDesc,
dbo.plm_get_customer_currency(site, customer_no) as customerCurrency,
project_id,
dbo.plm_get_project_name(site, project_id) as projectName,
tracker,
dbo.plm_get_user_display(site, tracker) as trackerName,
quoter,
dbo.plm_get_user_display(site, quoter) as quoterName,
quotation_status,
test_part_no,
dbo.plm_get_test_part_desc(site, test_part_no) as partName,
priority_level,
required_completion_date,
remark,
technical_considerations,
customer_responsible_person,
customer_responsible_person_phone,
create_date,
create_by,
update_date,
update_by,
next_to_do,
actuality_quotation_date,
quotation_result_information,
actuality_submission_date,
submission_method,
submission_remark,
actuality_reply_date,
confirm_results,
confirm_by,
confirm_information,
quotation_result_status,
quotation_batch_no,
quotation_item_no
FROM plm_quotation_information
<where>
site = #{site}
<if test = "quotationNo != null and quotationNo != ''">
AND quotation_no like #{quotationNo}
</if>
</where>
</select>
</mapper>