|
|
|
@ -5,23 +5,23 @@
|
|
|
|
|
<mapper namespace="com.aucma.production.mapper.BaseBomInfoMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="BaseBomInfo" id="BaseBomInfoResult">
|
|
|
|
|
<result property="objId" column="obj_id" />
|
|
|
|
|
<result property="bomCode" column="bom_code" />
|
|
|
|
|
<result property="materialCode" column="material_code" />
|
|
|
|
|
<result property="materialName" column="material_name" />
|
|
|
|
|
<result property="materialType" column="material_type" />
|
|
|
|
|
<result property="standardAmount" column="standard_amount" />
|
|
|
|
|
<result property="parentId" column="parent_id" />
|
|
|
|
|
<result property="plantCode" column="plant_code" />
|
|
|
|
|
<result property="productLineCode" column="product_line_code" />
|
|
|
|
|
<result property="productLineName" column="product_line_name" />
|
|
|
|
|
<result property="isFlag" column="is_flag" />
|
|
|
|
|
<result property="createdBy" column="created_by" />
|
|
|
|
|
<result property="createdTime" column="created_time" />
|
|
|
|
|
<result property="updatedBy" column="updated_by" />
|
|
|
|
|
<result property="updatedTime" column="updated_time" />
|
|
|
|
|
<result property="ancestors" column="ancestors" />
|
|
|
|
|
<result property="plantName" column="factory_name" />
|
|
|
|
|
<result property="objId" column="obj_id"/>
|
|
|
|
|
<result property="bomCode" column="bom_code"/>
|
|
|
|
|
<result property="materialCode" column="material_code"/>
|
|
|
|
|
<result property="materialName" column="material_name"/>
|
|
|
|
|
<result property="materialType" column="material_type"/>
|
|
|
|
|
<result property="standardAmount" column="standard_amount"/>
|
|
|
|
|
<result property="parentId" column="parent_id"/>
|
|
|
|
|
<result property="plantCode" column="plant_code"/>
|
|
|
|
|
<result property="productLineCode" column="product_line_code"/>
|
|
|
|
|
<result property="productLineName" column="product_line_name"/>
|
|
|
|
|
<result property="isFlag" column="is_flag"/>
|
|
|
|
|
<result property="createdBy" column="created_by"/>
|
|
|
|
|
<result property="createdTime" column="created_time"/>
|
|
|
|
|
<result property="updatedBy" column="updated_by"/>
|
|
|
|
|
<result property="updatedTime" column="updated_time"/>
|
|
|
|
|
<result property="ancestors" column="ancestors"/>
|
|
|
|
|
<result property="plantName" column="factory_name"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectBaseBomInfoVo">
|
|
|
|
@ -50,94 +50,101 @@
|
|
|
|
|
<select id="selectBaseBomInfoList" parameterType="BaseBomInfo" resultMap="BaseBomInfoResult">
|
|
|
|
|
<include refid="selectBaseBomInfoVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="bomCode != null and bomCode != ''"> and bb.bom_code = #{bomCode}</if>
|
|
|
|
|
<if test="materialCode != null and materialCode != ''"> and bb.material_code = #{materialCode}</if>
|
|
|
|
|
<if test="materialName != null and materialName != ''"> and bb.material_name like concat(concat('%', #{materialName}), '%')</if>
|
|
|
|
|
<if test="materialType != null and materialType != ''"> and bb.material_type = #{materialType}</if>
|
|
|
|
|
<if test="standardAmount != null "> and bb.standard_amount = #{standardAmount}</if>
|
|
|
|
|
<if test="parentId != null and parentId != ''"> and bb.parent_id = #{parentId}</if>
|
|
|
|
|
<if test="plantCode != null and plantCode != ''"> and bb.plant_code = #{plantCode}</if>
|
|
|
|
|
<if test="productLineCode != null and productLineCode != ''"> and bb.product_line_code = #{productLineCode}</if>
|
|
|
|
|
<if test="isFlag != null "> and bb.is_flag = #{isFlag}</if>
|
|
|
|
|
<if test="createdBy != null and createdBy != ''"> and bb.created_by = #{createdBy}</if>
|
|
|
|
|
<if test="createdTime != null "> and bb.created_time = #{createdTime}</if>
|
|
|
|
|
<if test="updatedBy != null and updatedBy != ''"> and bb.updated_by = #{updatedBy}</if>
|
|
|
|
|
<if test="updatedTime != null "> and bb.updated_time = #{updatedTime}</if>
|
|
|
|
|
<if test="ancestors != null and ancestors != ''"> and bb.ancestors like concat(concat('%', #{ancestors}), '%')</if>
|
|
|
|
|
<if test="bomCode != null and bomCode != ''">and bb.bom_code = #{bomCode}</if>
|
|
|
|
|
<if test="materialCode != null and materialCode != ''">and bb.material_code like concat(#{material_code}, '%')</if>
|
|
|
|
|
<if test="materialName != null and materialName != ''">and bb.material_name like concat(concat('%',#{materialName}), '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="materialType != null and materialType != ''">and bb.material_type = #{materialType}</if>
|
|
|
|
|
<if test="standardAmount != null ">and bb.standard_amount = #{standardAmount}</if>
|
|
|
|
|
<if test="parentId != null and parentId != ''">and bb.parent_id = #{parentId}</if>
|
|
|
|
|
<if test="plantCode != null and plantCode != ''">and bb.plant_code = #{plantCode}</if>
|
|
|
|
|
<if test="productLineCode != null and productLineCode != ''">and bb.product_line_code =
|
|
|
|
|
#{productLineCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isFlag != null ">and bb.is_flag = #{isFlag}</if>
|
|
|
|
|
<if test="createdBy != null and createdBy != ''">and bb.created_by = #{createdBy}</if>
|
|
|
|
|
<if test="createdTime != null ">and bb.created_time = #{createdTime}</if>
|
|
|
|
|
<if test="updatedBy != null and updatedBy != ''">and bb.updated_by = #{updatedBy}</if>
|
|
|
|
|
<if test="updatedTime != null ">and bb.updated_time = #{updatedTime}</if>
|
|
|
|
|
<if test="ancestors != null and ancestors != ''">and bb.ancestors like concat(concat('%', #{ancestors}),
|
|
|
|
|
'%')
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
order by bb.created_time desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectBaseBomInfoByObjId" parameterType="Long" resultMap="BaseBomInfoResult">
|
|
|
|
|
<include refid="selectBaseBomInfoVo"/>
|
|
|
|
|
where bb.obj_id = #{objId}
|
|
|
|
|
<include refid="selectBaseBomInfoVo"/>
|
|
|
|
|
where bb.obj_id = #{objId}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectBaseBomInfoByMaterialCode" resultMap="BaseBomInfoResult">
|
|
|
|
|
<include refid="selectBaseBomInfoVo"/>
|
|
|
|
|
where bb.material_code = #{materialCode}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectChildrenBomById" parameterType="String" resultMap="BaseBomInfoResult">
|
|
|
|
|
select * from BASE_BOMINFO where FIND_IN_SET(#{materialCode}, ancestors) <![CDATA[ <> ]]> 0
|
|
|
|
|
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">
|
|
|
|
|
SELECT seq_base_bominfo.NEXTVAL as objId FROM DUAL
|
|
|
|
|
</selectKey>
|
|
|
|
|
<selectKey keyProperty="objId" resultType="long" order="BEFORE">
|
|
|
|
|
SELECT seq_base_bominfo.NEXTVAL as objId FROM DUAL
|
|
|
|
|
</selectKey>
|
|
|
|
|
insert into base_bominfo
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="objId != null">obj_id,</if>
|
|
|
|
|
<if test="bomCode != null">bom_code,</if>
|
|
|
|
|
<if test="materialCode != null">material_code,</if>
|
|
|
|
|
<if test="materialName != null">material_name,</if>
|
|
|
|
|
<if test="materialType != null">material_type,</if>
|
|
|
|
|
<if test="standardAmount != null">standard_amount,</if>
|
|
|
|
|
<if test="parentId != null">parent_id,</if>
|
|
|
|
|
<if test="plantCode != null">plant_code,</if>
|
|
|
|
|
<if test="productLineCode != null">product_line_code,</if>
|
|
|
|
|
<if test="isFlag != null">is_flag,</if>
|
|
|
|
|
<if test="createdBy != null">created_by,</if>
|
|
|
|
|
<if test="createdTime != null">created_time,</if>
|
|
|
|
|
<if test="updatedBy != null">updated_by,</if>
|
|
|
|
|
<if test="updatedTime != null">updated_time,</if>
|
|
|
|
|
<if test="ancestors != null">ancestors,</if>
|
|
|
|
|
<if test="objId != null">obj_id,</if>
|
|
|
|
|
<if test="bomCode != null">bom_code,</if>
|
|
|
|
|
<if test="materialCode != null">material_code,</if>
|
|
|
|
|
<if test="materialName != null">material_name,</if>
|
|
|
|
|
<if test="materialType != null">material_type,</if>
|
|
|
|
|
<if test="standardAmount != null">standard_amount,</if>
|
|
|
|
|
<if test="parentId != null">parent_id,</if>
|
|
|
|
|
<if test="plantCode != null">plant_code,</if>
|
|
|
|
|
<if test="productLineCode != null">product_line_code,</if>
|
|
|
|
|
<if test="isFlag != null">is_flag,</if>
|
|
|
|
|
<if test="createdBy != null">created_by,</if>
|
|
|
|
|
<if test="createdTime != null">created_time,</if>
|
|
|
|
|
<if test="updatedBy != null">updated_by,</if>
|
|
|
|
|
<if test="updatedTime != null">updated_time,</if>
|
|
|
|
|
<if test="ancestors != null">ancestors,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="objId != null">#{objId},</if>
|
|
|
|
|
<if test="bomCode != null">#{bomCode},</if>
|
|
|
|
|
<if test="materialCode != null">#{materialCode},</if>
|
|
|
|
|
<if test="materialName != null">#{materialName},</if>
|
|
|
|
|
<if test="materialType != null">#{materialType},</if>
|
|
|
|
|
<if test="standardAmount != null">#{standardAmount},</if>
|
|
|
|
|
<if test="parentId != null">#{parentId},</if>
|
|
|
|
|
<if test="plantCode != null">#{plantCode},</if>
|
|
|
|
|
<if test="productLineCode != null">#{productLineCode},</if>
|
|
|
|
|
<if test="isFlag != null">#{isFlag},</if>
|
|
|
|
|
<if test="createdBy != null">#{createdBy},</if>
|
|
|
|
|
<if test="createdTime != null">#{createdTime},</if>
|
|
|
|
|
<if test="updatedBy != null">#{updatedBy},</if>
|
|
|
|
|
<if test="updatedTime != null">#{updatedTime},</if>
|
|
|
|
|
<if test="ancestors != null">#{ancestors},</if>
|
|
|
|
|
<if test="objId != null">#{objId},</if>
|
|
|
|
|
<if test="bomCode != null">#{bomCode},</if>
|
|
|
|
|
<if test="materialCode != null">#{materialCode},</if>
|
|
|
|
|
<if test="materialName != null">#{materialName},</if>
|
|
|
|
|
<if test="materialType != null">#{materialType},</if>
|
|
|
|
|
<if test="standardAmount != null">#{standardAmount},</if>
|
|
|
|
|
<if test="parentId != null">#{parentId},</if>
|
|
|
|
|
<if test="plantCode != null">#{plantCode},</if>
|
|
|
|
|
<if test="productLineCode != null">#{productLineCode},</if>
|
|
|
|
|
<if test="isFlag != null">#{isFlag},</if>
|
|
|
|
|
<if test="createdBy != null">#{createdBy},</if>
|
|
|
|
|
<if test="createdTime != null">#{createdTime},</if>
|
|
|
|
|
<if test="updatedBy != null">#{updatedBy},</if>
|
|
|
|
|
<if test="updatedTime != null">#{updatedTime},</if>
|
|
|
|
|
<if test="ancestors != null">#{ancestors},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateBaseBomInfo" parameterType="BaseBomInfo">
|
|
|
|
|
update base_bominfo
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="bomCode != null">bom_code = #{bomCode},</if>
|
|
|
|
|
<if test="materialCode != null">material_code = #{materialCode},</if>
|
|
|
|
|
<if test="materialName != null">material_name = #{materialName},</if>
|
|
|
|
|
<if test="materialType != null">material_type = #{materialType},</if>
|
|
|
|
|
<if test="standardAmount != null">standard_amount = #{standardAmount},</if>
|
|
|
|
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
|
|
|
|
<if test="plantCode != null">plant_code = #{plantCode},</if>
|
|
|
|
|
<if test="productLineCode != null">product_line_code = #{productLineCode},</if>
|
|
|
|
|
<if test="isFlag != null">is_flag = #{isFlag},</if>
|
|
|
|
|
<if test="createdBy != null">created_by = #{createdBy},</if>
|
|
|
|
|
<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="ancestors != null">ancestors = #{ancestors},</if>
|
|
|
|
|
<if test="bomCode != null">bom_code = #{bomCode},</if>
|
|
|
|
|
<if test="materialCode != null">material_code = #{materialCode},</if>
|
|
|
|
|
<if test="materialName != null">material_name = #{materialName},</if>
|
|
|
|
|
<if test="materialType != null">material_type = #{materialType},</if>
|
|
|
|
|
<if test="standardAmount != null">standard_amount = #{standardAmount},</if>
|
|
|
|
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
|
|
|
|
<if test="plantCode != null">plant_code = #{plantCode},</if>
|
|
|
|
|
<if test="productLineCode != null">product_line_code = #{productLineCode},</if>
|
|
|
|
|
<if test="isFlag != null">is_flag = #{isFlag},</if>
|
|
|
|
|
<if test="createdBy != null">created_by = #{createdBy},</if>
|
|
|
|
|
<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="ancestors != null">ancestors = #{ancestors},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where obj_id = #{objId}
|
|
|
|
|
</update>
|
|
|
|
@ -155,7 +162,9 @@
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteBaseBomInfoByObjId" parameterType="Long">
|
|
|
|
|
delete from base_bominfo where obj_id = #{objId}
|
|
|
|
|
delete
|
|
|
|
|
from base_bominfo
|
|
|
|
|
where obj_id = #{objId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteBaseBomInfoByObjIds" parameterType="String">
|
|
|
|
|