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.
229 lines
11 KiB
229 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.quotation.mapper.QuotationHeaderMapper">
|
|
|
|
<!-- 表字段 -->
|
|
<sql id="allColumn">
|
|
qh.quotation_header_id,
|
|
qh.site,
|
|
qh.quotation_no,
|
|
qh.quotation_date,
|
|
qh.customer_no,
|
|
dbo.plm_get_customer_desc(qh.site, qh.customer_no) as customerName,
|
|
qh.version_code,
|
|
qh.project_id,
|
|
dbo.plm_get_project_name(qh.site, qh.project_id) as projectName,
|
|
dbo.plm_get_project_final_customer_id(qh.site, qh.project_id) as finalCustomerId,
|
|
dbo.plm_get_customer_desc(qh.site, dbo.plm_get_project_final_customer_id(qh.site, qh.project_id)) as finalCustomerName,
|
|
qh.tracker,
|
|
dbo.plm_get_user_display(qh.site, qh.tracker) as trackerName,
|
|
qh.quoter,
|
|
dbo.plm_get_user_display(qh.site, qh.quoter) as quoterName,
|
|
qh.currency,
|
|
qh.quotation_status,
|
|
qh.remark,
|
|
qh.customer_inquiry_no,
|
|
qh.internal_inquiry_no,
|
|
qh.require_approval,
|
|
qh.approval_status,
|
|
qh.create_by,
|
|
qh.create_time
|
|
</sql>
|
|
<!-- resultMap -->
|
|
<resultMap id="BaseResultMap" type="com.spring.modules.quotation.entity.QuotationHeader">
|
|
<id column="quotation_header_id" jdbcType="INTEGER" property="quotationHeaderId" />
|
|
<result column="site" jdbcType="VARCHAR" property="site" />
|
|
<result column="quotation_no" jdbcType="VARCHAR" property="quotationNo" />
|
|
<result column="quotation_date" jdbcType="TIMESTAMP" property="quotationDate" />
|
|
<result column="customer_no" jdbcType="VARCHAR" property="customerNo" />
|
|
<result column="version_code" jdbcType="VARCHAR" property="versionCode" />
|
|
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
|
<result column="tracker" jdbcType="INTEGER" property="tracker" />
|
|
<result column="quoter" jdbcType="INTEGER" property="quoter" />
|
|
<result column="currency" jdbcType="VARCHAR" property="currency" />
|
|
<result column="quotation_status" jdbcType="VARCHAR" property="quotationStatus" />
|
|
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
|
<result column="customer_inquiry_no" jdbcType="VARCHAR" property="customerInquiryNo" />
|
|
<result column="internal_inquiry_no" jdbcType="VARCHAR" property="internalInquiryNo" />
|
|
<result column="require_approval" jdbcType="VARCHAR" property="requireApproval" />
|
|
<result column="approval_status" jdbcType="VARCHAR" property="approvalStatus" />
|
|
<result column="create_by" jdbcType="INTEGER" property="createBy" />
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
</resultMap>
|
|
|
|
<select id="getQuotationHeaderByPage" resultType="com.spring.modules.quotation.vo.QuotationHeaderVo">
|
|
select
|
|
<include refid="allColumn">
|
|
</include>
|
|
from dbo.quotation_header qh
|
|
<where>
|
|
site = #{site} and qh.active = 'Y'
|
|
<if test="customerNo != null and customerNo != ''">
|
|
AND customer_no like #{customerNo}
|
|
</if>
|
|
<if test="quotationNo != null and quotationNo != ''">
|
|
AND quotation_no like #{quotationNo}
|
|
</if>
|
|
<if test="customerInquiryNo != null and customerInquiryNo != ''">
|
|
AND customer_inquiry_no like #{customerInquiryNo}
|
|
</if>
|
|
<if test="internalInquiryNo != null and internalInquiryNo != ''">
|
|
AND internal_inquiry_no like #{internalInquiryNo}
|
|
</if>
|
|
<if test="quotationStatus != null and quotationStatus != ''">
|
|
AND quotation_status like #{quotationStatus}
|
|
</if>
|
|
<if test="projectId != null and projectId != ''">
|
|
AND project_id like #{projectId}
|
|
</if>
|
|
<if test="startDate != null and startDate != ''">
|
|
AND quotation_date >= #{startDate}
|
|
</if>
|
|
<if test="endDate != null and endDate != ''">
|
|
AND #{endDate} >= quotation_date
|
|
</if>
|
|
<if test="customerName != null and customerName != ''">
|
|
AND dbo.plm_get_customer_desc(site, customer_no) like #{customerName}
|
|
</if>
|
|
<if test="trackerName != null and trackerName != ''">
|
|
AND dbo.plm_get_user_display(site, tracker) like #{trackerName}
|
|
</if>
|
|
<if test="quoterName != null and quoterName != ''">
|
|
AND dbo.plm_get_user_display(site, quoter) like #{quoterName}
|
|
</if>
|
|
<if test="projectName != null and projectName != ''">
|
|
AND dbo.plm_get_project_name(site, project_id) like #{projectName}
|
|
</if>
|
|
<if test="ids != null">
|
|
AND quotation_header_id in (
|
|
<foreach collection="ids" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
order by quotation_header_id desc
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getQuotationHeaderForToolingInfo" resultType="com.spring.modules.quotation.vo.QuotationHeaderVo">
|
|
select
|
|
<include refid="allColumn">
|
|
</include>
|
|
from dbo.quotation_header qh
|
|
<where>
|
|
site = #{site} and qh.active = 'Y' and tool_require_flag='N'
|
|
and quotation_status not in ('草稿')
|
|
and dbo.get_QuotationHeader_ifCanTooling(qh.site,qh.quotation_header_id) ='Y'
|
|
<if test="customerNo != null and customerNo != ''">
|
|
AND customer_no like #{customerNo}
|
|
</if>
|
|
<if test="quotationNo != null and quotationNo != ''">
|
|
AND quotation_no like #{quotationNo}
|
|
</if>
|
|
<if test="customerInquiryNo != null and customerInquiryNo != ''">
|
|
AND customer_inquiry_no like #{customerInquiryNo}
|
|
</if>
|
|
<if test="internalInquiryNo != null and internalInquiryNo != ''">
|
|
AND internal_inquiry_no like #{internalInquiryNo}
|
|
</if>
|
|
<if test="quotationStatus != null and quotationStatus != ''">
|
|
AND quotation_status like #{quotationStatus}
|
|
</if>·
|
|
<if test="projectId != null and projectId != ''">
|
|
AND project_id like #{projectId}
|
|
</if>
|
|
<if test="startDate != null and startDate != ''">
|
|
AND quotation_date >= #{startDate}
|
|
</if>
|
|
<if test="endDate != null and endDate != ''">
|
|
AND #{endDate} >= quotation_date
|
|
</if>
|
|
<if test="customerName != null and customerName != ''">
|
|
AND dbo.plm_get_customer_desc(site, customer_no) like #{customerName}
|
|
</if>
|
|
<if test="trackerName != null and trackerName != ''">
|
|
AND dbo.plm_get_user_display(site, tracker) like #{trackerName}
|
|
</if>
|
|
<if test="quoterName != null and quoterName != ''">
|
|
AND dbo.plm_get_user_display(site, quoter) like #{quoterName}
|
|
</if>
|
|
<if test="projectName != null and projectName != ''">
|
|
AND dbo.plm_get_project_name(site, project_id) like #{projectName}
|
|
</if>
|
|
<if test="ids != null">
|
|
AND quotation_header_id in (
|
|
<foreach collection="ids" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
order by quotation_header_id desc
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 获得报价单号 -->
|
|
<select id="getQuotationNo" resultType="string">
|
|
SELECT
|
|
Right('0000000000' + convert(VARCHAR(10), isnull(max(convert(INT, SUBSTRING(quotation_no, 4, 10))), 0) + 1), 8)
|
|
FROM quotation_header
|
|
WHERE site = #{site}
|
|
</select>
|
|
|
|
<select id="getQuotationHeaderByPagePost" resultType="com.spring.modules.quotation.vo.QuotationHeaderVo">
|
|
select
|
|
<include refid="allColumn">
|
|
</include>
|
|
from dbo.quotation_header qh
|
|
<where>
|
|
site = #{params.site} and qh.active = 'Y'
|
|
<if test="params.customerNo != null and params.customerNo != ''">
|
|
AND customer_no like #{params.customerNo}
|
|
</if>
|
|
<if test="params.quotationNo != null and params.quotationNo != ''">
|
|
AND quotation_no like #{params.quotationNo}
|
|
</if>
|
|
<if test="params.customerInquiryNo != null and params.customerInquiryNo != ''">
|
|
AND customer_inquiry_no like #{params.customerInquiryNo}
|
|
</if>
|
|
<if test="params.internalInquiryNo != null and params.internalInquiryNo != ''">
|
|
AND internal_inquiry_no like #{params.internalInquiryNo}
|
|
</if>
|
|
<if test="params.quotationStatus != null and params.quotationStatus != ''">
|
|
AND quotation_status like #{params.quotationStatus}
|
|
</if>
|
|
<if test="params.projectId != null and params.projectId != ''">
|
|
AND project_id like #{params.projectId}
|
|
</if>
|
|
<if test="params.startDate != null">
|
|
AND quotation_date >= #{params.startDate}
|
|
</if>
|
|
<if test="params.endDate != null">
|
|
AND #{params.endDate} >= quotation_date
|
|
</if>
|
|
<if test="params.customerName != null and params.customerName != ''">
|
|
AND dbo.plm_get_customer_desc(site, customer_no) like #{params.customerName}
|
|
</if>
|
|
<if test="params.trackerName != null and params.trackerName != ''">
|
|
AND dbo.plm_get_user_display(site, tracker) like #{params.trackerName}
|
|
</if>
|
|
<if test="params.quoterName != null and params.quoterName != ''">
|
|
AND dbo.plm_get_user_display(site, quoter) like #{params.quoterName}
|
|
</if>
|
|
<if test="params.projectName != null and params.projectName != ''">
|
|
AND dbo.plm_get_project_name(site, project_id) like #{params.projectName}
|
|
</if>
|
|
<if test="params.versionCode != null and params.versionCode != ''">
|
|
AND version_code = #{params.versionCode}
|
|
</if>
|
|
<if test="params.ids != null and params.ids.size() > 0">
|
|
AND quotation_header_id in (
|
|
<foreach collection="params.ids" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
order by quotation_header_id desc
|
|
</where>
|
|
</select>
|
|
</mapper>
|