|
|
|
@ -19,11 +19,12 @@
|
|
|
|
|
<result property="createdTime" column="created_time" />
|
|
|
|
|
<result property="updatedBy" column="updated_by" />
|
|
|
|
|
<result property="updatedTime" column="updated_time" />
|
|
|
|
|
<result property="orderCode" column="order_code" />
|
|
|
|
|
<result property="ancestors" column="ancestors" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectBaseBomInfoVo">
|
|
|
|
|
select obj_id, bom_code, material_code, material_name, material_type, standard_amount, parent_id, plant_code, product_line_code, is_flag, created_by, created_time, updated_by, updated_time, order_code from base_bominfo
|
|
|
|
|
select obj_id, bom_code, material_code, material_name, material_type, standard_amount, parent_id,
|
|
|
|
|
plant_code, product_line_code, is_flag, created_by, created_time, updated_by, updated_time, ancestors from base_bominfo
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectBaseBomInfoList" parameterType="BaseBomInfo" resultMap="BaseBomInfoResult">
|
|
|
|
@ -42,7 +43,7 @@
|
|
|
|
|
<if test="createdTime != null "> and created_time = #{createdTime}</if>
|
|
|
|
|
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
|
|
|
|
|
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
|
|
|
|
|
<if test="orderCode != null and orderCode != ''"> and order_code = #{orderCode}</if>
|
|
|
|
|
<if test="ancestors != null and ancestors != ''"> and ancestors like concat(concat('%', #{ancestors}), '%')</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
@ -50,6 +51,13 @@
|
|
|
|
|
<include refid="selectBaseBomInfoVo"/>
|
|
|
|
|
where obj_id = #{objId}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectBaseBomInfoByMaterialCode" resultMap="BaseBomInfoResult">
|
|
|
|
|
<include refid="selectBaseBomInfoVo"/>
|
|
|
|
|
where material_code = #{materialCode}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectChildrenBomById" parameterType="String" resultMap="BaseBomInfoResult">
|
|
|
|
|
select * from BASE_BOMINFO where FIND_IN_SET(#{materialCode}, ancestors) <![CDATA[ <> ]]> 0
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertBaseBomInfo" parameterType="BaseBomInfo">
|
|
|
|
|
<selectKey keyProperty="objId" resultType="long" order="BEFORE">
|
|
|
|
@ -71,7 +79,7 @@
|
|
|
|
|
<if test="createdTime != null">created_time,</if>
|
|
|
|
|
<if test="updatedBy != null">updated_by,</if>
|
|
|
|
|
<if test="updatedTime != null">updated_time,</if>
|
|
|
|
|
<if test="orderCode != null">order_code,</if>
|
|
|
|
|
<if test="ancestors != null">ancestors,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="objId != null">#{objId},</if>
|
|
|
|
@ -88,7 +96,7 @@
|
|
|
|
|
<if test="createdTime != null">#{createdTime},</if>
|
|
|
|
|
<if test="updatedBy != null">#{updatedBy},</if>
|
|
|
|
|
<if test="updatedTime != null">#{updatedTime},</if>
|
|
|
|
|
<if test="orderCode != null">#{orderCode},</if>
|
|
|
|
|
<if test="ancestors != null">#{ancestors},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
@ -108,10 +116,22 @@
|
|
|
|
|
<if test="createdTime != null">created_time = #{createdTime},</if>
|
|
|
|
|
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
|
|
|
|
|
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
|
|
|
|
|
<if test="orderCode != null">order_code = #{orderCode},</if>
|
|
|
|
|
<if test="ancestors != null">ancestors = #{ancestors},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where obj_id = #{objId}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateBomChildren" parameterType="java.util.List">
|
|
|
|
|
update base_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>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteBaseBomInfoByObjId" parameterType="Long">
|
|
|
|
|
delete from base_bominfo where obj_id = #{objId}
|
|
|
|
|