From 5c1a58d067512df6099f9cc95f577c9991128163 Mon Sep 17 00:00:00 2001 From: lishenao <3065849776@qq.com> Date: 星期一, 30 六月 2025 15:16:09 +0800 Subject: [PATCH] 入库管理,出库管理,库存管理后端接口 --- src/main/resources/mapper/inventory/StockManagementMapper.xml | 149 ++++++++++++++++++++++--------------------------- 1 files changed, 68 insertions(+), 81 deletions(-) diff --git a/src/main/resources/mapper/inventory/StockManagementMapper.xml b/src/main/resources/mapper/inventory/StockManagementMapper.xml index f46d1e2..a1f6ef4 100644 --- a/src/main/resources/mapper/inventory/StockManagementMapper.xml +++ b/src/main/resources/mapper/inventory/StockManagementMapper.xml @@ -4,89 +4,76 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ruoyi.inventory.mapper.StockManagementMapper"> - <resultMap id="BaseResultMap" type="com.ruoyi.inventory.pojo.StockManagement"> - <id property="id" column="id" jdbcType="INTEGER"/> - <result property="productId" column="product_id" jdbcType="INTEGER"/> - <result property="stockQuantity" column="stock_quantity" jdbcType="INTEGER"/> - <result property="taxInclusivePrice" column="tax_inclusive_price" jdbcType="DECIMAL"/> - <result property="taxInclusiveTotal" column="tax_inclusive_total" jdbcType="DECIMAL"/> - <result property="taxRate" column="tax_rate" jdbcType="DECIMAL"/> - <result property="taxExclusiveTotal" column="tax_exclusive_total" jdbcType="DECIMAL"/> - <result property="inboundPerson" column="inbound_person" jdbcType="VARCHAR"/> - </resultMap> - - <sql id="Base_Column_List"> - id,product_id,stock_quantity, - tax_inclusive_price,tax_inclusive_total,tax_rate, - tax_exclusive_total,inbound_person - </sql> - - <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> - select - <include refid="Base_Column_List" /> - from stock_management - where id = #{id,jdbcType=INTEGER} - </select> - <select id="selectAll" resultType="com.ruoyi.inventory.pojo.StockManagement"> - select - <include refid="Base_Column_List" /> - from stock_management +<!-- 鏍规嵁渚涘簲鍟嗘ā绯婃悳绱�--> + <select id="selectStockManagementBypage" resultType="com.ruoyi.inventory.dto.StockManagementDto"> + SELECT + T2.unit, + T2.product_category, + T2.specification_model, + T3.supplier_name, + T1.id, + T1.product_id, + T1.stock_quantity, + T2.tax_inclusive_unit_price, + T2.tax_inclusive_total_price, + T2.tax_rate, + T2.tax_exclusive_total_price, + T1.inbound_person, + T1.supplier_id, + T1.tenant_id, + T1.bound_time, + T1.inbound_time + FROM + stock_management T1 + INNER JOIN + product_record T2 + ON + T1.product_id = T2.product_id + INNER JOIN + supplier_manage T3 + ON + T1.supplier_id = T3.id + <where> + <if test="stockManagementDto.supplierName != null and stockManagementDto.supplierName != ''"> + AND T3.supplier_name LIKE CONCAT('%', #{stockManagementDto.supplierName}, '%') + </if> + </where> </select> - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> - delete from stock_management - where id = #{id,jdbcType=INTEGER} - </delete> + <select id="stockManageExportList" resultType="com.ruoyi.inventory.excel.StockManagementExcelDto"> + SELECT + T2.unit, + T2.product_category, + T2.specification_model, + T3.supplier_name, + T1.id, + T1.product_id, + T1.stock_quantity, + T2.tax_inclusive_unit_price, + T2.tax_inclusive_total_price, + T2.tax_rate, + T2.tax_exclusive_total_price, + T1.inbound_person, + T1.supplier_id, + T1.tenant_id, + T1.bound_time, + T1.inbound_time + FROM + stock_management T1 + INNER JOIN + product_record T2 + ON + T1.product_id = T2.product_id + INNER JOIN + supplier_manage T3 + ON + T1.supplier_id = T3.id + <where> + <if test="stockManagementDto.supplierName != null and stockManagementDto.supplierName != ''"> + AND T3.supplier_name LIKE CONCAT('%', #{stockManagementDto.supplierName}, '%') + </if> + </where> + </select> - <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ruoyi.inventory.pojo.StockManagement" useGeneratedKeys="true"> - insert into stock_management - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null">id,</if> - <if test="productId != null">product_id,</if> - <if test="stockQuantity != null">stock_quantity,</if> - <if test="taxInclusivePrice != null">tax_inclusive_price,</if> - <if test="taxInclusiveTotal != null">tax_inclusive_total,</if> - <if test="taxRate != null">tax_rate,</if> - <if test="taxExclusiveTotal != null">tax_exclusive_total,</if> - <if test="inboundPerson != null">inbound_person,</if> - </trim> - <trim prefix="values (" suffix=")" suffixOverrides=","> - <if test="id != null">#{id,jdbcType=INTEGER},</if> - <if test="productId != null">#{productId,jdbcType=INTEGER},</if> - <if test="stockQuantity != null">#{stockQuantity,jdbcType=INTEGER},</if> - <if test="taxInclusivePrice != null">#{taxInclusivePrice,jdbcType=DECIMAL},</if> - <if test="taxInclusiveTotal != null">#{taxInclusiveTotal,jdbcType=DECIMAL},</if> - <if test="taxRate != null">#{taxRate,jdbcType=DECIMAL},</if> - <if test="taxExclusiveTotal != null">#{taxExclusiveTotal,jdbcType=DECIMAL},</if> - <if test="inboundPerson != null">#{inboundPerson,jdbcType=VARCHAR},</if> - </trim> - </insert> - <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.inventory.pojo.StockManagement"> - update stock_management - <set> - <if test="productId != null"> - product_id = #{productId,jdbcType=INTEGER}, - </if> - <if test="stockQuantity != null"> - stock_quantity = #{stockQuantity,jdbcType=INTEGER}, - </if> - <if test="taxInclusivePrice != null"> - tax_inclusive_price = #{taxInclusivePrice,jdbcType=DECIMAL}, - </if> - <if test="taxInclusiveTotal != null"> - tax_inclusive_total = #{taxInclusiveTotal,jdbcType=DECIMAL}, - </if> - <if test="taxRate != null"> - tax_rate = #{taxRate,jdbcType=DECIMAL}, - </if> - <if test="taxExclusiveTotal != null"> - tax_exclusive_total = #{taxExclusiveTotal,jdbcType=DECIMAL}, - </if> - <if test="inboundPerson != null"> - inbound_person = #{inboundPerson,jdbcType=VARCHAR}, - </if> - </set> - where id = #{id,jdbcType=INTEGER} - </update> </mapper> -- Gitblit v1.9.3