你好啊
2024-08-09 9eb61cbf0da06bb41c4f8f3e9a53ae48b77cdb5e
north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -768,4 +768,86 @@
    </update>
    <select id="getSelectSurplusMaterialsDate" >
        select *
        from mm.surplus_materials
        <where>
                and date(create_time)>=#{startDate} and date(create_time) &lt;= #{endDate} and quantity>0
            <if test="surplusMaterials.width != null and surplusMaterials.width != ''">
                and width regexp #{surplusMaterials.width}
            </if>
            <if test="surplusMaterials.height != null and surplusMaterials.height != ''">
                and height regexp #{surplusMaterials.height}
            </if>
            <if test="surplusMaterials.thickness != null and surplusMaterials.thickness != ''">
                and thickness regexp #{surplusMaterials.thickness}
            </if>
            <if test="surplusMaterials.quantity != null and surplusMaterials.quantity != ''">
                and quantity regexp #{surplusMaterials.quantity}
            </if>
            <if test="surplusMaterials.colour != null and surplusMaterials.colour != ''">
                and colour regexp #{surplusMaterials.colour}
            </if>
            <if test="surplusMaterials.remarks != null and surplusMaterials.remarks != ''">
                and remarks regexp #{surplusMaterials.remarks}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
    <select id="getSelectSurplusMaterialsDatePageTotal" >
        select CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from mm.surplus_materials
        <where>
            and date(create_time)>=#{startDate} and date(create_time) &lt;= #{endDate} and quantity>0
            <if test="surplusMaterials.width != null and surplusMaterials.width != ''">
                and width regexp #{surplusMaterials.width}
            </if>
            <if test="surplusMaterials.height != null and surplusMaterials.height != ''">
                and height regexp #{surplusMaterials.height}
            </if>
            <if test="surplusMaterials.thickness != null and surplusMaterials.thickness != ''">
                and thickness regexp #{surplusMaterials.thickness}
            </if>
            <if test="surplusMaterials.quantity != null and surplusMaterials.quantity != ''">
                and quantity regexp #{surplusMaterials.quantity}
            </if>
            <if test="surplusMaterials.colour != null and surplusMaterials.colour != ''">
                and colour regexp #{surplusMaterials.colour}
            </if>
            <if test="surplusMaterials.remarks != null and surplusMaterials.remarks != ''">
                and remarks regexp #{surplusMaterials.remarks}
            </if>
        </where>
    </select>
    <select id="selectSurplusMaterialsCount" >
        select *
        from mm.surplus_materials
        where width=#{surplusMaterials.width} and height=#{surplusMaterials.height}
          and thickness=#{surplusMaterials.thickness} and colour=#{surplusMaterials.colour} limit 0,1
    </select>
    <insert id="insertSurplusMaterials">
        insert into mm.surplus_materials (width,height,thickness,quantity,colour,create_time)
        values (#{surplusMaterials.width},#{surplusMaterials.height},#{surplusMaterials.thickness},#{surplusMaterials.quantity},#{surplusMaterials.colour},now())
    </insert>
    <insert id="insertSurplusMaterialsLog">
        insert into mm.surplus_materials_log (width,height,thickness,quantity,colour,type,creator,create_time)
        values (#{surplusMaterials.width},#{surplusMaterials.height},#{surplusMaterials.thickness},
                #{surplusMaterials.quantity},#{surplusMaterials.colour},#{type},#{creator},now())
    </insert>
    <update id="updateSurplusMaterialsOutQuantity">
        update mm.surplus_materials set quantity=quantity-#{surplusMaterials.quantity} where id=#{surplusMaterials.id}
    </update>
    <update id="updateSurplusMaterialsIntQuantity">
        update mm.surplus_materials set quantity=quantity+#{surplusMaterials.quantity} where id=#{surplusMaterials.id}
    </update>
</mapper>