<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
~
|
~ Copyright (c) 2018-2025, ztt All rights reserved.
|
~
|
~ Redistribution and use in source and binary forms, with or without
|
~ modification, are permitted provided that the following conditions are met:
|
~
|
~ Redistributions of source code must retain the above copyright notice,
|
~ this list of conditions and the following disclaimer.
|
~ Redistributions in binary form must reproduce the above copyright
|
~ notice, this list of conditions and the following disclaimer in the
|
~ documentation and/or other materials provided with the distribution.
|
~ Neither the name of the pig4cloud.com developer nor the names of its
|
~ contributors may be used to endorse or promote products derived from
|
~ this software without specific prior written permission.
|
~ Author: ztt
|
~
|
-->
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.chinaztt.mes.technology.mapper.BomMapper">
|
<resultMap id="bomMap" type="com.chinaztt.mes.technology.dto.BomDTO">
|
<id property="id" column="id"/>
|
<result property="number" column="number"/>
|
<result property="insulationColor" column="insulation_color"/>
|
<result property="sheathColor" column="sheath_color"/>
|
<result property="characteristicOne" column="characteristic_one"/>
|
<result property="state" column="state"/>
|
<result property="partId" column="part_id"/>
|
<result property="partName" column="part_name"/>
|
<result property="partNo" column="part_no"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="createUser" column="create_user"/>
|
<result property="updateUser" column="update_user"/>
|
<result property="version" column="version"/>
|
<result property="operationId" column="operation_id"/>
|
<result property="bomTypeDb" column="bom_type_db"/>
|
<result property="alternativeNo" column="alternative_no"/>
|
<result property="alternativeDesc" column="alternative_desc"/>
|
</resultMap>
|
|
<resultMap id="bomComponentMap" type="com.chinaztt.mes.technology.dto.StructureTree">
|
<id property="id" column="id"/>
|
<result property="parentId" column="parent"/>
|
<result property="partId" column="part_id"/>
|
<result property="partName" column="part_name"/>
|
<result property="partNo" column="part_no"/>
|
<result property="qpa" column="qpa"/>
|
<result property="discNum" column="disc_num"/>
|
<result property="originalQpa" column="original_qpa"/>
|
<result property="unit" column="unit"/>
|
<result property="operationName" column="operation_name"/>
|
<result property="operationId" column="operation_id"/>
|
<result property="operationNo" column="operation_no"/>
|
<result property="planningMethod" column="planning_method"/>
|
<result property="color" column="color"/>
|
</resultMap>
|
|
|
<sql id="bomPage">
|
SELECT
|
b.*,
|
P.part_name,
|
P.part_no
|
FROM
|
technology_bom b
|
LEFT JOIN basic_part P ON b.part_id = P.ID
|
</sql>
|
|
<select id="getBomPage" resultMap="bomMap">
|
select * from(<include refid="bomPage"/>) a
|
<if test="ew.emptyOfWhere == false">
|
<where>
|
${ew.SqlSegment}
|
</where>
|
</if>
|
</select>
|
|
|
<select id="getBomComponents4Tree" resultMap="bomComponentMap">
|
SELECT
|
A.*,
|
b.part_no,
|
b.part_name,
|
c.operation_no,
|
c.name operation_name
|
FROM
|
technology_bom_component A
|
left join basic_part b on b.id = A.part_id
|
left join technology_operation c on c.id = A.operation_id
|
WHERE
|
A.bom_id = #{bomId}
|
order by A."id"
|
</select>
|
|
<select id="getBomCompontBomPart" resultType="com.chinaztt.mes.basic.entity.Part">
|
SELECT
|
bp.*
|
FROM
|
technology_bom_component tbc
|
LEFT JOIN basic_part bp ON tbc.part_id = bp."id"
|
WHERE
|
tbc.parent IS NOT NULL
|
AND tbc.bom_id = #{bomId}
|
AND bp.planning_method = 'A'
|
AND bp.material_type = '1'
|
ORDER BY tbc.ID DESC;
|
</select>
|
|
<select id="getBomComponentsOrderByPartName" resultType="com.chinaztt.mes.technology.dto.BomComponentDTO">
|
SELECT
|
A.*,
|
b.part_no,
|
b.part_name
|
FROM
|
technology_bom_component A,
|
basic_part b
|
WHERE
|
A.part_id = b.ID
|
AND a.bom_id = #{bomId}
|
AND a.parent = #{parent}
|
order by b.part_name
|
</select>
|
|
<select id="getBomPartIdByBomId" resultType="java.lang.Long">
|
SELECT DISTINCT part_id FROM technology_bom_component WHERE bom_id = #{bomId}
|
</select>
|
</mapper>
|