hdy
2025-02-26 a2cd0f560c226d7830c79fa3c0a6cb3db72927b4
billion-main/src/main/resources/mapper/om/OmProductionOrderInfoMapper.xml
@@ -26,6 +26,61 @@
        select id, work_order_no, sales_order_code, product_code, line_code, plan_qty, plan_start_time, plan_end_time, order_status, create_time, update_time, create_by, update_by, remarks, del_flag from om_production_order_info
    </sql>
    <!-- 查询 order_status 为 1 且 plan_start_time 最早的一条记录 -->
    <select id="selectEarliestOrder" resultType="OmProductionOrderInfo">
            SELECT TOP 1 *
            FROM om_production_order_info
            WHERE order_status IN (1, 2)
            ORDER BY plan_start_time ASC
    </select>
    <select id="selectEarliestOrder2" resultType="OmProductionOrderInfo">
        SELECT TOP 1 *
        FROM om_production_order_info
        WHERE order_status IN (5)
        ORDER BY plan_start_time ASC
    </select>
    <select id="updateOrderStatus" resultType="OmProductionOrderInfo">
        UPDATE om_production_order_info
        SET order_status = 5
        WHERE id = (
            SELECT TOP 1 id
            FROM om_production_order_info
            WHERE order_status IN (1, 2)
            ORDER BY plan_start_time ASC
        );
    </select>
    <select id="updateOrderStatus2" resultType="OmProductionOrderInfo">
        UPDATE om_production_order_info
        SET order_status = 2
        WHERE id = (
            SELECT TOP 1 id
            FROM om_production_order_info
            WHERE order_status IN (1, 2)
            ORDER BY plan_start_time ASC
        );
    </select>
    <select id="getSerialNumber" resultType="OmProductionOrderInfo">
        SELECT  *
        FROM om_production_order_info
        WHERE id = 1
    </select>
    <select id="updateSerialNumber" resultType="OmProductionOrderInfo">
        UPDATE om_production_order_info
        SET plan_qty = plan_qty + 1
        WHERE id = 1;
    </select>
    <select id="updateYear" resultType="OmProductionOrderInfo">
        UPDATE om_production_order_info
        SET remarks = remarks + 1,
            qty = 1
        WHERE id = 1;
    </select>
    <select id="selectOmProductionOrderInfoList" parameterType="OmProductionOrderInfo" resultMap="OmProductionOrderInfoResult">
        <include refid="selectOmProductionOrderInfoVo"/>
        <where>  
@@ -33,13 +88,13 @@
            <if test="salesOrderCode != null  and salesOrderCode != ''"> and sales_order_code = #{salesOrderCode}</if>
            <if test="productCode != null  and productCode != ''"> and product_code = #{productCode}</if>
            <if test="orderStatus != null  and orderStatus != ''"> and order_status = #{orderStatus}</if>
            and del_flag = "0"
            and del_flag = 0
        </where>
    </select>
    
    <select id="selectOmProductionOrderInfoById" parameterType="Long" resultMap="OmProductionOrderInfoResult">
        <include refid="selectOmProductionOrderInfoVo"/>
        where id = #{id} and del_flag = "0"
        where id = #{id} and del_flag = 0
    </select>
    <insert id="insertOmProductionOrderInfo" parameterType="OmProductionOrderInfo" useGeneratedKeys="true" keyProperty="id">
@@ -100,11 +155,11 @@
    </update>
    <update id="deleteOmProductionOrderInfoById" parameterType="Long">
        update om_production_order_info set del_flag = "1" where id = #{id}
        update om_production_order_info set del_flag = 1 where id = #{id}
    </update>
    <update id="deleteOmProductionOrderInfoByIds" parameterType="String">
        update om_production_order_info set del_flag = "1" where id in
        update om_production_order_info set del_flag = 1 where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>