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.
 
 
 
 
 
 

310 lines
11 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.quote.mapper.QuoteDetailMapper">
<select id="queryQuoteDetail" resultType="com.spring.modules.quote.entity.QuoteDetail">
select qd.id,
qd.quote_id,
qd.site,
qd.bu_no,
qd.quote_no,
qd.version_no,
qd.item_no,
qd.part_id,
pp.test_part_no as partNo,
pp.part_desc,
qd.internal_inquiry_no,
qd.qty,
qd.quote_count,
qd.status,
qd.part_cost,
qd.adjust_part_cost,
qd.labour_cost,
qd.adjust_labour_cost,
qd.fabricate_cost,
qd.adjust_fabricate_cost,
qd.tool_cost,
qd.adjust_tool_cost,
qd.machine_cost,
qd.adjust_machine_cost,
qd.other_cost,
qd.manage_cost,
qd.total_cost,
qd.profit_rate,
qd.profit_amount,
qd.total_price,
qd.unit_price,
qd.tax_rate,
qd.tax_total_price,
qd.tax_unit_price,
qd.remark,
qd.active,
qd.create_by,
qd.create_date,
qd.update_by,
qd.update_date,
qd.pack_cost,
qd.shipping_cost,
qd.process_time,
qd.yield,
qd.bom_un_yield,
qd.bom_yield,
qd.parent_attrition_rate,
qd.child_attrition_rate,
qd.adjust_bom_un_yield,
qd.quote_cost,
qd.adjust_quote_cost,
qd.quote_total_cost,
qd.quote_profit_rate,
qd.quote_profit_amount,
qd.quote_total_price,
qd.quote_unit_price,
qd.quote_tax_rate,
qd.quote_tax_total_price,
qd.quote_tax_unit_price,
qd.currency1,
dbo.plm_get_dictDataLabel('plm_customer_information_customer_customer_currency', qd.currency1,
qd.site) as currencyDesc1,
qd.exchange_rate1,
qd.currency2,
qd.exchange_rate2,
qd.moq,
qd.currency_total_cost1,
qd.currency_total_cost2,
qd.quote_currency_total_cost1,
qd.quote_currency_total_cost2,
qd.calculated_items,
qd.test_cost,
qd.adjust_test_cost,
qd.else_cost,
qd.adjust_else_cost
from plm_quote_detail qd
left join plm_quote q on qd.quote_id = q.id
left join view_Project_Part pp
on q.project_no = pp.project_id and qd.part_no = pp.test_part_no and qd.site = pp.site
<where>
<if test="id != null">
and qd.id = #{id}
</if>
<if test="quoteId != null">
and qd.quote_id = #{quoteId}
</if>
<if test="quoteNo != null and quoteNo != ''">
and qd.quote_no = #{quoteNo}
</if>
<if test="site != null and site != ''">
and qd.site = #{site}
</if>
<if test="buNo != null and buNo != ''">
and qd.bu_no = #{buNo}
</if>
<if test="versionNo != null and versionNo != ''">
and qd.version_no = #{versionNo}
</if>
</where>
order by qd.id desc
</select>
<select id="queryQuoteDetailByPage" resultType="com.spring.modules.quote.entity.QuoteDetail">
select qd.id,
qd.quote_id,
qd.site,
qd.bu_no,
qd.quote_no,
qd.version_no,
qd.item_no,
qd.part_id,
pp.test_part_no as partNo,
pp.part_desc,
qd.internal_inquiry_no,
qd.qty,
qd.quote_count,
qd.status,
qd.part_cost,
qd.adjust_part_cost,
qd.labour_cost,
qd.adjust_labour_cost,
qd.fabricate_cost,
qd.adjust_fabricate_cost,
qd.tool_cost,
qd.adjust_tool_cost,
qd.machine_cost,
qd.adjust_machine_cost,
qd.other_cost,
qd.manage_cost,
qd.total_cost,
qd.profit_rate,
qd.profit_amount,
qd.total_price,
qd.unit_price,
qd.tax_rate,
qd.tax_total_price,
qd.tax_unit_price,
qd.remark,
qd.active,
qd.create_by,
qd.create_date,
qd.update_by,
qd.update_date,
qd.pack_cost,
qd.shipping_cost,
qd.process_time,
qd.yield,
qd.bom_un_yield,
qd.bom_yield,
qd.parent_attrition_rate,
qd.child_attrition_rate,
qd.adjust_bom_un_yield,
qd.quote_cost,
qd.adjust_quote_cost,
qd.quote_total_cost,
qd.quote_profit_rate,
qd.quote_profit_amount,
qd.quote_total_price,
qd.quote_unit_price,
qd.quote_tax_rate,
qd.quote_tax_total_price,
qd.quote_tax_unit_price,
qd.currency1,
dbo.plm_get_dictDataLabel('plm_customer_information_customer_customer_currency', qd.currency1,
qd.site) as currencyDesc1,
qd.exchange_rate1,
qd.currency2,
qd.exchange_rate2,
qd.moq,
qd.currency_total_cost1,
qd.currency_total_cost2,
qd.quote_currency_total_cost1,
qd.quote_currency_total_cost2,
qd.calculated_items,
qd.test_cost,
qd.adjust_test_cost,
qd.else_cost,
qd.adjust_else_cost
from plm_quote_detail qd
left join plm_quote q on qd.quote_id = q.id
left join view_Project_Part pp
on q.project_no = pp.project_id and qd.part_no = pp.test_part_no and qd.site = pp.site
<where>
<if test="params.quoteId != null">
and qd.quote_id = #{params.quoteId}
</if>
<if test="params.quoteNo != null and params.quoteNo != ''">
and qd.quote_no = #{params.quoteNo}
</if>
<if test="params.site != null and params.site != ''">
and qd.site = #{params.site}
</if>
<if test="params.buNo != null and params.buNo != ''">
and qd.bu_no = #{params.buNo}
</if>
<if test="params.versionNo != null and params.versionNo != ''">
and qd.version_no = #{params.versionNo}
</if>
</where>
order by qd.id desc
</select>
<select id="queryItemNo" resultType="java.lang.Integer">
select ISNULL(max(item_no),0)+1 from plm_quote_detail where quote_id = #{quoteId}
</select>
<select id="queryQuoteDetailByInquiry" resultType="com.spring.modules.quote.entity.QuoteDetail">
select qd.id,
qd.quote_id,
qd.site,
qd.bu_no,
qd.quote_no,
qd.version_no,
qd.item_no,
qd.part_id,
pp.test_part_no as partNo,
pp.part_desc,
qd.internal_inquiry_no,
qd.qty,
qd.quote_count,
qd.status,
qd.part_cost,
qd.adjust_part_cost,
qd.labour_cost,
qd.adjust_labour_cost,
qd.fabricate_cost,
qd.adjust_fabricate_cost,
qd.tool_cost,
qd.adjust_tool_cost,
qd.machine_cost,
qd.adjust_machine_cost,
qd.other_cost,
qd.manage_cost,
qd.total_cost,
qd.profit_rate,
qd.profit_amount,
qd.total_price,
qd.unit_price,
qd.tax_rate,
qd.tax_total_price,
qd.tax_unit_price,
qd.remark,
qd.active,
qd.create_by,
qd.create_date,
qd.update_by,
qd.update_date,
qd.pack_cost,
qd.shipping_cost,
qd.process_time,
qd.yield,
qd.bom_un_yield,
qd.bom_yield,
qd.parent_attrition_rate,
qd.child_attrition_rate,
qd.adjust_bom_un_yield,
qd.quote_cost,
qd.adjust_quote_cost,
qd.quote_total_cost,
qd.quote_profit_rate,
qd.quote_profit_amount,
qd.quote_total_price,
qd.quote_unit_price,
qd.quote_tax_rate,
qd.quote_tax_total_price,
qd.quote_tax_unit_price,
qd.currency1,
dbo.plm_get_dictDataLabel('plm_customer_information_customer_customer_currency', qd.currency1,
qd.site) as currencyDesc1,
qd.exchange_rate1,
qd.currency2,
qd.exchange_rate2,
qd.moq,
qd.currency_total_cost1,
qd.currency_total_cost2,
qd.quote_currency_total_cost1,
qd.quote_currency_total_cost2,
q.quote_date,
q.quote_version_no,
q.inside_inquiry_no,
qd.calculated_items,
qd.test_cost,
qd.adjust_test_cost,
qd.else_cost,
qd.adjust_else_cost
from plm_quote_detail qd
left join plm_quote q on qd.quote_id = q.id
left join view_Project_Part pp
on q.project_no = pp.project_id and qd.part_no = pp.test_part_no and qd.site = pp.site
<where>
<if test="site != null and site != ''">
and qd.site = #{site}
</if>
<if test="internalInquiryNo != null and internalInquiryNo != ''">
and q.inside_inquiry_no = #{internalInquiryNo}
</if>
<if test="projectNo != null and projectNo != ''">
and q.project_no = #{projectNo}
</if>
<if test="partNo != null and partNo != ''">
and qd.part_no = #{partNo}
</if>
</where>
</select>
</mapper>