|
@@ -10,6 +10,15 @@
|
|
|
<result column="inventory_desc" property="inventoryDesc" jdbcType="VARCHAR" />
|
|
|
<result column="inventory_create_time" property="inventoryCreateTime" jdbcType="TIMESTAMP" />
|
|
|
<result column="inventory_update_time" property="inventoryUpdateTime" jdbcType="TIMESTAMP" />
|
|
|
+ <result column="inventory_product_color_id" property="inventoryProductColorId" jdbcType="INTEGER" />
|
|
|
+ <result column="inventory_good_product_num" property="inventoryGoodProductNum" jdbcType="INTEGER" />
|
|
|
+ <result column="inventory_defective_product_num" property="inventoryDefectiveProductNum" jdbcType="INTEGER" />
|
|
|
+ <result column="inventory_recent_record" property="inventoryRecentRecord" jdbcType="VARCHAR" />
|
|
|
+ <result column="type_name" property="productTypeName" jdbcType="VARCHAR" />
|
|
|
+ <result column="product_number" property="productNumber" jdbcType="VARCHAR" />
|
|
|
+ <result column="product_abbreviation" property="productAbbreviation" jdbcType="VARCHAR" />
|
|
|
+ <result column="color_name" property="productColorName" jdbcType="VARCHAR" />
|
|
|
+ <result column="inventoryMomentumNum" property="inventoryMomentumNum" jdbcType="VARCHAR" />
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List" >
|
|
|
inventory_id,
|
|
@@ -19,38 +28,104 @@
|
|
|
inventory_state,
|
|
|
inventory_desc,
|
|
|
inventory_create_time,
|
|
|
- inventory_update_time
|
|
|
+ inventory_update_time,
|
|
|
+ inventory_product_color_id,
|
|
|
+ inventory_good_product_num,
|
|
|
+ inventory_defective_product_num,
|
|
|
+ inventory_recent_record
|
|
|
</sql>
|
|
|
<select id="getByInventoryId" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
select
|
|
|
- <include refid="Base_Column_List" />
|
|
|
- from tb_rst_fm_inventory
|
|
|
+ fi.inventory_id,
|
|
|
+ fi.inventory_product_name,
|
|
|
+ fi.inventory_product_bar,
|
|
|
+ fi.inventory_remaining_num,
|
|
|
+ fi.inventory_state,
|
|
|
+ fi.inventory_desc,
|
|
|
+ fi.inventory_create_time,
|
|
|
+ fi.inventory_update_time,
|
|
|
+ fi.inventory_product_color_id,
|
|
|
+ fi.inventory_good_product_num,
|
|
|
+ fi.inventory_defective_product_num,
|
|
|
+ fi.inventory_recent_record,
|
|
|
+ pt.type_name,
|
|
|
+ pi.product_number,
|
|
|
+ pi.product_abbreviation,
|
|
|
+ pc.color_name,
|
|
|
+ imn.inventoryMomentumNum
|
|
|
+ from tb_rst_fm_inventory fi
|
|
|
+ LEFT jOIN tb_rst_product_color pc on fi.inventory_product_color_id = pc.color_id
|
|
|
+ LEFT jOIN tb_rst_product_info pi on pc.color_product_id = pi.product_id
|
|
|
+ LEFT jOIN tb_rst_product_type pt on pi.product_type = pt.type_id
|
|
|
+ LEFT jOIN (SELECT
|
|
|
+ SUM(soi.item_num) as inventoryMomentumNum,
|
|
|
+ item_color_id as colorId
|
|
|
+ FROM
|
|
|
+ tb_rst_sales_order_info oi
|
|
|
+ LEFT JOIN tb_rst_sales_order_item soi on soi.item_order_id = oi.sales_id
|
|
|
+
|
|
|
+ WHERE
|
|
|
+ oi.sales_shipping_status IN (0,3,11)
|
|
|
+ GROUP BY soi.item_color_id
|
|
|
+ ) imn on imn.colorId = pc.color_id
|
|
|
where inventory_id = #{inventoryId,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
<select id="listByInventoryId" resultMap="BaseResultMap" parameterType="InventoryInfo" >
|
|
|
select
|
|
|
- inventory_id,
|
|
|
- inventory_product_name,
|
|
|
- inventory_product_bar,
|
|
|
- inventory_remaining_num,
|
|
|
- inventory_state,
|
|
|
- inventory_desc,
|
|
|
- inventory_create_time,
|
|
|
- inventory_update_time
|
|
|
+ fi.inventory_id,
|
|
|
+ fi.inventory_product_name,
|
|
|
+ fi.inventory_product_bar,
|
|
|
+ fi.inventory_remaining_num,
|
|
|
+ fi.inventory_state,
|
|
|
+ fi.inventory_desc,
|
|
|
+ fi.inventory_create_time,
|
|
|
+ fi.inventory_update_time,
|
|
|
+ fi.inventory_product_color_id,
|
|
|
+ fi.inventory_good_product_num,
|
|
|
+ fi.inventory_defective_product_num,
|
|
|
+ fi.inventory_recent_record,
|
|
|
+ pt.type_name,
|
|
|
+ pi.product_number,
|
|
|
+ pi.product_abbreviation,
|
|
|
+ pc.color_name,
|
|
|
+ imn.inventoryMomentumNum
|
|
|
from
|
|
|
- tb_rst_fm_inventory
|
|
|
+ tb_rst_fm_inventory fi
|
|
|
+ LEFT jOIN tb_rst_product_color pc on fi.inventory_product_color_id = pc.color_id
|
|
|
+ LEFT jOIN tb_rst_product_info pi on pc.color_product_id = pi.product_id
|
|
|
+ LEFT jOIN tb_rst_product_type pt on pi.product_type = pt.type_id
|
|
|
+ LEFT jOIN (SELECT
|
|
|
+ SUM(soi.item_num) as inventoryMomentumNum,
|
|
|
+ item_color_id as colorId
|
|
|
+ FROM
|
|
|
+ tb_rst_sales_order_info oi
|
|
|
+ LEFT JOIN tb_rst_sales_order_item soi on soi.item_order_id = oi.sales_id
|
|
|
+
|
|
|
+ WHERE
|
|
|
+ oi.sales_shipping_status IN (0,3,11)
|
|
|
+ GROUP BY soi.item_color_id
|
|
|
+ ) imn on imn.colorId = pc.color_id
|
|
|
<where>
|
|
|
<if test="inventoryId != null and inventoryId != ''">
|
|
|
- inventory_id = #{inventoryId}
|
|
|
+ fi.inventory_id = #{inventoryId}
|
|
|
</if>
|
|
|
<if test="inventoryProductName != null and inventoryProductName != ''">
|
|
|
- and inventory_product_name like CONCAT('%',#{inventoryProductName},'%')
|
|
|
+ and fi.inventory_product_name like CONCAT('%',#{inventoryProductName},'%')
|
|
|
</if>
|
|
|
<if test="inventoryProductBar != null and inventoryProductBar != ''">
|
|
|
- and inventory_product_bar = #{inventoryProductBar}
|
|
|
+ and fi.inventory_product_bar = #{inventoryProductBar}
|
|
|
</if>
|
|
|
<if test="inventoryState != null and inventoryState != ''">
|
|
|
- and inventory_state = #{inventoryState}
|
|
|
+ and fi.inventory_state = #{inventoryState}
|
|
|
+ </if>
|
|
|
+ <if test="productTypeId != null and productTypeId != ''">
|
|
|
+ and pt.type_id = #{productTypeId}
|
|
|
+ </if>
|
|
|
+ <if test="productColorName != null and productColorName != ''">
|
|
|
+ and pc.color_name like CONCAT ('%',#{productColorName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="inventoryProductBar != null and inventoryProductBar != ''">
|
|
|
+ and pc.color_bar = #{inventoryProductBar}
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
@@ -73,7 +148,58 @@
|
|
|
<if test="inventoryDesc != null and inventoryDesc != ''" >
|
|
|
inventory_desc = #{inventoryDesc,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
+ <if test="inventoryProductColorId != null and inventoryProductColorId != ''" >
|
|
|
+ inventory_product_color_id = #{inventoryProductColorId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="inventoryGoodProductNum != null" >
|
|
|
+ inventory_good_product_num = #{inventoryGoodProductNum,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="inventoryDefectiveProductNum != null" >
|
|
|
+ inventory_defective_product_num = #{inventoryDefectiveProductNum,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="inventoryRecentRecord != null and inventoryRecentRecord != ''" >
|
|
|
+ inventory_recent_record = #{inventoryRecentRecord,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+
|
|
|
</set>
|
|
|
where inventory_id = #{inventoryId,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
+
|
|
|
+ <select id="getByInventoryByBar" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
+ select
|
|
|
+ fi.inventory_id,
|
|
|
+ fi.inventory_product_name,
|
|
|
+ fi.inventory_product_bar,
|
|
|
+ fi.inventory_remaining_num,
|
|
|
+ fi.inventory_state,
|
|
|
+ fi.inventory_desc,
|
|
|
+ fi.inventory_create_time,
|
|
|
+ fi.inventory_update_time,
|
|
|
+ fi.inventory_product_color_id,
|
|
|
+ fi.inventory_good_product_num,
|
|
|
+ fi.inventory_defective_product_num,
|
|
|
+ fi.inventory_recent_record,
|
|
|
+ pt.type_name,
|
|
|
+ pi.product_number,
|
|
|
+ pi.product_abbreviation,
|
|
|
+ pc.color_name,
|
|
|
+ imn.inventoryMomentumNum
|
|
|
+ from tb_rst_fm_inventory fi
|
|
|
+ LEFT jOIN tb_rst_product_color pc on fi.inventory_product_color_id = pc.color_id
|
|
|
+ LEFT jOIN tb_rst_product_info pi on pc.color_product_id = pi.product_id
|
|
|
+ LEFT jOIN tb_rst_product_type pt on pi.product_type = pt.type_id
|
|
|
+ LEFT jOIN (SELECT
|
|
|
+ SUM(soi.item_num) as inventoryMomentumNum,
|
|
|
+ item_color_id as colorId
|
|
|
+ FROM
|
|
|
+ tb_rst_sales_order_info oi
|
|
|
+ LEFT JOIN tb_rst_sales_order_item soi on soi.item_order_id = oi.sales_id
|
|
|
+
|
|
|
+ WHERE
|
|
|
+ oi.sales_shipping_status IN (0,3,11)
|
|
|
+ GROUP BY soi.item_color_id
|
|
|
+ ) imn on imn.colorId = pc.color_id
|
|
|
+ where fi.inventory_product_bar = #{inventoryProductBar,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|