|
|
|
<?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.op.sap.mapper.SapBomMapper">
|
|
|
|
|
|
|
|
<resultMap type="com.op.system.api.domain.sap.SapBom" id="BaseBomResult">
|
|
|
|
<result property="factoryCode" column="factory_code" />
|
|
|
|
<result property="productionVersion" column="production_version" />
|
|
|
|
<result property="bomCode" column="bom_code" />
|
|
|
|
<result property="optionalBom" column="optional_bom" />
|
|
|
|
<result property="optionalBomText" column="optional_bom_text" />
|
|
|
|
<result property="pvvd" column="pvvd" />
|
|
|
|
<result property="pved" column="pved" />
|
|
|
|
<result property="bomCalculateNumber" column="bom_calculate_number" />
|
|
|
|
<result property="bomCalculateUnit" column="bom_calculate_unit" />
|
|
|
|
<result property="bomBaseNumber" column="bom_base_number" />
|
|
|
|
<result property="bomBaseUnit" column="bom_base_unit" />
|
|
|
|
<result property="componentUnit" column="component_unit" />
|
|
|
|
<result property="componentProFlag" column="component_pro_flag" />
|
|
|
|
<result property="msi" column="msi" />
|
|
|
|
<result property="sanka" column="sanka" />
|
|
|
|
<result property="attr1" column="attr1" />
|
|
|
|
<result property="attr2" column="attr2" />
|
|
|
|
<result property="attr3" column="attr3" />
|
|
|
|
<result property="createBy" column="create_by" />
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
<result property="remark" column="remark" />
|
|
|
|
<result property="currentVersion" column="current_version" />
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectBaseBomVo">
|
|
|
|
select factory_code, production_version, bom_code, optional_bom, optional_bom_text, pvvd, pved, bom_calculate_number, bom_calculate_unit, bom_base_number, bom_base_unit, component_unit, component_pro_flag, msi, sanka, attr1, attr2, attr3, create_by, create_time, update_by, update_time, remark, current_version from base_bom
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectBaseBomList" parameterType="com.op.system.api.domain.sap.SapBom" resultMap="BaseBomResult">
|
|
|
|
<include refid="selectBaseBomVo"/>
|
|
|
|
<where>
|
|
|
|
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
|
|
|
|
<if test="productionVersion != null and productionVersion != ''"> and production_version = #{productionVersion}</if>
|
|
|
|
<if test="bomCode != null and bomCode != ''"> and bom_code = #{bomCode}</if>
|
|
|
|
<if test="optionalBom != null and optionalBom != ''"> and optional_bom = #{optionalBom}</if>
|
|
|
|
<if test="optionalBomText != null and optionalBomText != ''"> and optional_bom_text = #{optionalBomText}</if>
|
|
|
|
<if test="pvvd != null "> and pvvd = #{pvvd}</if>
|
|
|
|
<if test="pved != null "> and pved = #{pved}</if>
|
|
|
|
<if test="bomCalculateNumber != null "> and bom_calculate_number = #{bomCalculateNumber}</if>
|
|
|
|
<if test="bomCalculateUnit != null and bomCalculateUnit != ''"> and bom_calculate_unit = #{bomCalculateUnit}</if>
|
|
|
|
<if test="bomBaseNumber != null "> and bom_base_number = #{bomBaseNumber}</if>
|
|
|
|
<if test="bomBaseUnit != null and bomBaseUnit != ''"> and bom_base_unit = #{bomBaseUnit}</if>
|
|
|
|
<if test="componentUnit != null and componentUnit != ''"> and component_unit = #{componentUnit}</if>
|
|
|
|
<if test="componentProFlag != null and componentProFlag != ''"> and component_pro_flag = #{componentProFlag}</if>
|
|
|
|
<if test="msi != null and msi != ''"> and msi = #{msi}</if>
|
|
|
|
<if test="sanka != null and sanka != ''"> and sanka = #{sanka}</if>
|
|
|
|
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
|
|
|
|
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
|
|
|
|
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
|
|
|
|
<if test="currentVersion != null and currentVersion != ''"> and current_version = #{currentVersion}</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectBaseBomByBomCode" parameterType="String" resultMap="BaseBomResult">
|
|
|
|
<include refid="selectBaseBomVo"/>
|
|
|
|
where bom_code = #{bomCode}
|
|
|
|
order by production_version desc
|
|
|
|
</select>
|
|
|
|
<select id="getMaxTime" resultType="java.util.Date">
|
|
|
|
select max(create_time) from sys_factory
|
|
|
|
</select>
|
|
|
|
<select id="getExsitCodes" resultType="java.lang.String">
|
|
|
|
select factory_code from sys_factory where factory_code in
|
|
|
|
<foreach collection="code" item="list" open="(" separator="," close=")">
|
|
|
|
#{code}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
<select id="getParentId" resultType="java.lang.String">
|
|
|
|
select factory_id from sys_factory where factory_code = #{factoryCode}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertBaseBom" parameterType="com.op.system.api.domain.sap.SapBom">
|
|
|
|
insert into base_bom
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="bomBo != null">bom_bo,</if>
|
|
|
|
<if test="factoryCode != null">factory_code,</if>
|
|
|
|
<if test="productionVersion != null">production_version,</if>
|
|
|
|
<if test="bomCode != null">bom_code,</if>
|
|
|
|
<if test="optionalBom != null">optional_bom,</if>
|
|
|
|
<if test="optionalBomText != null">optional_bom_text,</if>
|
|
|
|
<if test="pvvd != null">pvvd,</if>
|
|
|
|
<if test="pved != null">pved,</if>
|
|
|
|
<if test="bomCalculateNumber != null">bom_calculate_number,</if>
|
|
|
|
<if test="bomCalculateUnit != null">bom_calculate_unit,</if>
|
|
|
|
<if test="bomBaseNumber != null">bom_base_number,</if>
|
|
|
|
<if test="bomBaseUnit != null">bom_base_unit,</if>
|
|
|
|
<if test="componentUnit != null">component_unit,</if>
|
|
|
|
<if test="componentProFlag != null">component_pro_flag,</if>
|
|
|
|
<if test="msi != null">msi,</if>
|
|
|
|
<if test="sanka != null">sanka,</if>
|
|
|
|
<if test="attr1 != null">attr1,</if>
|
|
|
|
<if test="attr2 != null">attr2,</if>
|
|
|
|
<if test="attr3 != null">attr3,</if>
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
<if test="remark != null">remark,</if>
|
|
|
|
<if test="currentVersion != null">current_version,</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="bomBo != null">#{bomBo},</if>
|
|
|
|
<if test="factoryCode != null">#{factoryCode},</if>
|
|
|
|
<if test="productionVersion != null">#{productionVersion},</if>
|
|
|
|
<if test="bomCode != null">#{bomCode},</if>
|
|
|
|
<if test="optionalBom != null">#{optionalBom},</if>
|
|
|
|
<if test="optionalBomText != null">#{optionalBomText},</if>
|
|
|
|
<if test="pvvd != null">#{pvvd},</if>
|
|
|
|
<if test="pved != null">#{pved},</if>
|
|
|
|
<if test="bomCalculateNumber != null">#{bomCalculateNumber},</if>
|
|
|
|
<if test="bomCalculateUnit != null">#{bomCalculateUnit},</if>
|
|
|
|
<if test="bomBaseNumber != null">#{bomBaseNumber},</if>
|
|
|
|
<if test="bomBaseUnit != null">#{bomBaseUnit},</if>
|
|
|
|
<if test="componentUnit != null">#{componentUnit},</if>
|
|
|
|
<if test="componentProFlag != null">#{componentProFlag},</if>
|
|
|
|
<if test="msi != null">#{msi},</if>
|
|
|
|
<if test="sanka != null">#{sanka},</if>
|
|
|
|
<if test="attr1 != null">#{attr1},</if>
|
|
|
|
<if test="attr2 != null">#{attr2},</if>
|
|
|
|
<if test="attr3 != null">#{attr3},</if>
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
<if test="remark != null">#{remark},</if>
|
|
|
|
<if test="currentVersion != null">#{currentVersion},</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
<insert id="insertBaseBomBatch">
|
|
|
|
insert into base_bom
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="item.bomBo != null">bom_bo,</if>
|
|
|
|
<if test="item.factoryCode != null">factory_code,</if>
|
|
|
|
<if test="item.productionVersion != null">production_version,</if>
|
|
|
|
<if test="item.bomCode != null">bom_code,</if>
|
|
|
|
<if test="item.optionalBom != null">optional_bom,</if>
|
|
|
|
<if test="item.optionalBomText != null">optional_bom_text,</if>
|
|
|
|
<if test="item.pvvd != null">pvvd,</if>
|
|
|
|
<if test="item.pved != null">pved,</if>
|
|
|
|
<if test="item.bomCalculateNumber != null">bom_calculate_number,</if>
|
|
|
|
<if test="item.bomCalculateUnit != null">bom_calculate_unit,</if>
|
|
|
|
<if test="item.bomBaseNumber != null">bom_base_number,</if>
|
|
|
|
<if test="item.bomBaseUnit != null">bom_base_unit,</if>
|
|
|
|
<if test="item.componentUnit != null">component_unit,</if>
|
|
|
|
<if test="item.componentProFlag != null">component_pro_flag,</if>
|
|
|
|
<if test="item.msi != null">msi,</if>
|
|
|
|
<if test="item.sanka != null">sanka,</if>
|
|
|
|
<if test="item.attr1 != null">attr1,</if>
|
|
|
|
<if test="item.attr2 != null">attr2,</if>
|
|
|
|
<if test="item.attr3 != null">attr3,</if>
|
|
|
|
<if test="item.createBy != null">create_by,</if>
|
|
|
|
<if test="item.createTime != null">create_time,</if>
|
|
|
|
<if test="item.updateBy != null">update_by,</if>
|
|
|
|
<if test="item.updateTime != null">update_time,</if>
|
|
|
|
<if test="item.remark != null">remark,</if>
|
|
|
|
<if test="item.currentVersion != null">current_version,</if>
|
|
|
|
</trim>
|
|
|
|
VALUES
|
|
|
|
<foreach collection="list" index="index" item="item" separator=",">
|
|
|
|
<if test="item.bomBo != null">#{bomBo},</if>
|
|
|
|
<if test="item.factoryCode != null">#{factoryCode},</if>
|
|
|
|
<if test="item.productionVersion != null">#{productionVersion},</if>
|
|
|
|
<if test="item.bomCode != null">#{bomCode},</if>
|
|
|
|
<if test="item.optionalBom != null">#{optionalBom},</if>
|
|
|
|
<if test="item.optionalBomText != null">#{optionalBomText},</if>
|
|
|
|
<if test="item.pvvd != null">#{pvvd},</if>
|
|
|
|
<if test="item.pved != null">#{pved},</if>
|
|
|
|
<if test="item.bomCalculateNumber != null">#{bomCalculateNumber},</if>
|
|
|
|
<if test="item.bomCalculateUnit != null">#{bomCalculateUnit},</if>
|
|
|
|
<if test="item.bomBaseNumber != null">#{bomBaseNumber},</if>
|
|
|
|
<if test="item.bomBaseUnit != null">#{bomBaseUnit},</if>
|
|
|
|
<if test="item.componentUnit != null">#{componentUnit},</if>
|
|
|
|
<if test="item.componentProFlag != null">#{componentProFlag},</if>
|
|
|
|
<if test="item.msi != null">#{msi},</if>
|
|
|
|
<if test="item.sanka != null">#{sanka},</if>
|
|
|
|
<if test="item.attr1 != null">#{attr1},</if>
|
|
|
|
<if test="item.attr2 != null">#{attr2},</if>
|
|
|
|
<if test="item.attr3 != null">#{attr3},</if>
|
|
|
|
<if test="item.createBy != null">#{createBy},</if>
|
|
|
|
<if test="item.createTime != null">#{createTime},</if>
|
|
|
|
<if test="item.updateBy != null">#{updateBy},</if>
|
|
|
|
<if test="item.updateTime != null">#{updateTime},</if>
|
|
|
|
<if test="item.remark != null">#{remark},</if>
|
|
|
|
<if test="item.currentVersion != null">#{currentVersion},</if>
|
|
|
|
</foreach>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateBaseBom" parameterType="com.op.system.api.domain.sap.SapBom">
|
|
|
|
update base_bom
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="productionVersion != null">production_version = #{productionVersion},</if>
|
|
|
|
<if test="bomCode != null">bom_code = #{bomCode},</if>
|
|
|
|
<if test="optionalBom != null">optional_bom = #{optionalBom},</if>
|
|
|
|
<if test="optionalBomText != null">optional_bom_text = #{optionalBomText},</if>
|
|
|
|
<if test="pvvd != null">pvvd = #{pvvd},</if>
|
|
|
|
<if test="pved != null">pved = #{pved},</if>
|
|
|
|
<if test="bomCalculateNumber != null">bom_calculate_number = #{bomCalculateNumber},</if>
|
|
|
|
<if test="bomCalculateUnit != null">bom_calculate_unit = #{bomCalculateUnit},</if>
|
|
|
|
<if test="bomBaseNumber != null">bom_base_number = #{bomBaseNumber},</if>
|
|
|
|
<if test="bomBaseUnit != null">bom_base_unit = #{bomBaseUnit},</if>
|
|
|
|
<if test="componentUnit != null">component_unit = #{componentUnit},</if>
|
|
|
|
<if test="componentProFlag != null">component_pro_flag = #{componentProFlag},</if>
|
|
|
|
<if test="msi != null">msi = #{msi},</if>
|
|
|
|
<if test="sanka != null">sanka = #{sanka},</if>
|
|
|
|
<if test="attr1 != null">attr1 = #{attr1},</if>
|
|
|
|
<if test="attr2 != null">attr2 = #{attr2},</if>
|
|
|
|
<if test="attr3 != null">attr3 = #{attr3},</if>
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
|
<if test="currentVersion != null">current_version = #{currentVersion},</if>
|
|
|
|
</trim>
|
|
|
|
where factory_code = #{factoryCode}
|
|
|
|
</update>
|
|
|
|
<!--批量更新工厂建模表-->
|
|
|
|
<update id="updateFactoryBatchs">
|
|
|
|
<foreach collection="list" item="item" separator=";">
|
|
|
|
update sys_factory
|
|
|
|
set factory_name = #{item.factoryName}
|
|
|
|
where
|
|
|
|
factoryCode = #{item.factoryCode}
|
|
|
|
</foreach>
|
|
|
|
</update>
|
|
|
|
<!--批量添加工厂建模表-->
|
|
|
|
<insert id="addFactoryBatchs">
|
|
|
|
insert into sys_factory
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="item.parentId != null">parent_id,</if>
|
|
|
|
<if test="item.factoryName != null">factory_name,</if>
|
|
|
|
<if test="item.factoryCode != null">factory_code,</if>
|
|
|
|
create_by,
|
|
|
|
<if test="item.createTime != null">create_time,</if>
|
|
|
|
<if test="item.updateTime != null">update_time,</if>
|
|
|
|
</trim>
|
|
|
|
VALUES
|
|
|
|
<foreach collection="list" index="index" item="item" separator=",">
|
|
|
|
<if test="item.parentId != null">#{item.parentId},</if>
|
|
|
|
<if test="item.factoryName != null">#{item.factoryName},</if>
|
|
|
|
<if test="item.factoryCode != null">#{item.factoryCode},</if>
|
|
|
|
'job',
|
|
|
|
<if test="item.createTime != null">#{item.aedat_grnd},</if>
|
|
|
|
<if test="item.updateTime != null">#{item.aedat_grnd},</if>
|
|
|
|
</foreach>
|
|
|
|
</insert>
|
|
|
|
<delete id="deleteBaseBomByFactoryCode" parameterType="String">
|
|
|
|
delete from base_bom where factory_code = #{factoryCode}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteBaseBomByFactoryCodes" parameterType="String">
|
|
|
|
delete from base_bom where factory_code in
|
|
|
|
<foreach item="factoryCode" collection="array" open="(" separator="," close=")">
|
|
|
|
#{factoryCode}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
</mapper>
|