From d3d6287a3222b9c85a56e4c55c35350c4233c7db Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期二, 24 六月 2025 18:05:41 +0800
Subject: [PATCH] 库存管理简练

---
 src/main/resources/mapper/inventory/StockInMapper.xml |   48 ++++++++++++++++++++----------------------------
 1 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/src/main/resources/mapper/StockInMapper.xml b/src/main/resources/mapper/inventory/StockInMapper.xml
similarity index 76%
rename from src/main/resources/mapper/StockInMapper.xml
rename to src/main/resources/mapper/inventory/StockInMapper.xml
index 3aa07c7..5f161e7 100644
--- a/src/main/resources/mapper/StockInMapper.xml
+++ b/src/main/resources/mapper/inventory/StockInMapper.xml
@@ -2,9 +2,9 @@
 <!DOCTYPE mapper
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="inventory.mapper.StockInMapper">
+<mapper namespace="com.ruoyi.inventory.mapper.StockInMapper">
 
-    <resultMap id="BaseResultMap" type="inventory.domain.StockIn">
+    <resultMap id="BaseResultMap" type="com.ruoyi.inventory.domain.StockIn">
             <id property="id" column="id" jdbcType="INTEGER"/>
             <result property="productId" column="product_id" jdbcType="INTEGER"/>
             <result property="inboundTime" column="inbound_time" jdbcType="TIMESTAMP"/>
@@ -16,6 +16,10 @@
             <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"/>
+            <collection property="stockProducts" ofType="com.ruoyi.inventory.domain.StockProduct"
+                        select="com.ruoyi.inventory.mapper.StockProductMapper.selectByPrimaryKey" column="productId">
+                <id property="id" column="productId" jdbcType="INTEGER"/>
+            </collection>
     </resultMap>
 
     <sql id="Base_Column_List">
@@ -31,22 +35,23 @@
         from stock_in
         where  id = #{id,jdbcType=INTEGER} 
     </select>
+    <select id="selectList" resultType="com.ruoyi.inventory.domain.StockIn">
+        select
+        <include refid="Base_Column_List" />
+        from stock_in
+    </select>
+    <select id="selectListByPage" resultType="com.ruoyi.inventory.domain.StockIn">
+        select
+        <include refid="Base_Column_List" />
+        from stock_in
+        limit #{pageNum},#{pageSize}
+    </select>
 
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
         delete from stock_in
         where  id = #{id,jdbcType=INTEGER} 
     </delete>
-    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="inventory.domain.StockIn" useGeneratedKeys="true">
-        insert into stock_in
-        ( id,product_id,inbound_time
-        ,inbound_batch,supplier_name,inbound_quantity
-        ,tax_inclusive_price,tax_inclusive_total,tax_rate
-        ,tax_exclusive_total,inbound_person)
-        values (#{id,jdbcType=INTEGER},#{productId,jdbcType=INTEGER},#{inboundTime,jdbcType=TIMESTAMP}
-        ,#{inboundBatch,jdbcType=VARCHAR},#{supplierName,jdbcType=VARCHAR},#{inboundQuantity,jdbcType=INTEGER}
-        ,#{taxInclusivePrice,jdbcType=DECIMAL},#{taxInclusiveTotal,jdbcType=DECIMAL},#{taxRate,jdbcType=DECIMAL}
-        ,#{taxExclusiveTotal,jdbcType=DECIMAL},#{inboundPerson,jdbcType=VARCHAR})
-    </insert>
+
     <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="inventory.domain.StockIn" useGeneratedKeys="true">
         insert into stock_in
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -76,6 +81,7 @@
                 <if test="inboundPerson != null">#{inboundPerson,jdbcType=VARCHAR},</if>
         </trim>
     </insert>
+
     <update id="updateByPrimaryKeySelective" parameterType="inventory.domain.StockIn">
         update stock_in
         <set>
@@ -112,19 +118,5 @@
         </set>
         where   id = #{id,jdbcType=INTEGER} 
     </update>
-    <update id="updateByPrimaryKey" parameterType="inventory.domain.StockIn">
-        update stock_in
-        set 
-            product_id =  #{productId,jdbcType=INTEGER},
-            inbound_time =  #{inboundTime,jdbcType=TIMESTAMP},
-            inbound_batch =  #{inboundBatch,jdbcType=VARCHAR},
-            supplier_name =  #{supplierName,jdbcType=VARCHAR},
-            inbound_quantity =  #{inboundQuantity,jdbcType=INTEGER},
-            tax_inclusive_price =  #{taxInclusivePrice,jdbcType=DECIMAL},
-            tax_inclusive_total =  #{taxInclusiveTotal,jdbcType=DECIMAL},
-            tax_rate =  #{taxRate,jdbcType=DECIMAL},
-            tax_exclusive_total =  #{taxExclusiveTotal,jdbcType=DECIMAL},
-            inbound_person =  #{inboundPerson,jdbcType=VARCHAR}
-        where   id = #{id,jdbcType=INTEGER} 
-    </update>
+
 </mapper>

--
Gitblit v1.9.3