You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

332 lines
18 KiB
XML

<?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.technology.mapper.ProProcessMapper">
<resultMap type="ProProcess" id="ProProcessResult">
<result property="processId" column="process_id" />
<result property="processCode" column="process_code" />
<result property="processName" column="process_name" />
<result property="attention" column="attention" />
<result property="enableFlag" column="enable_flag" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<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="splitMerge" column="split_merge" />
<result property="splitMergNum" column="split_merg_num" />
<result property="sync" column="sync"/>
<result property="workCenter" column="work_center"/>
<result property="workTime" column="work_time"/>
<result property="equipment" column="equipment"/>
<result property="param1" column="param1"/>
<result property="param2" column="param2"/>
<result property="param3" column="param3"/>
<result property="param4" column="param4"/>
<result property="param5" column="param5"/>
<result property="param6" column="param6"/>
<result property="param7" column="param7"/>
<result property="param8" column="param8"/>
<result property="param9" column="param9"/>
<result property="param10" column="param10"/>
</resultMap>
<resultMap type="Equipment" id="EquipmentResult">
<result property="equipmentId" column="equipment_id" />
<result property="equipmentCode" column="equipment_code" />
<result property="equipmentName" column="equipment_name" />
<result property="equipmentBrand" column="equipment_brand" />
<result property="equipmentSpec" column="equipment_spec" />
<result property="equipmentTypeId" column="equipment_type_id" />
<result property="equipmentTypeCode" column="equipment_type_code" />
<result property="equipmentTypeName" column="equipment_type_name" />
<result property="workshopId" column="workshop_id" />
<result property="workshopCode" column="workshop_code" />
<result property="workshopName" column="workshop_name" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<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="unitWorkingHours" column="unit_working_hours" />-->
<result property="workshopSection" column="workshop_section" />
<result property="equipmentLocation" column="equipment_location" />
<result property="hourlyUnitPrice" column="hourly_unit_price" />
</resultMap>
<resultMap type="BomComponent" id="BomComponentResult">
<result property="handle" column="handle" />
<result property="bomCode" column="bom_code" />
<result property="productDescZh" column="product_desc_zh" />
<result property="site" column="site" />
<result property="productCode" column="product_code" />
<result property="cumc" column="cumc" />
<result property="component" column="component" />
<result property="bomHierarchy" column="bom_hierarchy" />
<result property="projectNo" column="project_no" />
<result property="standardDosage" column="standard_dosage" />
<result property="lossRate" column="loss_rate" />
<result property="lossAmount" column="loss_amount" />
<result property="cilosses" column="cilosses" />
<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" />
</resultMap>
<resultMap type="SysFactory" id="SysFactoryResult">
<result property="factoryId" column="factory_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="factoryName" column="factory_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<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="factoryCode" column="factory_code" />
</resultMap>
<sql id="selectSysFactoryVo">
select factory_id, parent_id, ancestors, factory_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time, factory_code from sys_factory
</sql>
<sql id="selectBomVo">
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>
<sql id="selectEquipmentVo">
select equipment_id, equipment_code, equipment_name, equipment_brand, equipment_spec, equipment_type_id, equipment_type_code, equipment_type_name, workshop_id, workshop_code, workshop_name, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, workshop_section, equipment_location, hourly_unit_price from base_equipment
</sql>
<sql id="selectProProcessVo">
select process_id, process_code, process_name, attention,
enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time,
update_by, update_time,split_merge,split_merg_num,sync,work_center,work_time,equipment,param1,param2,param3,param4,param5,param6,param7,param8,param9,param10
from pro_process
</sql>
<select id="selectSysFactoryList" parameterType="SysFactory" resultMap="SysFactoryResult">
<include refid="selectSysFactoryVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="factoryName != null and factoryName != ''"> and factory_name like concat('%', #{factoryName}, '%')</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="leader != null and leader != ''"> and leader = #{leader}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="email != null and email != ''"> and email = #{email}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectProProcessList" parameterType="ProProcess" resultMap="ProProcessResult">
<include refid="selectProProcessVo"/>
<where>
<if test="processCode != null and processCode != ''"> and process_code = #{processCode}</if>
<if test="processName != null and processName != ''"> and process_name like concat('%', #{processName}, '%')</if>
<if test="attention != null and attention != ''"> and attention = #{attention}</if>
<if test="enableFlag != null and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
</where>
order by create_time desc
</select>
<select id="selectProProcessByProcessId" parameterType="String" resultMap="ProProcessResult">
<include refid="selectProProcessVo"/>
where process_id = #{processId}
</select>
<select id="checkProcessCodeUnique" parameterType="ProProcess" resultMap="ProProcessResult">
select top 1 process_id, process_code, process_name, attention, enable_flag,
remark, attr1, attr2, attr3, attr4, create_by, create_time,
update_by, update_time from pro_process
where process_code = #{processCode}
</select>
<select id="checkProcessNameUnique" parameterType="ProProcess" resultMap="ProProcessResult">
select top 1 process_id, process_code, process_name, attention, enable_flag,
remark, attr1, attr2, attr3, attr4, create_by, create_time,
update_by, update_time from pro_process
where process_name = #{processName}
</select>
<insert id="insertProProcess" parameterType="ProProcess" useGeneratedKeys="true" keyProperty="processId">
insert into pro_process
<trim prefix="(" suffix=")" suffixOverrides=",">
process_id,
<if test="processCode != null and processCode != ''">process_code,</if>
<if test="processName != null and processName != ''">process_name,</if>
<if test="attention != null">attention,</if>
<if test="enableFlag != null and enableFlag != ''">enable_flag,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</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="splitMerge != null">split_merge,</if>
<if test="splitMergNum != null">split_merg_num,</if>
<if test="sync != null">sync,</if>
<if test="workCenter != null">work_center,</if>
<if test="workTime != null">work_time,</if>
<if test="equipment != null">equipment,</if>
<if test="param1 != null">param1,</if>
<if test="param2 != null">param2,</if>
<if test="param3 != null">param3,</if>
<if test="param4 != null">param4,</if>
<if test="param5 != null">param5,</if>
<if test="param6 != null">param6,</if>
<if test="param7 != null">param7,</if>
<if test="param8 != null">param8,</if>
<if test="param9 != null">param9,</if>
<if test="param10 != null">param10,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{processId},
<if test="processCode != null and processCode != ''">#{processCode},</if>
<if test="processName != null and processName != ''">#{processName},</if>
<if test="attention != null">#{attention},</if>
<if test="enableFlag != null and enableFlag != ''">#{enableFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</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="splitMerge != null">#{splitMerge},</if>
<if test="splitMergNum != null">#{splitMergNum},</if>
<if test="sync != null">#{sync},</if>
<if test="workCenter != null">#{workCenter},</if>
<if test="workTime != null">#{workTime},</if>
<if test="equipment != null">#{equipment},</if>
<if test="param1 != null">#{param1},</if>
<if test="param2 != null">#{param2},</if>
<if test="param3 != null">#{param3},</if>
<if test="param4 != null">#{param4},</if>
<if test="param5 != null">#{param5},</if>
<if test="param6 != null">#{param6},</if>
<if test="param7 != null">#{param7},</if>
<if test="param8 != null">#{param8},</if>
<if test="param9 != null">#{param9},</if>
<if test="param10 != null">#{param10},</if>
</trim>
</insert>
<update id="updateProProcess" parameterType="ProProcess">
update pro_process
<trim prefix="SET" suffixOverrides=",">
<if test="processCode != null and processCode != ''">process_code = #{processCode},</if>
<if test="processName != null and processName != ''">process_name = #{processName},</if>
<if test="attention != null">attention = #{attention},</if>
<if test="enableFlag != null and enableFlag != ''">enable_flag = #{enableFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</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="splitMerge != null">split_merge = #{splitMerge},</if>
<if test="splitMergNum != null">split_merg_num = #{splitMergNum},</if>
<if test="sync != null">sync = #{sync},</if>
<if test="workCenter != null">work_center = #{workCenter},</if>
<if test="workTime != null">work_time = #{workTime},</if>
<if test="equipment != null">equipment = #{equipment},</if>
<if test="param1 != null">param1 = #{param1},</if>
<if test="param2 != null">param2 = #{param2},</if>
<if test="param3 != null">param3 = #{param3},</if>
<if test="param4 != null">param4 = #{param4},</if>
<if test="param5 != null">param5 = #{param5},</if>
<if test="param6 != null">param6 = #{param6},</if>
<if test="param7 != null">param7 = #{param7},</if>
<if test="param8 != null">param8 = #{param8},</if>
<if test="param9 != null">param9 = #{param9},</if>
<if test="param10 != null">param10 = #{param10},</if>
</trim>
where process_id = #{processId}
</update>
<delete id="deleteProProcessByProcessId" parameterType="String">
delete from pro_process where process_id = #{processId}
</delete>
<delete id="deleteProProcessByProcessIds" parameterType="String">
delete from pro_process where process_id in
<foreach item="processId" collection="array" open="(" separator="," close=")">
#{processId}
</foreach>
</delete>
<select id="selectEquipmentByEquipmentId" parameterType="Long" resultMap="EquipmentResult">
<include refid="selectEquipmentVo"/>
where equipment_id = #{equipmentId}
</select>
<select id="selectEquipmentList" parameterType="Equipment" resultMap="EquipmentResult">
<include refid="selectEquipmentVo"/>
<where>
<if test="equipmentCode != null and equipmentCode != ''"> and equipment_code like concat('%', #{equipmentCode}, '%')</if>
<if test="equipmentName != null and equipmentName != ''"> and equipment_name like concat('%', #{equipmentName}, '%')</if>
<if test="equipmentTypeCode != null and equipmentTypeCode != ''"> and equipment_type_code like concat('%', #{equipmentTypeCode}, '%')</if>
<if test="equipmentTypeName != null and equipmentTypeName != ''"> and equipment_type_name like concat('%', #{equipmentTypeName}, '%')</if>
</where>
</select>
<select id="selectBaseBomComponentList" parameterType="BomComponent" resultMap="BomComponentResult">
<!--select distinct bbc.bom_code,bp.product_desc_zh,right(bp.product_code,11) as pc,bbc.product_code-->
select bbc.bom_code,b1.product_desc_zh,bbc.product_code,bbc.component,bp.product_desc_zh as componentName
from base_bom_component bbc
left join base_product b1 on right(b1.product_code,11) = bbc.product_code
left join base_product bp on right(bp.product_code,11) = bbc.component
<where>
<if test="bomCode != null and bomCode != ''"> and bom_code like concat('%', #{bomCode}, '%')</if>
<if test="productDescZh != null and productDescZh != ''"> and b1.product_desc_zh like concat('%', #{productDescZh}, '%')</if>
<!-- <if test="component != null and component != ''"> and component like concat('%', #{component}, '%')</if>-->
</where>
</select>
<select id="getWorkCenterList" parameterType="SysFactory" resultMap="SysFactoryResult">
select factory_code,factory_name
from sys_factory
</select>
<select id="getEquipmentTypeList" parameterType="Equipment" resultMap="EquipmentResult">
select equipment_type_code,equipment_type_name
from base_equipment
group by equipment_type_code,equipment_type_name
</select>
</mapper>