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.
642 lines
28 KiB
642 lines
28 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.project.dao.ProjectDao">
|
|
|
|
<select id="selectProjectInfoList" 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,parent_project_no,
|
|
final_customer_id,dbo.plm_get_dictDataLabel('finalCustomer',final_customer_id,site) finalCustomerName,productSet
|
|
FROM plm_project_info
|
|
<where>
|
|
<if test="site != null and site != ''">
|
|
AND site = #{site}
|
|
</if>
|
|
<if test="projectId != null and projectId != ''">
|
|
AND project_id like #{projectId}
|
|
</if>
|
|
<if test="projectName != null and projectName != ''">
|
|
AND project_name like #{projectName}
|
|
</if>
|
|
<if test="customerId != null and customerId != ''">
|
|
AND customer_id like #{customerId}
|
|
</if>
|
|
</where>
|
|
order by LEFT(project_id, CHARINDEX('-', project_id + '-') - 1) desc
|
|
</select>
|
|
|
|
<select id="projectInfoSearch" 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,parent_project_no,customer_project_no,
|
|
final_customer_id,dbo.plm_get_dictDataLabel('finalCustomer',final_customer_id,site) finalCustomerName,productSet
|
|
FROM plm_project_info
|
|
<where>
|
|
<if test="query.id != null">
|
|
AND id = #{query.id}
|
|
</if>
|
|
<if test="query.customerProjectNo != null and query.customerProjectNo != ''">
|
|
AND customer_project_no like #{query.customerProjectNo}
|
|
</if>
|
|
<if test="query.site != null and query.site != ''">
|
|
AND site = #{query.site}
|
|
</if>
|
|
<if test="query.projectId != null and query.projectId != ''">
|
|
AND project_id like #{query.projectId}
|
|
</if>
|
|
<if test="query.projectType != null and query.projectType != ''">
|
|
AND plm_project_info.project_type_db like #{query.projectType}
|
|
</if>
|
|
<if test="query.projectOwnerName != null and query.projectOwnerName != ''">
|
|
AND dbo.get_projectTeamName(site,project_id,'owner') like #{query.projectOwnerName}
|
|
</if>
|
|
<if test="query.userName != null and query.userName != '' and query.userName != 'admin'">
|
|
AND project_id in ( select project_id from AccessProject where site=#{query.site} and username=#{query.userName} and searchFlag='Y' )
|
|
</if>
|
|
<if test="query.priority != null and query.priority != ''">
|
|
AND plm_project_info.priority = #{query.priority}
|
|
</if>
|
|
<if test="query.customerName != null and query.customerName != ''">
|
|
AND dbo.plm_get_customer_desc(site,customer_id) like #{query.customerName}
|
|
</if>
|
|
<if test="query.customerId != null and query.customerId != ''">
|
|
AND plm_project_info.customer_Id like #{query.customerId}
|
|
</if>
|
|
</where>
|
|
order by LEFT(project_id, CHARINDEX('-', project_id + '-') - 1) desc
|
|
</select>
|
|
|
|
<select id="checkPlmProjectInfoData" 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,parent_project_no,productSet
|
|
FROM plm_project_info where id=#{id}
|
|
</select>
|
|
|
|
<select id="searchOperatorWithSite" resultType="com.spring.modules.project.data.PlmOperatorData">
|
|
select operator_id,operator_name from plm_operator u
|
|
<if test="roleNo != null and roleNo != ''">
|
|
inner join AccessRole r on u.site = r.site and u.operator_id = r.username and role_no = #{roleNo}
|
|
</if>
|
|
<where>
|
|
and u.site=#{site}
|
|
<if test="operatorId != null and operatorId != ''">
|
|
AND u.operator_id like #{operatorId}
|
|
</if>
|
|
</where>
|
|
order by operator_id desc
|
|
</select>
|
|
|
|
<select id="searchProjectTeam" resultType="PlmOperatorData">
|
|
select b.operator_id,b.operator_name
|
|
from plm_project_team a left join plm_operator b on a.site=b.site and a.operator_id=b.operator_id
|
|
where a.site=#{site} AND a.project_id=#{projectId} and b.operator_id is not null and type=#{type}
|
|
</select>
|
|
<select id="searchProjectTeamStr" resultType="String">
|
|
select b.operator_id
|
|
from plm_project_team a left join plm_operator b on a.site=b.site and a.operator_id=b.operator_id
|
|
where a.site=#{site} AND a.project_id=#{projectId} and b.operator_id is not null and type=#{type}
|
|
</select>
|
|
|
|
<select id="searchUserRoll" resultType="PlmUserRoleData">
|
|
select
|
|
a.username,
|
|
a.user_display,
|
|
c.site,
|
|
c.project_id,
|
|
isnull(c.searchFlag,'N') searchFlag,
|
|
isnull(c.updateFlag,'N') updateFlag,
|
|
isnull(c.downFlag,'N') downFlag,
|
|
isnull(c.deleteFlag,'N') deleteFlag
|
|
from sys_user a
|
|
left join AccessSite b on a.username = b.UserID
|
|
left join AccessProject c on a.username = c.username and c.project_id = #{projectId} and c.site = b.site
|
|
left join AccessRole e on a.username=e.username and e.site= #{site}
|
|
<where>
|
|
and e.role_no='R001'
|
|
<if test="site != null and site != ''">
|
|
and b.site = #{site}
|
|
</if>
|
|
<if test="username != null and username != ''">
|
|
and a.username like #{username}
|
|
</if>
|
|
<if test="userDisplay != null and userDisplay != ''">
|
|
and a.user_display like #{userDisplay}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<insert id="saveProjectInfo">
|
|
insert into plm_project_info
|
|
(project_id,ori_project_id,project_type_db,project_name,status,project_source,customer_id,create_by,
|
|
create_date,priority,site,project_desc,customer_remark,remark,need_date,parent_project_no,final_customer_id,
|
|
customer_Project_No,productSet ) values
|
|
(#{projectId},#{projectId},#{projectTypeDb},#{projectName},#{status},#{projectSource},#{customerId},
|
|
#{createBy},GetDate(),#{priority},#{site},#{projectDesc},#{customerRemark},#{remark},#{needDate},#{parentProjectNo}
|
|
,#{finalCustomerId},#{customerProjectNo},#{productSet})
|
|
|
|
</insert>
|
|
<update id="updateProjectInfo">
|
|
update plm_project_info set project_type_db=#{projectTypeDb},project_name=#{projectName},project_source=#{projectSource},status=#{status},
|
|
customer_id=#{customerId},priority=#{priority},project_desc=#{projectDesc},customer_remark=#{customerRemark},remark=#{remark},need_date=#{needDate},
|
|
update_by=#{updateBy},update_date=GetDate(),parent_project_no = #{parentProjectNo},final_customer_id=#{finalCustomerId},productSet=#{productSet}
|
|
,customer_Project_No=#{customerProjectNo} where id=#{id}
|
|
</update>
|
|
<delete id="deletePlmProjectTeam">
|
|
delete from plm_project_team where site=#{site} and project_id=#{projectId}
|
|
</delete>
|
|
|
|
<delete id="deleteUserRoleList">
|
|
delete from AccessProject where site=#{site} and project_id=#{projectId}
|
|
</delete>
|
|
|
|
<insert id="saveProjectTeams">
|
|
insert into plm_project_team (site,project_id,operator_id,type) values
|
|
(#{site},#{projectId},#{operatorId},#{type})
|
|
</insert>
|
|
|
|
<insert id="savePlmUserRoleData">
|
|
insert into AccessProject(site,project_id,username,searchFlag,updateFlag,downFlag,deleteFlag) values
|
|
(#{site},#{projectId},#{username},#{searchFlag},#{updateFlag},#{downFlag},#{deleteFlag})
|
|
</insert>
|
|
|
|
<select id="getCustomerContactData" resultType="PlmProjectContactData">
|
|
select b.site,b.customer_no,b.contact_name,b.contact_landline_number,b.contact_phone_number1,b.contact_phone_number2,
|
|
b.contact_phone_number3,b.position,b.mailbox,b.primary_contact,b.contact_status,b.remark,b.create_date,b.create_by,
|
|
b.update_date,b.update_by,b.contact_id,a.customer_id
|
|
from plm_project_contact a left join plm_customer_contact b on a.site=b.site and a.customer_id=b.customer_no and a.contact_id=b.contact_id
|
|
where a.site=#{site} and a.project_id=#{projectId} and a.customer_id=#{customerId} and b.contact_status='启用'
|
|
</select>
|
|
|
|
<select id="getPlmProjectContactString" resultType="String">
|
|
select b.contact_id
|
|
from plm_project_contact a left join plm_customer_contact b on a.site=b.site and a.customer_id=b.customer_no and a.contact_id=b.contact_id
|
|
where a.site=#{site} and a.project_id=#{projectId} and a.customer_id=#{customerId} and b.contact_status='启用'
|
|
</select>
|
|
|
|
<select id="getCustomerContactString" resultType="PlmProjectContactData">
|
|
select contact_id,contact_name from plm_customer_contact
|
|
where site=#{site} and customer_no=#{customerId} and contact_status='启用'
|
|
</select>
|
|
|
|
<!-- <select id="getPlmProjectContactString2" resultType="PlmProjectContactData">-->
|
|
<!-- select-->
|
|
<!-- a.contact_id,-->
|
|
<!-- b.contact_name-->
|
|
<!-- from plm_project_contact a-->
|
|
<!-- left join plm_customer_contact b on a.site = b.site and a.customer_id = b.customer_no and a.contact_id = b.contact_id-->
|
|
<!-- <where>-->
|
|
<!-- a.site = #{site} and a.customer_id = #{customerId} AND b.contact_id is null-->
|
|
<!-- </where>-->
|
|
<!-- </select>-->
|
|
|
|
<select id="getPlmProjectContactString2" resultType="PlmProjectContactData" parameterType="PlmProjectInfoData">
|
|
select
|
|
a.site,
|
|
a.contact_id,
|
|
a.contact_name
|
|
from plm_customer_contact a
|
|
left join plm_project_contact b on a.site = b.site and a.customer_no = b.customer_id and a.contact_id = b.contact_id and b.project_id = #{projectId}
|
|
<where>
|
|
a.site = #{site} and a.customer_no = #{customerId} AND b.project_id is null
|
|
<if test = "contactName != null and contactName != ''">
|
|
AND a.contact_name LIKE #{contactName}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getCustomerContactString2" resultType="PlmProjectContactData" parameterType="PlmProjectInfoData">
|
|
select
|
|
b.site,
|
|
b.contact_id,
|
|
b.contact_name
|
|
from plm_project_contact as a
|
|
left join plm_customer_contact as b on a.site = b.site and a.customer_id = b.customer_no and a.contact_id = b.contact_id
|
|
where a.project_id = #{projectId} and a.site = #{site}
|
|
</select>
|
|
|
|
<select id="checkProjectContact" resultType="PlmProjectContactData" parameterType="ProjectContactData">
|
|
select
|
|
site,
|
|
project_id,
|
|
customer_id,
|
|
contact_id
|
|
from plm_project_contact
|
|
where site = #{site} and project_id = #{projectId} and customer_id = #{customerId} and contact_id = #{contactId}
|
|
</select>
|
|
|
|
<select id="checkCustomerContact" resultType="PlmProjectContactData" parameterType="ProjectContactData">
|
|
SELECT
|
|
site,
|
|
customer_no as customerId,
|
|
contact_id
|
|
FROM plm_customer_contact
|
|
where site = #{site} and customer_no = #{customerId} and contact_id = #{contactId}
|
|
</select>
|
|
|
|
<insert id="addContact" parameterType="ProjectContactData">
|
|
insert into plm_project_contact
|
|
(site, project_id, customer_id, contact_id)
|
|
values (#{site}, #{projectId}, #{customerId}, #{contactId})
|
|
</insert>
|
|
|
|
<delete id="deleteContact" parameterType="ProjectContactData">
|
|
delete from plm_project_contact
|
|
where site = #{site} and project_id = #{projectId} and customer_id = #{customerId} and contact_id = #{contactId}
|
|
</delete>
|
|
|
|
<delete id="deleteProjectContact">
|
|
delete from plm_project_contact where site=#{site} and project_id=#{projectId}
|
|
</delete>
|
|
|
|
<insert id="saveProjectContactList">
|
|
insert into plm_project_contact (site,project_id,contact_id,customer_id)
|
|
values (#{site},#{projectId},#{contactId},#{customerId})
|
|
</insert>
|
|
<delete id="deleteProjectInfo">
|
|
delete from plm_project_info where site=#{site} and project_id=#{projectId}
|
|
</delete>
|
|
<delete id="deleteProjectPart">
|
|
delete from plm_project_part where site=#{site} and project_id=#{projectId}
|
|
</delete>
|
|
|
|
<select id="getProjectInfoPartList" resultType="PlmProjectPartData">
|
|
select
|
|
a.id,
|
|
a.site,
|
|
a.project_id,
|
|
a.test_part_no,
|
|
b.family_id as partType,
|
|
b.part_desc,
|
|
dbo.get_family_name(b.site, b.family_id) as partTypeDesc,
|
|
b.code_no,
|
|
dbo.get_code_desc(b.site, b.code_no, 'IP') as codeDesc,
|
|
b.group_id,
|
|
dbo.get_group_name(b.site, b.group_id) as groupName,
|
|
b.product_group_id1,
|
|
dbo.get_product_group_name(b.site, b.product_group_id1, '1') as productGroupName1,
|
|
b.product_group_id2,
|
|
dbo.get_product_group_name(b.site, b.product_group_id2, '2') as productGroupName2,
|
|
b.remark,
|
|
b.create_date,
|
|
b.create_by,
|
|
b.update_date,
|
|
b.update_by,
|
|
c.customer_id,
|
|
b.status,
|
|
b.plm_part_no,
|
|
case when b.status = 'Y' or (b.ifs_part_no is not null and b.ifs_part_no <![CDATA[<>]]> '') then '正式物料' else '临时物料' end as statusDesc,
|
|
a.final_part_no,
|
|
a.part_no_source,
|
|
a.unit_price,
|
|
a.tax_unit_price,
|
|
a.bu_no,
|
|
dbo.plm_get_bu_desc(a.site,a.bu_no) buDesc,
|
|
d.customer_part_no
|
|
from plm_project_part as a
|
|
LEFT JOIN part as b on a.site = b.site and a.test_part_no = b.part_no
|
|
left join plm_project_info as c on a.site = c.site and a.project_id = c.project_id
|
|
left join plm_customer_part_info as d on c.site = d.site and c.customer_id = d.customer_no and a.test_part_no = d.part_no
|
|
where a.site = #{query.site} and a.project_id = #{query.projectId}
|
|
</select>
|
|
|
|
<select id="checkProjectInfoPartList" resultType="PlmProjectPartData">
|
|
select top 1
|
|
id,
|
|
site,
|
|
project_id,
|
|
test_part_no,
|
|
part_type,
|
|
part_desc,
|
|
part_spec,
|
|
material_number,
|
|
remark,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
part_name,
|
|
update_by,
|
|
dbo.get_family_name(site, part_type) as partTypeDesc,
|
|
final_part_no,
|
|
code_no,
|
|
dbo.get_code_desc(site, code_no, 'IP') as codeDesc,
|
|
group_id,
|
|
dbo.get_group_name(site, group_id) as groupName,
|
|
product_group_id1,
|
|
dbo.get_product_group_name(site, product_group_id1, '1') as productGroupName1,
|
|
product_group_id2,
|
|
dbo.get_product_group_name(site, product_group_id2, '2') as productGroupName2
|
|
from view_Project_Part where site=#{site} and test_part_no=#{testPartNo}
|
|
</select>
|
|
<select id="getTestPartNo" resultType="String">
|
|
select top 1 #{projectId}+'-'+ Right( '0000'+ convert(VARCHAR(10), isnull(max(convert(INT,RIGHT(test_part_no, 4))),0)+1) ,4) from view_Project_Part
|
|
where site=#{site} and project_id=#{projectId}
|
|
</select>
|
|
<insert id="saveProjectPart">
|
|
insert into plm_project_part
|
|
(site,project_id,
|
|
test_part_no,
|
|
part_type,
|
|
part_desc,
|
|
part_spec,
|
|
material_number,
|
|
remark,
|
|
create_date,
|
|
create_by,
|
|
part_name,
|
|
code_no,
|
|
group_id,
|
|
product_group_id1,
|
|
product_group_id2)
|
|
values
|
|
(#{site},
|
|
#{projectId},
|
|
#{testPartNo},
|
|
#{partType},
|
|
#{partDesc},
|
|
#{partSpec},
|
|
#{materialNumber},
|
|
#{remark},
|
|
GetDate(),
|
|
#{username},
|
|
#{partName},
|
|
#{codeNo},
|
|
#{groupId},
|
|
#{productGroupId1},
|
|
#{productGroupId2})
|
|
</insert>
|
|
<update id="updateProjectPart">
|
|
update plm_project_part
|
|
set part_type=#{partType},
|
|
part_desc=#{partDesc},
|
|
part_spec=#{partSpec},
|
|
material_number=#{materialNumber},
|
|
remark=#{remark},
|
|
update_date=GetDate(),
|
|
update_by=#{username},
|
|
part_name=#{partName},
|
|
code_no=#{codeNo},
|
|
group_id = #{groupId},
|
|
product_group_id1 = #{productGroupId1},
|
|
product_group_id2 = #{productGroupId2}
|
|
where id=#{id}
|
|
</update>
|
|
|
|
<delete id="deleteProjectPartWithId">
|
|
delete from plm_project_part where id=#{id}
|
|
</delete>
|
|
|
|
<select id="getPlmToolPurchaseRequestDataByProject" resultType="PlmToolPurchaseRequestData">
|
|
select id,site,order_no,test_part_no,project_id,tool_id,type,reason,tool_offset,qty,party_a,supplier_id,price,tool_cost,
|
|
all_cost,IFS_PR_No,po_number,remark,create_by,create_date,update_by,update_date,planner,applicant,dbo.get_userDisPlay(applicant) applicantName,
|
|
dbo.get_userDisPlay(planner) plannerName,dbo.plm_get_test_part_name(site,test_part_no) partName
|
|
,status ,dbo.plm_get_projectBaseDesc(status,'purchaseRequest_status') statusDesc
|
|
from plm_tool_purchase_request
|
|
where site=#{site} and project_id=#{projectId}
|
|
</select>
|
|
|
|
<insert id="savePlmToolPurchaseRequestData">
|
|
insert into plm_tool_purchase_request (site,order_no,test_part_no,project_id,tool_id,type,status,reason,tool_offset,qty,party_a,supplier_id,price,tool_cost,
|
|
all_cost,IFS_PR_No,po_number,remark,create_by,create_date,planner,applicant) values
|
|
(#{site},#{orderNo},#{testPartNo},#{projectId},#{toolId},#{type},#{status},#{reason},#{toolOffset},#{qty},#{partyA},#{supplierId},${price},#{toolCost},
|
|
#{allCost},#{ifsPrNo},#{poNumber},#{remark},#{username},GetDate(),#{planner},#{applicant})
|
|
</insert>
|
|
|
|
<select id="searchBIAddress" resultType="BiAddress">
|
|
select top 1 menu_id ,address from BI_Address where menu_id=#{menuId}
|
|
</select>
|
|
|
|
<select id="getProjectUserRole" resultType="PlmUserRoleData">
|
|
select site,project_id,username,searchFlag,updateFlag,downFlag,deleteFlag
|
|
from AccessProject where site=#{site} and project_id=#{projectId} and username=#{username}
|
|
|
|
</select>
|
|
|
|
<select id="getProjectPartList" resultType="com.spring.modules.project.data.PlmProjectPartData">
|
|
select vpp.id,
|
|
vpp.site,
|
|
vpp.project_id,
|
|
vpp.test_part_no,
|
|
vpp.part_type,
|
|
vpp.part_desc,
|
|
vpp.part_spec,
|
|
vpp.material_number,
|
|
vpp.remark,
|
|
vpp.create_date,
|
|
vpp.create_by,
|
|
vpp.update_date,
|
|
vpp.part_name,
|
|
vpp.update_by,
|
|
dbo.get_family_name(vpp.site, vpp.part_type) as partTypeDesc,
|
|
vpp.final_part_no,
|
|
vpp.code_no,
|
|
dbo.get_code_desc(vpp.site, vpp.code_no, 'IP') as codeDesc,
|
|
vpp.group_id,
|
|
dbo.get_group_name(vpp.site, vpp.group_id) as groupName,
|
|
vpp.product_group_id1,
|
|
dbo.get_product_group_name(vpp.site, vpp.product_group_id1, '1') as productGroupName1,
|
|
vpp.product_group_id2,
|
|
dbo.get_product_group_name(vpp.site, vpp.product_group_id2, '2') as productGroupName2,
|
|
vpp.um_id,
|
|
vpp.type,
|
|
pcpi.customer_part_no
|
|
from view_Project_Part vpp
|
|
left join plm_project_info ppi on vpp.site = ppi.site and vpp.project_id = ppi.project_id
|
|
left join plm_customer_part_info pcpi on vpp.site = pcpi.site and ppi.customer_id = pcpi.customer_no and vpp.test_part_no = pcpi.part_no
|
|
where vpp.site = #{params.site}
|
|
<if test="params.projectId != null and params.projectId != ''">
|
|
and vpp.project_id = #{params.projectId}
|
|
</if>
|
|
<if test="params.testPartNo != null and params.testPartNo != ''">
|
|
and vpp.test_part_no like #{params.testPartNo}
|
|
</if>
|
|
<if test="params.partDesc != null and params.partDesc != ''">
|
|
and vpp.part_desc like #{params.partDesc}
|
|
</if>
|
|
<if test="params.finalPartNo != null and params.finalPartNo != ''">
|
|
and vpp.final_part_no like #{params.finalPartNo}
|
|
</if>
|
|
<if test="params.customerPartNo != null and params.customerPartNo != ''">
|
|
and pcpi.customer_part_no like #{params.customerPartNo}
|
|
</if>
|
|
<if test="params.partType != null and params.partType != ''">
|
|
and vpp.type = #{params.partType}
|
|
</if>
|
|
</select>
|
|
<select id="getProjectPart" resultType="com.spring.modules.project.data.PlmProjectPartData">
|
|
select
|
|
id,
|
|
site,
|
|
project_id,
|
|
test_part_no,
|
|
part_type,
|
|
part_desc,
|
|
part_spec,
|
|
material_number,
|
|
remark,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
part_name,
|
|
update_by,
|
|
dbo.get_family_name(site, part_type) as partTypeDesc,
|
|
final_part_no,
|
|
code_no,
|
|
dbo.get_code_desc(site, code_no, 'IP') as codeDesc,
|
|
group_id,
|
|
dbo.get_group_name(site, group_id) as groupName,
|
|
product_group_id1,
|
|
dbo.get_product_group_name(site, product_group_id1, '1') as productGroupName1,
|
|
product_group_id2,
|
|
dbo.get_product_group_name(site, product_group_id2, '2') as productGroupName2
|
|
from view_Project_Part where site=#{site}
|
|
<if test="testPartNo != null and testPartNo != ''">
|
|
and test_part_no = #{testPartNo}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getProjectData" resultType="com.spring.modules.project.entity.PlmProjectInfo">
|
|
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,need_date,parent_project_no,final_customer_id
|
|
from plm_project_info where site=#{site} and project_id=#{projectId}
|
|
</select>
|
|
|
|
<select id="projectInfoPartSearch" resultType="PlmProjectPartData">
|
|
select
|
|
a.id,
|
|
a.site,
|
|
a.bu_no,
|
|
a.project_id,
|
|
a.test_part_no,
|
|
a.final_part_no,
|
|
a.material_number,
|
|
a.part_name,
|
|
a.part_desc,
|
|
a.part_spec,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
a.code_no,
|
|
dbo.get_code_desc(a.site, a.code_no, 'IP') as codeDesc,
|
|
a.um_id,
|
|
a.group_id,
|
|
dbo.get_group_name(a.site, a.group_id) as groupName,
|
|
a.part_type,
|
|
dbo.get_family_name(a.site, a.part_type) as partTypeDesc,
|
|
a.type,
|
|
a.product_group_id1,
|
|
dbo.get_product_group_name(a.site, a.product_group_id1, '1') as productGroupName1,
|
|
a.product_group_id2,
|
|
dbo.get_product_group_name(a.site, a.product_group_id2, '2') as productGroupName2,
|
|
a.remark,
|
|
b.customer_id,
|
|
c.customer_part_no,
|
|
b.final_customer_id
|
|
from view_Project_Part as a
|
|
left join plm_project_info as b on a.site = b.site and a.project_id = b.project_id
|
|
left join plm_customer_part_info as c on b.site = c.site and b.customer_id = c.customer_no and a.test_part_no = c.part_no
|
|
where a.site = #{query.site}
|
|
<if test = "query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.customerPartNo != null and query.customerPartNo != ''">
|
|
AND c.customer_part_no like #{query.customerPartNo}
|
|
</if>
|
|
<if test = "query.finalPartNo != null and query.finalPartNo != ''">
|
|
AND a.final_part_no like #{query.finalPartNo}
|
|
</if>
|
|
<if test="query.testPartNo != null and query.testPartNo != ''">
|
|
and a.test_part_no like #{query.testPartNo}
|
|
</if>
|
|
<if test="query.projectId != null and query.projectId != ''">
|
|
and a.project_id like #{query.projectId}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="queryProject" resultType="com.spring.modules.project.data.PlmProjectInfoData">
|
|
select project_id,
|
|
project_name,
|
|
final_customer_id,
|
|
dbo.plm_get_dictDataLabel('finalCustomer',final_customer_id,site) finalCustomerName
|
|
from plm_project_info
|
|
where site = #{site}
|
|
and project_id = #{projectId}
|
|
and customer_id = #{customerId}
|
|
</select>
|
|
|
|
<select id="queryProjectPart" resultType="com.spring.modules.project.entity.PlmProjectPart">
|
|
select
|
|
project_id,
|
|
test_part_no,
|
|
part_desc
|
|
from
|
|
view_Project_Part
|
|
where site = #{site} and project_id = #{projectId} and test_part_no = #{testPartNo}
|
|
</select>
|
|
|
|
<select id="getProjectPartNewBm" resultType="PlmProjectPartData">
|
|
select
|
|
site,
|
|
project_id,
|
|
test_part_no,
|
|
part_desc,
|
|
now_bm,
|
|
final_part_no
|
|
from
|
|
plm_project_part
|
|
where site = #{site} and (test_part_no = #{testPartNo} or final_part_no= #{testPartNo}) and now_bm is not null
|
|
</select>
|
|
|
|
<select id="queryProjectCustomer" resultType="com.spring.modules.customer.vo.CustomerInformationVo">
|
|
select top 1 pci.site,
|
|
pci.customer_no,
|
|
pci.customer_desc,
|
|
dbo.plm_get_dictDataLabel('plm_customer_information_customer_customer_currency', pci.customer_currency,pci.site) as customer_currency,
|
|
pci.turnover_of_year,
|
|
pci.potential_revenue_of_year,
|
|
pci.customer_status,
|
|
pci.customer_type,
|
|
dbo.plm_get_dictDataLabel('plm_customer_information_customer_industry', pci.customer_industry,
|
|
pci.site) as customer_industry,
|
|
case
|
|
when pci.customer_status = 'Y' then '启用'
|
|
when pci.customer_status = 'N' then '停用'
|
|
else '' end as customerStatusDesc,
|
|
pci.customer_description,
|
|
dbo.plm_get_dictDataLabel('plm_customer_information_important_customer', pci.important_customer, pci.site) as important_customer,
|
|
pci.customer_group
|
|
from plm_project_info ppi
|
|
left join dbo.plm_customer_information pci on ppi.customer_id = pci.customer_no
|
|
where ppi.project_id = #{projectId} and ppi.site = #{site}
|
|
</select>
|
|
|
|
<select id="queryProjectFinalCustomer" resultType="com.spring.modules.customer.entity.CustomerInformationEntity">
|
|
select top 1 pci.site,
|
|
pci.customer_no,
|
|
pci.customer_desc,
|
|
dbo.plm_get_dictDataLabel('plm_customer_information_customer_customer_currency', pci.customer_currency,
|
|
pci.site) as customer_currency,
|
|
pci.turnover_of_year,
|
|
pci.potential_revenue_of_year,
|
|
pci.customer_status,
|
|
pci.customer_description,
|
|
dbo.plm_get_dictDataLabel('plm_customer_information_important_customer', pci.important_customer, ppi.site) as important_customer,
|
|
pci.customer_industry,
|
|
pci.customer_group,
|
|
pci.customer_type
|
|
from plm_project_info ppi
|
|
left join dbo.plm_customer_information pci on ppi.final_customer_id = pci.customer_no
|
|
where ppi.project_id = #{projectId} and ppi.site = #{site}
|
|
</select>
|
|
</mapper>
|