chengf
2026-03-24 b2358fc44148073645def4e723c8153a98a701da
java110-db/src/main/resources/mapper/store/PurchaseApplyServiceDaoImplMapper.xml
@@ -63,9 +63,15 @@
    <!-- 保存采购明细表-->
    <insert id="savePurchaseApplyDetailInfo" parameterType="List">
        insert into purchase_apply_detail
        (id,rs_id,apply_order_id,res_id,quantity,remark,b_id,operate,status_cd,price,purchase_quantity,purchase_remark,original_stock,times_id,consult_price)
        values
        INSERT INTO purchase_apply_detail (
        id, rs_id, apply_order_id, res_id, quantity, remark, b_id, operate, status_cd, price,
        purchase_quantity, purchase_remark, original_stock, times_id, consult_price,
        purchase_date2, purchase_quantity2, purchase_date3, purchase_quantity3,
        first_cumulative_purchase_quantity, purchase_date, purchase_amount, purchaser,
        contract_no, supplier, first_cumulative_delivery_quantity, delivery_order_no,
        delivery_quantity, delivery_date, signer
        )
        VALUES
        <foreach collection="list" item="item" index="index" separator=",">
            (
            #{item.id},
@@ -82,9 +88,24 @@
            #{item.purchaseRemark},
            #{item.originalStock},
            #{item.timesId},
            #{item.consultPrice}
            #{item.consultPrice},
            #{item.purchaseDate2},
            #{item.purchaseQuantity2},
            #{item.purchaseDate3},
            #{item.purchaseQuantity3},
            #{item.firstCumulativePurchaseQuantity},
            #{item.purchaseDate},
            #{item.purchaseAmount},
            #{item.purchaser},
            #{item.contractNo},
            #{item.supplier},
            #{item.firstCumulativeDeliveryQuantity},
            #{item.deliveryOrderNo},
            #{item.deliveryQuantity},
            #{item.deliveryDate},
            #{item.signer}
            )
        </foreach>
        </foreach>;
    </insert>
    <!-- 查询采购申请信息(Business) add by wuxw 2018-07-03 -->
@@ -278,7 +299,7 @@
        <if test="endTime !=null and endTime != ''">
            and t.create_time &lt;= #{endTime}
        </if>
        group by t.apply_order_id order by t.create_time desc
        order by t.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
@@ -432,8 +453,8 @@
    <!-- 查询采购申请数量 add by wuxw 2018-07-03 -->
    <select id="queryPurchaseApplysCount" parameterType="Map" resultType="Map">
        select count(1) count from
        (select t.apply_order_id from purchase_apply t
        select count(1) count
        from purchase_apply t
        left join purchase_apply_detail de on t.apply_order_id = de.apply_order_id and de.status_cd = '0'
        left join resource_store rs on de.res_id = rs.res_id and rs.status_cd = '0'
        where 1 = 1
@@ -464,6 +485,9 @@
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
@@ -498,18 +522,21 @@
        <if test='urgentFlag !=null and urgentFlag == "1"'>
            and date_format(t.create_time,'%Y-%m') = date_format(now(),'%Y-%m')
        </if>
        group by t.apply_order_id)A
    </select>
    <!-- 保存采购申请信息 add by wuxw 2018-07-03 -->
    <insert id="savePurchaseApply" parameterType="Map">
        insert into purchase_apply
        (status_cd, res_order_type, description, apply_order_id, state, store_id, user_id, user_name, b_id,
         end_user_name, end_user_tel,
         create_time, create_user_id, create_user_name, warehousing_way, community_id)
        values ('0', #{resOrderType}, #{description}, #{applyOrderId}, #{state}, #{storeId}, #{userId}, #{userName},
                '-1', #{endUserName}, #{endUserTel},
                #{createTime}, #{createUserId}, #{createUserName}, #{warehousingWay}, #{communityId})
        INSERT INTO purchase_apply (
        status_cd, res_order_type, description, apply_order_id, state, store_id, user_id, user_name, b_id,
        end_user_name, end_user_tel,
        create_time, create_user_id, create_user_name, warehousing_way, community_id,
        apply_no, apply_date, approver, apply_quantity
        )
        VALUES (
        '0', #{resOrderType}, #{description}, #{applyOrderId}, #{state}, #{storeId}, #{userId}, #{userName}, '-1',
        #{endUserName}, #{endUserTel}, #{createTime}, #{createUserId}, #{createUserName}, #{warehousingWay}, #{communityId},
        #{applyNo}, #{applyDate}, #{approver}, #{applyQuantity}
        );
    </insert>
    <!--查询下级用户id-->