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.

156 lines
9.6 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.hw.mes.mapper.MesPurchaseOrderMapper">
<resultMap type="MesPurchaseOrder" id="MesPurchaseOrderResult">
<result property="purchaseOrderId" column="purchase_order_id" />
<result property="erpId" column="erp_id" />
<result property="fentryId" column="fentry_id" />
<result property="poNo" column="po_no" />
<result property="documentStatus" column="document_status" />
<result property="materialId" column="material_id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="orderAmount" column="order_amount" />
<result property="completeAmount" column="complete_amount" />
<result property="approveDate" column="approve_date" />
<result property="erpModifyDate" column="erp_modify_date" />
<result property="planDeliveryDate" column="plan_delivery_date" />
<result property="beginDate" column="begin_date" />
<result property="endDate" column="end_date" />
<result property="orderStatus" column="order_status" />
<result property="completeDate" column="complete_date" />
<result property="isFlag" column="is_flag" />
<result property="remark" column="remark" />
<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="selectMesPurchaseOrderVo">
select purchase_order_id, erp_id, fentry_id, po_no, document_status, material_id, material_code, material_name, order_amount, complete_amount, approve_date, erp_modify_date, plan_delivery_date, begin_date, end_date, order_status, complete_date, is_flag, remark, create_by, create_time, update_by, update_time from mes_purchase_order
</sql>
<select id="selectMesPurchaseOrderList" parameterType="MesPurchaseOrder" resultMap="MesPurchaseOrderResult">
<include refid="selectMesPurchaseOrderVo"/>
<where>
<if test="erpId != null "> and erp_id = #{erpId}</if>
<if test="fentryId != null "> and fentry_id = #{fentryId}</if>
<if test="poNo != null and poNo != ''"> and po_no = #{poNo}</if>
<if test="documentStatus != null and documentStatus != ''"> and document_status = #{documentStatus}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="orderAmount != null "> and order_amount = #{orderAmount}</if>
<if test="completeAmount != null "> and complete_amount = #{completeAmount}</if>
<if test="approveDate != null "> and approve_date = #{approveDate}</if>
<if test="erpModifyDate != null "> and erp_modify_date = #{erpModifyDate}</if>
<if test="planDeliveryDate != null "> and plan_delivery_date = #{planDeliveryDate}</if>
<if test="beginDate != null "> and begin_date = #{beginDate}</if>
<if test="endDate != null "> and end_date = #{endDate}</if>
<if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if>
<if test="completeDate != null "> and complete_date = #{completeDate}</if>
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag}</if>
</where>
</select>
<select id="selectMesPurchaseOrderByPurchaseOrderId" parameterType="Long" resultMap="MesPurchaseOrderResult">
<include refid="selectMesPurchaseOrderVo"/>
where purchase_order_id = #{purchaseOrderId}
</select>
<insert id="insertMesPurchaseOrder" parameterType="MesPurchaseOrder" useGeneratedKeys="true" keyProperty="purchaseOrderId">
insert into mes_purchase_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="erpId != null">erp_id,</if>
<if test="fentryId != null">fentry_id,</if>
<if test="poNo != null">po_no,</if>
<if test="documentStatus != null">document_status,</if>
<if test="materialId != null">material_id,</if>
<if test="materialCode != null and materialCode != ''">material_code,</if>
<if test="materialName != null">material_name,</if>
<if test="orderAmount != null">order_amount,</if>
<if test="completeAmount != null">complete_amount,</if>
<if test="approveDate != null">approve_date,</if>
<if test="erpModifyDate != null">erp_modify_date,</if>
<if test="planDeliveryDate != null">plan_delivery_date,</if>
<if test="beginDate != null">begin_date,</if>
<if test="endDate != null">end_date,</if>
<if test="orderStatus != null">order_status,</if>
<if test="completeDate != null">complete_date,</if>
<if test="isFlag != null and isFlag != ''">is_flag,</if>
<if test="remark != null">remark,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="erpId != null">#{erpId},</if>
<if test="fentryId != null">#{fentryId},</if>
<if test="poNo != null">#{poNo},</if>
<if test="documentStatus != null">#{documentStatus},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="orderAmount != null">#{orderAmount},</if>
<if test="completeAmount != null">#{completeAmount},</if>
<if test="approveDate != null">#{approveDate},</if>
<if test="erpModifyDate != null">#{erpModifyDate},</if>
<if test="planDeliveryDate != null">#{planDeliveryDate},</if>
<if test="beginDate != null">#{beginDate},</if>
<if test="endDate != null">#{endDate},</if>
<if test="orderStatus != null">#{orderStatus},</if>
<if test="completeDate != null">#{completeDate},</if>
<if test="isFlag != null and isFlag != ''">#{isFlag},</if>
<if test="remark != null">#{remark},</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>
</trim>
</insert>
<update id="updateMesPurchaseOrder" parameterType="MesPurchaseOrder">
update mes_purchase_order
<trim prefix="SET" suffixOverrides=",">
<if test="erpId != null">erp_id = #{erpId},</if>
<if test="fentryId != null">fentry_id = #{fentryId},</if>
<if test="poNo != null">po_no = #{poNo},</if>
<if test="documentStatus != null">document_status = #{documentStatus},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialCode != null and materialCode != ''">material_code = #{materialCode},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="orderAmount != null">order_amount = #{orderAmount},</if>
<if test="completeAmount != null">complete_amount = #{completeAmount},</if>
<if test="approveDate != null">approve_date = #{approveDate},</if>
<if test="erpModifyDate != null">erp_modify_date = #{erpModifyDate},</if>
<if test="planDeliveryDate != null">plan_delivery_date = #{planDeliveryDate},</if>
<if test="beginDate != null">begin_date = #{beginDate},</if>
<if test="endDate != null">end_date = #{endDate},</if>
<if test="orderStatus != null">order_status = #{orderStatus},</if>
<if test="completeDate != null">complete_date = #{completeDate},</if>
<if test="isFlag != null and isFlag != ''">is_flag = #{isFlag},</if>
<if test="remark != null">remark = #{remark},</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>
</trim>
where purchase_order_id = #{purchaseOrderId}
</update>
<delete id="deleteMesPurchaseOrderByPurchaseOrderId" parameterType="Long">
delete from mes_purchase_order where purchase_order_id = #{purchaseOrderId}
</delete>
<delete id="deleteMesPurchaseOrderByPurchaseOrderIds" parameterType="String">
delete from mes_purchase_order where purchase_order_id in
<foreach item="purchaseOrderId" collection="array" open="(" separator="," close=")">
#{purchaseOrderId}
</foreach>
</delete>
</mapper>