|
|
|
@ -21,6 +21,7 @@
|
|
|
|
|
<result property="sort" column="sort"/>
|
|
|
|
|
<result property="vbeln" column="vbeln"/>
|
|
|
|
|
<result property="vbpos" column="vbpos"/>
|
|
|
|
|
<result property="ancestors" column="ancestors" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectOrderBomInfoVo">
|
|
|
|
@ -28,7 +29,7 @@
|
|
|
|
|
ob.bom_code,
|
|
|
|
|
ob.material_code,
|
|
|
|
|
bm.material_name,
|
|
|
|
|
ob.material_type,
|
|
|
|
|
bm.material_type,
|
|
|
|
|
ob.standard_amount,
|
|
|
|
|
ob.parent_id,
|
|
|
|
|
ob.is_flag,
|
|
|
|
@ -38,6 +39,7 @@
|
|
|
|
|
ob.updated_time,
|
|
|
|
|
ob.factory_code,
|
|
|
|
|
ob.sort,
|
|
|
|
|
ob.ancestors,
|
|
|
|
|
ob.vbeln,
|
|
|
|
|
ob.vbpos
|
|
|
|
|
from order_bominfo ob
|
|
|
|
@ -49,7 +51,7 @@
|
|
|
|
|
<where>
|
|
|
|
|
<if test="bomCode != null and bomCode != ''">and ob.bom_code = #{bomCode}</if>
|
|
|
|
|
<if test="materialCode != null and materialCode != ''">and ob.material_code = #{materialCode}</if>
|
|
|
|
|
<if test="materialName != null and materialName != ''">and ob.material_name like concat(concat('%',
|
|
|
|
|
<if test="materialName != null and materialName != ''">and bm.material_name like concat(concat('%',
|
|
|
|
|
#{materialName}), '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="materialType != null and materialType != ''">and ob.material_type = #{materialType}</if>
|
|
|
|
@ -64,6 +66,7 @@
|
|
|
|
|
<if test="sort != null and sort != ''">and ob.sort = #{sort}</if>
|
|
|
|
|
<if test="vbeln != null and vbeln != ''">and ob.vbeln = #{vbeln}</if>
|
|
|
|
|
<if test="vbpos != null and vbpos != ''">and ob.vbpos = #{vbpos}</if>
|
|
|
|
|
<if test="ancestors != null and ancestors != ''">and ob.ancestors like concat(concat('%', #{ancestors}), '%')</if>
|
|
|
|
|
</where>
|
|
|
|
|
order by ob.parent_id, ob.sort
|
|
|
|
|
</select>
|
|
|
|
@ -73,6 +76,11 @@
|
|
|
|
|
where ob.obj_id = #{objId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectOrderBomInfoByMaterialCode" resultMap="OrderBomInfoResult">
|
|
|
|
|
<include refid="selectOrderBomInfoVo"/>
|
|
|
|
|
where ob.material_code = #{materialCode}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertOrderBomInfo" parameterType="OrderBomInfo">
|
|
|
|
|
<selectKey keyProperty="objId" resultType="long" order="BEFORE">
|
|
|
|
|
SELECT seq_order_bominfo.NEXTVAL as objId FROM DUAL
|
|
|
|
@ -95,6 +103,7 @@
|
|
|
|
|
<if test="sort != null">sort,</if>
|
|
|
|
|
<if test="vbeln != null">vbeln,</if>
|
|
|
|
|
<if test="vbpos != null">vbpos,</if>
|
|
|
|
|
<if test="ancestors != null">ancestors,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="objId != null">#{objId},</if>
|
|
|
|
@ -113,6 +122,7 @@
|
|
|
|
|
<if test="sort != null">#{sort},</if>
|
|
|
|
|
<if test="vbeln != null">#{vbeln},</if>
|
|
|
|
|
<if test="vbpos != null">#{vbpos},</if>
|
|
|
|
|
<if test="ancestors != null">#{ancestors},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
@ -134,6 +144,7 @@
|
|
|
|
|
<if test="sort != null">sort = #{sort},</if>
|
|
|
|
|
<if test="vbeln != null">vbeln = #{vbeln},</if>
|
|
|
|
|
<if test="vbpos != null">vbpos = #{vbpos},</if>
|
|
|
|
|
<if test="ancestors != null">ancestors = #{ancestors},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where obj_id = #{objId}
|
|
|
|
|
</update>
|
|
|
|
@ -150,4 +161,21 @@
|
|
|
|
|
#{objId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<select id="selectChildrenBomById" parameterType="String" resultMap="OrderBomInfoResult">
|
|
|
|
|
select * from order_bominfo where FIND_IN_SET(#{materialCode}, ancestors) <![CDATA[ <> ]]> 0
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<update id="updateBomChildren" parameterType="java.util.List">
|
|
|
|
|
update order_bominfo set ancestors =
|
|
|
|
|
<foreach collection="depts" item="item" index="index"
|
|
|
|
|
separator=" " open="case material_code" close="end">
|
|
|
|
|
when #{item.materialCode} then #{item.ancestors}
|
|
|
|
|
</foreach>
|
|
|
|
|
where material_code in
|
|
|
|
|
<foreach collection="depts" item="item" index="index"
|
|
|
|
|
separator="," open="(" close=")">
|
|
|
|
|
#{item.materialCode}
|
|
|
|
|
</foreach>
|
|
|
|
|
</update>
|
|
|
|
|
</mapper>
|