<?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.aps.job.mapper.ApsWorkOrderJobMapper"> 
 | 
     
 | 
    <resultMap type="ApsWorkOrderJob" id="ApsWorkOrderJobResult"> 
 | 
        <result property="id"    column="id"    /> 
 | 
        <result property="orderId"    column="order_id"    /> 
 | 
        <result property="docNo"    column="doc_no"    /> 
 | 
        <result property="mainitemCode"    column="mainitem_code"    /> 
 | 
        <result property="mainitemFigure"    column="mainitem_figure"    /> 
 | 
        <result property="customerName"    column="customer_name"    /> 
 | 
        <result property="businessType"    column="business_type"    /> 
 | 
        <result property="demandType"    column="demand_type"    /> 
 | 
        <result property="docStatus"    column="doc_status"    /> 
 | 
        <result property="itemCode"    column="item_code"    /> 
 | 
        <result property="itemFigure"    column="item_figure"    /> 
 | 
        <result property="itemFigureVersion"    column="item_figure_version"    /> 
 | 
        <result property="pruductQty"    column="pruduct_qty"    /> 
 | 
        <result property="workQty"    column="work_qty"    /> 
 | 
        <result property="opNum"    column="op_num"    /> 
 | 
        <result property="workCenter"    column="work_center"    /> 
 | 
        <result property="dept"    column="dept"    /> 
 | 
        <result property="startDate"    column="start_date"    /> 
 | 
        <result property="completeDate"    column="complete_date"    /> 
 | 
        <result property="nextDept"    column="next_dept"    /> 
 | 
        <result property="isHoldRelease"    column="is_hold_release"    /> 
 | 
        <result property="isOutSource"    column="is_out_source"    /> 
 | 
        <result property="org"    column="org"    /> 
 | 
        <result property="pageNum"    column="page_num"    /> 
 | 
        <result property="pageIndex"    column="page_index"    /> 
 | 
        <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"    /> 
 | 
    </resultMap> 
 | 
  
 | 
    <sql id="selectApsWorkOrderJobVo"> 
 | 
        select id, order_id, doc_no, mainitem_code, mainitem_figure, customer_name, business_type, demand_type, 
 | 
               doc_status, item_code, item_figure, item_figure_version, pruduct_qty, work_qty, op_num, work_center, 
 | 
               dept, start_date, complete_date, next_dept, is_hold_release, is_out_source, org, page_num, page_index, 
 | 
               del_flag, create_by, create_time, update_by, update_time , process_status,org_code 
 | 
        from aps_work_order_job 
 | 
    </sql> 
 | 
  
 | 
    <select id="selectApsWorkOrderJobList" parameterType="ApsWorkOrderJob" resultMap="ApsWorkOrderJobResult"> 
 | 
        <include refid="selectApsWorkOrderJobVo"/> 
 | 
        <where>   
 | 
            <if test="orderId != null  and orderId != ''"> and order_id = #{orderId}</if> 
 | 
            <if test="docNo != null  and docNo != ''"> and doc_no = #{docNo}</if> 
 | 
            <if test="mainitemCode != null  and mainitemCode != ''"> and mainitem_code = #{mainitemCode}</if> 
 | 
            <if test="mainitemFigure != null  and mainitemFigure != ''"> and mainitem_figure = #{mainitemFigure}</if> 
 | 
            <if test="customerName != null  and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if> 
 | 
            <if test="businessType != null "> and business_type = #{businessType}</if> 
 | 
            <if test="demandType != null  and demandType != ''"> and demand_type = #{demandType}</if> 
 | 
            <if test="docStatus != null "> and doc_status = #{docStatus}</if> 
 | 
            <if test="itemCode != null  and itemCode != ''"> and item_code = #{itemCode}</if> 
 | 
            <if test="itemFigure != null  and itemFigure != ''"> and item_figure = #{itemFigure}</if> 
 | 
            <if test="itemFigureVersion != null  and itemFigureVersion != ''"> and item_figure_version = #{itemFigureVersion}</if> 
 | 
            <if test="pruductQty != null "> and pruduct_qty = #{pruductQty}</if> 
 | 
            <if test="workQty != null "> and work_qty = #{workQty}</if> 
 | 
            <if test="opNum != null  and opNum != ''"> and op_num = #{opNum}</if> 
 | 
            <if test="workCenter != null "> and work_center = #{workCenter}</if> 
 | 
            <if test="dept != null  and dept != ''"> and dept = #{dept}</if> 
 | 
            <if test="startDate != null  and startDate != ''"> and start_date = #{startDate}</if> 
 | 
            <if test="completeDate != null  and completeDate != ''"> and complete_date = #{completeDate}</if> 
 | 
            <if test="nextDept != null  and nextDept != ''"> and next_dept = #{nextDept}</if> 
 | 
            <if test="isHoldRelease != null "> and is_hold_release = #{isHoldRelease}</if> 
 | 
            <if test="isOutSource != null  and isOutSource != ''"> and is_out_source = #{isOutSource}</if> 
 | 
            <if test="org != null  and org != ''"> and org = #{org}</if> 
 | 
            <if test="pageNum != null "> and page_num = #{pageNum}</if> 
 | 
            <if test="pageIndex != null "> and page_index = #{pageIndex}</if> 
 | 
            <if test="orgCode != null  and orgCode != ''"> and org_code = #{orgCode}</if> 
 | 
            <if test="processStatus != null  and processStatus != ''"> and process_status = #{processStatus}</if> 
 | 
            <if test="delFlag != null  and delFlag != ''"> and del_flag = #{delFlag}</if> 
 | 
        </where> 
 | 
    </select> 
 | 
     
 | 
    <select id="selectApsWorkOrderJobById" parameterType="Long" resultMap="ApsWorkOrderJobResult"> 
 | 
        <include refid="selectApsWorkOrderJobVo"/> 
 | 
        where id = #{id} 
 | 
    </select> 
 | 
  
 | 
    <insert id="insertApsWorkOrderJob" parameterType="ApsWorkOrderJob" useGeneratedKeys="true" keyProperty="id"> 
 | 
        insert into aps_work_order_job 
 | 
        <trim prefix="(" suffix=")" suffixOverrides=","> 
 | 
            <if test="orderId != null">order_id,</if> 
 | 
            <if test="docNo != null">doc_no,</if> 
 | 
            <if test="mainitemCode != null">mainitem_code,</if> 
 | 
            <if test="mainitemFigure != null">mainitem_figure,</if> 
 | 
            <if test="customerName != null">customer_name,</if> 
 | 
            <if test="businessType != null">business_type,</if> 
 | 
            <if test="demandType != null">demand_type,</if> 
 | 
            <if test="docStatus != null">doc_status,</if> 
 | 
            <if test="itemCode != null">item_code,</if> 
 | 
            <if test="itemFigure != null">item_figure,</if> 
 | 
            <if test="itemFigureVersion != null">item_figure_version,</if> 
 | 
            <if test="pruductQty != null">pruduct_qty,</if> 
 | 
            <if test="workQty != null">work_qty,</if> 
 | 
            <if test="opNum != null">op_num,</if> 
 | 
            <if test="workCenter != null">work_center,</if> 
 | 
            <if test="dept != null">dept,</if> 
 | 
            <if test="startDate != null">start_date,</if> 
 | 
            <if test="completeDate != null">complete_date,</if> 
 | 
            <if test="nextDept != null">next_dept,</if> 
 | 
            <if test="isHoldRelease != null">is_hold_release,</if> 
 | 
            <if test="isOutSource != null">is_out_source,</if> 
 | 
            <if test="org != null">org,</if> 
 | 
            <if test="pageNum != null">page_num,</if> 
 | 
            <if test="pageIndex != null">page_index,</if> 
 | 
            <if test="delFlag != null">del_flag,</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="orgCode != null">org_code,</if> 
 | 
            <if test="processStatus != null">process_status,</if> 
 | 
         </trim> 
 | 
        <trim prefix="values (" suffix=")" suffixOverrides=","> 
 | 
            <if test="orderId != null">#{orderId},</if> 
 | 
            <if test="docNo != null">#{docNo},</if> 
 | 
            <if test="mainitemCode != null">#{mainitemCode},</if> 
 | 
            <if test="mainitemFigure != null">#{mainitemFigure},</if> 
 | 
            <if test="customerName != null">#{customerName},</if> 
 | 
            <if test="businessType != null">#{businessType},</if> 
 | 
            <if test="demandType != null">#{demandType},</if> 
 | 
            <if test="docStatus != null">#{docStatus},</if> 
 | 
            <if test="itemCode != null">#{itemCode},</if> 
 | 
            <if test="itemFigure != null">#{itemFigure},</if> 
 | 
            <if test="itemFigureVersion != null">#{itemFigureVersion},</if> 
 | 
            <if test="pruductQty != null">#{pruductQty},</if> 
 | 
            <if test="workQty != null">#{workQty},</if> 
 | 
            <if test="opNum != null">#{opNum},</if> 
 | 
            <if test="workCenter != null">#{workCenter},</if> 
 | 
            <if test="dept != null">#{dept},</if> 
 | 
            <if test="startDate != null">#{startDate},</if> 
 | 
            <if test="completeDate != null">#{completeDate},</if> 
 | 
            <if test="nextDept != null">#{nextDept},</if> 
 | 
            <if test="isHoldRelease != null">#{isHoldRelease},</if> 
 | 
            <if test="isOutSource != null">#{isOutSource},</if> 
 | 
            <if test="org != null">#{org},</if> 
 | 
            <if test="pageNum != null">#{pageNum},</if> 
 | 
            <if test="pageIndex != null">#{pageIndex},</if> 
 | 
            <if test="delFlag != null">#{delFlag},</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="orgCode != null">#{orgCode},</if> 
 | 
            <if test="processStatus != null">#{processStatus},</if> 
 | 
         </trim> 
 | 
    </insert> 
 | 
  
 | 
    <update id="updateApsWorkOrderJob" parameterType="ApsWorkOrderJob"> 
 | 
        update aps_work_order_job 
 | 
        <trim prefix="SET" suffixOverrides=","> 
 | 
            <if test="orderId != null">order_id = #{orderId},</if> 
 | 
            <if test="docNo != null">doc_no = #{docNo},</if> 
 | 
            <if test="mainitemCode != null">mainitem_code = #{mainitemCode},</if> 
 | 
            <if test="mainitemFigure != null">mainitem_figure = #{mainitemFigure},</if> 
 | 
            <if test="customerName != null">customer_name = #{customerName},</if> 
 | 
            <if test="businessType != null">business_type = #{businessType},</if> 
 | 
            <if test="demandType != null">demand_type = #{demandType},</if> 
 | 
            <if test="docStatus != null">doc_status = #{docStatus},</if> 
 | 
            <if test="itemCode != null">item_code = #{itemCode},</if> 
 | 
            <if test="itemFigure != null">item_figure = #{itemFigure},</if> 
 | 
            <if test="itemFigureVersion != null">item_figure_version = #{itemFigureVersion},</if> 
 | 
            <if test="pruductQty != null">pruduct_qty = #{pruductQty},</if> 
 | 
            <if test="workQty != null">work_qty = #{workQty},</if> 
 | 
            <if test="opNum != null">op_num = #{opNum},</if> 
 | 
            <if test="workCenter != null">work_center = #{workCenter},</if> 
 | 
            <if test="dept != null">dept = #{dept},</if> 
 | 
            <if test="startDate != null">start_date = #{startDate},</if> 
 | 
            <if test="completeDate != null">complete_date = #{completeDate},</if> 
 | 
            <if test="nextDept != null">next_dept = #{nextDept},</if> 
 | 
            <if test="isHoldRelease != null">is_hold_release = #{isHoldRelease},</if> 
 | 
            <if test="isOutSource != null">is_out_source = #{isOutSource},</if> 
 | 
            <if test="org != null">org = #{org},</if> 
 | 
            <if test="pageNum != null">page_num = #{pageNum},</if> 
 | 
            <if test="pageIndex != null">page_index = #{pageIndex},</if> 
 | 
            <if test="delFlag != null">del_flag = #{delFlag},</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="orgCode != null"> org_code= #{orgCode},</if> 
 | 
            <if test="processStatus != null"> process_status= #{processStatus},</if> 
 | 
        </trim> 
 | 
        where id = #{id} 
 | 
    </update> 
 | 
  
 | 
    <delete id="deleteApsWorkOrderJobById" parameterType="Long"> 
 | 
        delete from aps_work_order_job where id = #{id} 
 | 
    </delete> 
 | 
  
 | 
    <delete id="deleteApsWorkOrderJobByIds" parameterType="String"> 
 | 
        delete from aps_work_order_job where id in  
 | 
        <foreach item="id" collection="array" open="(" separator="," close=")"> 
 | 
            #{id} 
 | 
        </foreach> 
 | 
    </delete> 
 | 
  
 | 
    <insert id="batchInsertApsWorkOrderJob" parameterType="java.util.List"> 
 | 
        insert into aps_work_order_job 
 | 
        <trim prefix="(" suffix=")" suffixOverrides=","> 
 | 
            order_id, 
 | 
            doc_no, 
 | 
            mainitem_code, 
 | 
            mainitem_figure, 
 | 
            customer_name, 
 | 
            business_type, 
 | 
            demand_type, 
 | 
            doc_status, 
 | 
            item_code, 
 | 
            item_figure, 
 | 
            item_figure_version, 
 | 
            pruduct_qty, 
 | 
            work_qty, 
 | 
            op_num, 
 | 
            work_center, 
 | 
            dept, 
 | 
            start_date, 
 | 
            complete_date, 
 | 
            next_dept, 
 | 
            is_hold_release, 
 | 
            is_out_source, 
 | 
            org, 
 | 
            page_num, 
 | 
            page_index, 
 | 
            del_flag, 
 | 
            create_by, 
 | 
            create_time, 
 | 
            update_by, 
 | 
            update_time, 
 | 
            org_code, 
 | 
            process_status 
 | 
        </trim> 
 | 
        values 
 | 
        <foreach collection="list" item="job" separator=","> 
 | 
            ( 
 | 
            #{job.orderId}, 
 | 
            #{job.docNo}, 
 | 
            #{job.mainitemCode}, 
 | 
            #{job.mainitemFigure}, 
 | 
            #{job.customerName}, 
 | 
            #{job.businessType}, 
 | 
            #{job.demandType}, 
 | 
            #{job.docStatus}, 
 | 
            #{job.itemCode}, 
 | 
            #{job.itemFigure}, 
 | 
            #{job.itemFigureVersion}, 
 | 
            #{job.pruductQty}, 
 | 
            #{job.workQty}, 
 | 
            #{job.opNum}, 
 | 
            #{job.workCenter}, 
 | 
            #{job.dept}, 
 | 
            #{job.startDate}, 
 | 
            #{job.completeDate}, 
 | 
            #{job.nextDept}, 
 | 
            #{job.isHoldRelease}, 
 | 
            #{job.isOutSource}, 
 | 
            #{job.org}, 
 | 
            #{job.pageNum}, 
 | 
            #{job.pageIndex}, 
 | 
            #{job.delFlag}, 
 | 
            #{job.createBy}, 
 | 
            #{job.createTime}, 
 | 
            #{job.updateBy}, 
 | 
            #{job.updateTime}, 
 | 
            #{job.orgCode}, 
 | 
            #{job.processStatus} 
 | 
            ) 
 | 
        </foreach> 
 | 
    </insert> 
 | 
  
 | 
</mapper> 
 |