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.
 
 
 
 
 
 

155 lines
7.1 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.proofing.mapper.ProofingInformationMapper">
<!-- 打样信息列表 -->
<select id="proofingInformationSearch" parameterType="com.spring.modules.proofing.vo.ProofingInformationVo" resultType="com.spring.modules.proofing.vo.ProofingInformationVo">
SELECT a.id,
a.site,
proofing_no,
a.project_id,
dbo.plm_get_project_name(a.site, a.project_id) as projectName,
a.test_part_no,
dbo.plm_get_test_part_desc(a.site, a.test_part_no) as partName,
customer_no,
dbo.plm_get_customer_desc(a.site, customer_no) as customerDesc,
tracker,
dbo.plm_get_user_display(a.site, tracker) as trackerName,
engineer,
dbo.plm_get_user_display(a.site, engineer) as engineerName,
approver,
dbo.plm_get_user_display(a.site, approver) as approverName,
priority_level,
proofing_number,
required_delivery_date,
a.remark,
technical_considerations,
is_need_to_send_samples,
send_samples_address,
consignee,
consignee_contact,
actuality_delivery_date,
proofing_result_information,
actuality_send_samples_date,
send_samples_method,
deliver_goods_information,
deliver_goods_remark,
actuality_reply_date,
confirm_results,
confirm_by,
confirm_information,
proofing_status,
proofing_result_status,
next_to_do,
a.create_date,
a.create_by,
a.update_date,
a.update_by,
a.step_id,
reject_flag,
reject_step_id,
d.is_reject,
d.node_id,
d.node_name,
vpp.bu_no,
b.bu_desc
FROM plm_proofing_information as a
left join plm_request_header as prh on a.site = prh.site and prh.menu_id = #{query.menuId}
left join plm_request_node as d on a.site = d.site and prh.classification_no = d.classification_no and
prh.workflow_id = d.workflow_id and a.step_id = d.step_id
left join view_Project_Part vpp
on vpp.site = a.site and vpp.test_part_no = a.test_part_no and vpp.project_id = a.project_id
left join BU b on vpp.bu_no = b.bu_no and a.site = b.site
<where>
a.site = #{query.site}
<if test="query.createBy != null and query.createBy != ''">
and vpp.bu_no in (select bu_No from dbo.Get_Now_BU_chooseAble(a.site, #{query.createBy}))
</if>
<if test="query.customerNo != null and query.customerNo != ''">
AND customer_no like #{query.customerNo}
</if>
<if test="query.proofingNo != null and query.proofingNo != ''">
AND proofing_no like #{query.proofingNo}
</if>
<if test="query.customerDesc != null and query.customerDesc != ''">
AND dbo.plm_get_customer_desc(a.site, customer_no) like #{query.customerDesc}
</if>
<if test="query.projectId != null and query.projectId != ''">
AND a.project_id like #{query.projectId}
</if>
<if test="query.projectName != null and query.projectName != ''">
AND dbo.plm_get_project_name(a.site, a.project_id) like #{query.projectName}
</if>
<if test="query.trackerName != null and query.trackerName != ''">
AND dbo.plm_get_user_display(a.site, tracker) like #{query.trackerName}
</if>
<if test="query.engineerName != null and query.engineerName != ''">
AND dbo.plm_get_user_display(a.site, engineer) like #{query.engineerName}
</if>
<if test="query.testPartNo != null and query.testPartNo != ''">
AND a.test_part_no like #{query.testPartNo}
</if>
<if test="query.partName != null and query.partName != ''">
AND dbo.plm_get_test_part_desc(a.site, a.test_part_no) like #{query.partName}
</if>
<if test="query.proofingStatus != null and query.proofingStatus != ''">
AND proofing_status = #{query.proofingStatus}
</if>
<if test="query.proofingResultStatus != null and query.proofingResultStatus != ''">
AND proofing_result_status = #{query.proofingResultStatus}
</if>
<if test="query.priorityLevel != null and query.priorityLevel != ''">
AND priority_level = #{query.priorityLevel}
</if>
<if test="query.startDate != null">
AND required_delivery_date >= #{query.startDate}
</if>
<if test="query.endDate != null">
AND #{query.endDate} >= required_delivery_date
</if>
<if test="query.buNo != null and query.buNo != ''">
AND vpp.bu_no = #{query.buNo}
</if>
</where>
order by proofing_no desc
</select>
<!-- 获得打样单号 -->
<select id="getProofingNo" resultType="string" parameterType="ProofingInformationEntity">
SELECT
Right('0000000000' + convert(VARCHAR(10), isnull(max(convert(INT, SUBSTRING(proofing_no, 3, 10))), 0) + 1), 8)
FROM plm_proofing_information
WHERE site = #{site}
</select>
<select id="searchDelegateAccess" resultType="com.spring.modules.proofing.vo.ProofingDelegateAccessVo">
select
site,
proofing_no,
delegate_access,
dbo.plm_get_user_display(site, delegate_access) as delegateAccessName
from plm_proofing_delegate_access
<where>
<if test="site != null and site != ''">
and site = #{site}
</if>
<if test="proofingNo != null and proofingNo != ''">
and proofing_no = #{proofingNo}
</if>
</where>
</select>
<select id="searchDelegateAccessByUser" resultType="com.spring.modules.proofing.vo.ProofingDelegateAccessVo">
select a.username as delegateAccess, a.user_display as delegateAccessName
from sys_user a
left join AccessRole b on a.username = b.username and a.site = b.site
where b.role_no = #{roleId} and a.site = #{params.site}
<if test="params.delegateAccess != null and params.delegateAccess != ''">
and a.username like #{params.delegateAccess}
</if>
<if test="params.delegateAccessName != null and params.delegateAccessName != ''">
and a.user_display like #{params.delegateAccessName}
</if>
</select>
</mapper>