|
@@ -1,91 +1,132 @@
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
<!DOCTYPE mapper
|
|
|
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.zkqy.business.mapper.ProductInventoryMapper">
|
|
|
-
|
|
|
+
|
|
|
<resultMap type="com.zkqy.business.domain.ProductInventory" id="ProductInventoryResult">
|
|
|
- <result property="id" column="id" />
|
|
|
- <result property="qrCode" column="qr_code" />
|
|
|
- <result property="lotNum" column="lot_num" />
|
|
|
- <result property="productId" column="product_id" />
|
|
|
- <result property="levels" column="levels" />
|
|
|
- <result property="canisterNum" column="canister_num" />
|
|
|
- <result property="boxNum" column="box_num" />
|
|
|
- <result property="suttle" column="suttle" />
|
|
|
- <result property="productionDate" column="production_date" />
|
|
|
- <result property="warehouseId" column="warehouse_id" />
|
|
|
- <result property="machineTool" column="machine_tool" />
|
|
|
- <result property="grossWeight" column="gross_weight" />
|
|
|
- <result property="packaging" column="packaging" />
|
|
|
- <result property="workShifts" column="work_shifts" />
|
|
|
- <result property="foreignTradeNumber" column="foreign_trade_number" />
|
|
|
- <result property="canisterWeight" column="canister_weight" />
|
|
|
- <result property="boxWeight" column="box_weight" />
|
|
|
- <result property="tubeColor" column="tube_color" />
|
|
|
- <result property="comPort" column="com_port" />
|
|
|
- <result property="printFormat" column="print_format" />
|
|
|
- <result property="packagingType" column="packaging_type" />
|
|
|
- <result property="storageLocation" column="storage_location" />
|
|
|
- <result property="warehouseregionId" column="warehouseregion_id" />
|
|
|
- <result property="remark" column="remark" />
|
|
|
- <result property="delFlag" column="del_flag" />
|
|
|
- <result property="createBy" column="create_by" />
|
|
|
- <result property="createById" column="create_by_id" />
|
|
|
- <result property="createTime" column="create_time" />
|
|
|
- <result property="updateBy" column="update_by" />
|
|
|
- <result property="updateById" column="update_by_id" />
|
|
|
- <result property="updateTime" column="update_time" />
|
|
|
- <result property="totalCanisterNum" column="total_canister_num" />
|
|
|
- <result property="totalBoxNum" column="total_box_num" />
|
|
|
- <result property="totalSuttle" column="total_suttle" />
|
|
|
- <result property="totalGrossWeight" column="total_gross_weight" />
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="qrCode" column="qr_code"/>
|
|
|
+ <result property="lotNum" column="lot_num"/>
|
|
|
+ <result property="productId" column="product_id"/>
|
|
|
+ <result property="levels" column="levels"/>
|
|
|
+ <result property="canisterNum" column="canister_num"/>
|
|
|
+ <result property="boxNum" column="box_num"/>
|
|
|
+ <result property="suttle" column="suttle"/>
|
|
|
+ <result property="productionDate" column="production_date"/>
|
|
|
+ <result property="warehouseId" column="warehouse_id"/>
|
|
|
+ <result property="machineTool" column="machine_tool"/>
|
|
|
+ <result property="grossWeight" column="gross_weight"/>
|
|
|
+ <result property="packaging" column="packaging"/>
|
|
|
+ <result property="workShifts" column="work_shifts"/>
|
|
|
+ <result property="foreignTradeNumber" column="foreign_trade_number"/>
|
|
|
+ <result property="canisterWeight" column="canister_weight"/>
|
|
|
+ <result property="boxWeight" column="box_weight"/>
|
|
|
+ <result property="tubeColor" column="tube_color"/>
|
|
|
+ <result property="comPort" column="com_port"/>
|
|
|
+ <result property="printFormat" column="print_format"/>
|
|
|
+ <result property="packagingType" column="packaging_type"/>
|
|
|
+ <result property="storageLocation" column="storage_location"/>
|
|
|
+ <result property="warehouseregionId" column="warehouseregion_id"/>
|
|
|
+ <result property="remark" column="remark"/>
|
|
|
+ <result property="delFlag" column="del_flag"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="createById" column="create_by_id"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
+ <result property="updateById" column="update_by_id"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ <result property="totalCanisterNum" column="total_canister_num"/>
|
|
|
+ <result property="totalBoxNum" column="total_box_num"/>
|
|
|
+ <result property="totalSuttle" column="total_suttle"/>
|
|
|
+ <result property="totalGrossWeight" column="total_gross_weight"/>
|
|
|
<result property="productColour" column="product_colour"/>
|
|
|
<result property="inventoryType" column="inventory_type"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectProductInventoryVo">
|
|
|
- select id, qr_code, lot_num, product_id, levels, canister_num, box_num, suttle, production_date, warehouse_id, machine_tool, gross_weight, packaging, work_shifts, foreign_trade_number, canister_weight, box_weight, tube_color, com_port, print_format, packaging_type, storage_location, warehouseregion_id, remark, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time, total_canister_num, total_box_num, total_suttle, total_gross_weight,product_colour,inventory_type from {DBNAME}.product_inventory
|
|
|
+ select id,
|
|
|
+ qr_code,
|
|
|
+ lot_num,
|
|
|
+ product_id,
|
|
|
+ levels,
|
|
|
+ canister_num,
|
|
|
+ box_num,
|
|
|
+ suttle,
|
|
|
+ production_date,
|
|
|
+ warehouse_id,
|
|
|
+ machine_tool,
|
|
|
+ gross_weight,
|
|
|
+ packaging,
|
|
|
+ work_shifts,
|
|
|
+ foreign_trade_number,
|
|
|
+ canister_weight,
|
|
|
+ box_weight,
|
|
|
+ tube_color,
|
|
|
+ com_port,
|
|
|
+ print_format,
|
|
|
+ packaging_type,
|
|
|
+ storage_location,
|
|
|
+ warehouseregion_id,
|
|
|
+ remark,
|
|
|
+ del_flag,
|
|
|
+ create_by,
|
|
|
+ create_by_id,
|
|
|
+ create_time,
|
|
|
+ update_by,
|
|
|
+ update_by_id,
|
|
|
+ update_time,
|
|
|
+ total_canister_num,
|
|
|
+ total_box_num,
|
|
|
+ total_suttle,
|
|
|
+ total_gross_weight,
|
|
|
+ product_colour,
|
|
|
+ inventory_type
|
|
|
+ from {DBNAME}.product_inventory
|
|
|
</sql>
|
|
|
|
|
|
- <select id="selectProductInventoryList" parameterType="com.zkqy.business.domain.ProductInventory" resultMap="ProductInventoryResult">
|
|
|
+ <select id="selectProductInventoryList" parameterType="com.zkqy.business.domain.ProductInventory"
|
|
|
+ resultMap="ProductInventoryResult">
|
|
|
<include refid="selectProductInventoryVo"/>
|
|
|
- <where>
|
|
|
- <if test="qrCode != null and qrCode != ''"> and qr_code = #{qrCode}</if>
|
|
|
- <if test="lotNum != null and lotNum != ''"> and lot_num = #{lotNum}</if>
|
|
|
- <if test="productId != null "> and product_id = #{productId}</if>
|
|
|
- <if test="levels != null and levels != ''"> and levels = #{levels}</if>
|
|
|
- <if test="canisterNum != null "> and canister_num = #{canisterNum}</if>
|
|
|
- <if test="boxNum != null "> and box_num = #{boxNum}</if>
|
|
|
- <if test="suttle != null "> and suttle = #{suttle}</if>
|
|
|
- <if test="productionDate != null "> and production_date = #{productionDate}</if>
|
|
|
- <if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
|
|
|
- <if test="machineTool != null and machineTool != ''"> and machine_tool = #{machineTool}</if>
|
|
|
- <if test="grossWeight != null "> and gross_weight = #{grossWeight}</if>
|
|
|
- <if test="packaging != null and packaging != ''"> and packaging = #{packaging}</if>
|
|
|
- <if test="workShifts != null and workShifts != ''"> and work_shifts = #{workShifts}</if>
|
|
|
- <if test="foreignTradeNumber != null and foreignTradeNumber != ''"> and foreign_trade_number = #{foreignTradeNumber}</if>
|
|
|
- <if test="canisterWeight != null "> and canister_weight = #{canisterWeight}</if>
|
|
|
- <if test="boxWeight != null "> and box_weight = #{boxWeight}</if>
|
|
|
- <if test="tubeColor != null and tubeColor != ''"> and tube_color = #{tubeColor}</if>
|
|
|
- <if test="comPort != null and comPort != ''"> and com_port = #{comPort}</if>
|
|
|
- <if test="printFormat != null and printFormat != ''"> and print_format = #{printFormat}</if>
|
|
|
- <if test="packagingType != null and packagingType != ''"> and packaging_type = #{packagingType}</if>
|
|
|
- <if test="storageLocation != null and storageLocation != ''"> and storage_location = #{storageLocation}</if>
|
|
|
- <if test="warehouseregionId != null "> and warehouseregion_id = #{warehouseregionId}</if>
|
|
|
- <if test="totalCanisterNum != null "> and total_canister_num = #{totalCanisterNum}</if>
|
|
|
- <if test="totalBoxNum != null "> and total_box_num = #{totalBoxNum}</if>
|
|
|
- <if test="totalSuttle != null "> and total_suttle = #{totalSuttle}</if>
|
|
|
- <if test="totalGrossWeight != null "> and total_gross_weight = #{totalGrossWeight}</if>
|
|
|
+ <where>
|
|
|
+ <if test="qrCode != null and qrCode != ''">and qr_code = #{qrCode}</if>
|
|
|
+ <if test="lotNum != null and lotNum != ''">and lot_num = #{lotNum}</if>
|
|
|
+ <if test="productId != null ">and product_id = #{productId}</if>
|
|
|
+ <if test="levels != null and levels != ''">and levels = #{levels}</if>
|
|
|
+ <if test="canisterNum != null ">and canister_num = #{canisterNum}</if>
|
|
|
+ <if test="boxNum != null ">and box_num = #{boxNum}</if>
|
|
|
+ <if test="suttle != null ">and suttle = #{suttle}</if>
|
|
|
+ <if test="productionDate != null ">and production_date = #{productionDate}</if>
|
|
|
+ <if test="warehouseId != null ">and warehouse_id = #{warehouseId}</if>
|
|
|
+ <if test="machineTool != null and machineTool != ''">and machine_tool = #{machineTool}</if>
|
|
|
+ <if test="grossWeight != null ">and gross_weight = #{grossWeight}</if>
|
|
|
+ <if test="packaging != null and packaging != ''">and packaging = #{packaging}</if>
|
|
|
+ <if test="workShifts != null and workShifts != ''">and work_shifts = #{workShifts}</if>
|
|
|
+ <if test="foreignTradeNumber != null and foreignTradeNumber != ''">and foreign_trade_number =
|
|
|
+ #{foreignTradeNumber}
|
|
|
+ </if>
|
|
|
+ <if test="canisterWeight != null ">and canister_weight = #{canisterWeight}</if>
|
|
|
+ <if test="boxWeight != null ">and box_weight = #{boxWeight}</if>
|
|
|
+ <if test="tubeColor != null and tubeColor != ''">and tube_color = #{tubeColor}</if>
|
|
|
+ <if test="comPort != null and comPort != ''">and com_port = #{comPort}</if>
|
|
|
+ <if test="printFormat != null and printFormat != ''">and print_format = #{printFormat}</if>
|
|
|
+ <if test="packagingType != null and packagingType != ''">and packaging_type = #{packagingType}</if>
|
|
|
+ <if test="storageLocation != null and storageLocation != ''">and storage_location = #{storageLocation}</if>
|
|
|
+ <if test="warehouseregionId != null ">and warehouseregion_id = #{warehouseregionId}</if>
|
|
|
+ <if test="totalCanisterNum != null ">and total_canister_num = #{totalCanisterNum}</if>
|
|
|
+ <if test="totalBoxNum != null ">and total_box_num = #{totalBoxNum}</if>
|
|
|
+ <if test="totalSuttle != null ">and total_suttle = #{totalSuttle}</if>
|
|
|
+ <if test="totalGrossWeight != null ">and total_gross_weight = #{totalGrossWeight}</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<select id="selectProductInventoryById" parameterType="Long" resultMap="ProductInventoryResult">
|
|
|
<include refid="selectProductInventoryVo"/>
|
|
|
where id = #{id}
|
|
|
</select>
|
|
|
-
|
|
|
- <insert id="insertProductInventory" parameterType="com.zkqy.business.domain.ProductInventory" useGeneratedKeys="true" keyProperty="id">
|
|
|
+
|
|
|
+ <insert id="insertProductInventory" parameterType="com.zkqy.business.domain.ProductInventory"
|
|
|
+ useGeneratedKeys="true" keyProperty="id">
|
|
|
insert into {DBNAME}.product_inventory
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
<if test="qrCode != null">qr_code,</if>
|
|
@@ -121,7 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="productColour != null">product_colour,</if>
|
|
|
<if test="inventoryType != null">inventory_type,</if>
|
|
|
del_flag
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="qrCode != null">#{qrCode},</if>
|
|
|
<if test="lotNum != null">#{lotNum},</if>
|
|
@@ -156,7 +197,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="productColour != null">#{productColour},</if>
|
|
|
<if test="inventoryType != null">#{inventoryType},</if>
|
|
|
'0'
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateProductInventory" parameterType="com.zkqy.business.domain.ProductInventory">
|
|
@@ -194,16 +235,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="totalGrossWeight != null">total_gross_weight = #{totalGrossWeight},</if>
|
|
|
<if test="productColour != null">product_colour = #{productColour},</if>
|
|
|
<if test="inventoryType != null">inventory_type = #{inventoryType},</if>
|
|
|
+ <if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
</trim>
|
|
|
where id = #{id}
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteProductInventoryById" parameterType="Long">
|
|
|
- delete from product_inventory where id = #{id}
|
|
|
+ delete
|
|
|
+ from product_inventory
|
|
|
+ where id = #{id}
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteProductInventoryByIds" parameterType="String">
|
|
|
- delete from product_inventory where id in
|
|
|
+ delete from product_inventory where id in
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
#{id}
|
|
|
</foreach>
|
|
@@ -215,40 +259,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
|
|
|
|
<select id="selectProductInventoryByLotNumAndProductId" resultType="com.zkqy.business.domain.ProductInventory">
|
|
|
- select sum(total_box_num) as totalBoxNum,sum(total_suttle) as totalSuttle from {DBNAME}.product_inventory
|
|
|
+ select sum(total_box_num) as totalBoxNum,sum(total_suttle) as totalSuttle from {DBNAME}.product_inventory
|
|
|
where del_flag = '0'
|
|
|
<if test="lotNum != null and lotNum != '' ">and lot_num = #{lotNum}</if>
|
|
|
<if test="productId != null">and product_id = #{productId}</if>
|
|
|
- <if test="productColour != null and productColour != ''"> and product_colour = #{productColour}</if>
|
|
|
- <if test="inventoryType != null and inventoryType != ''"> and inventory_type = #{inventoryType}</if>
|
|
|
+ <if test="productColour != null and productColour != ''">and product_colour = #{productColour}</if>
|
|
|
+ <if test="inventoryType != null and inventoryType != ''">and inventory_type = #{inventoryType}</if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="oldselectProductInventoryByLotNumAndProductId" resultType="com.zkqy.business.domain.ProductInventory">
|
|
|
+ select * from {DBNAME}.product_inventory
|
|
|
+ where del_flag = '0'
|
|
|
+ <if test="lotNum != null and lotNum != '' ">and lot_num = #{lotNum}</if>
|
|
|
+ <if test="productId != null">and product_id = #{productId}</if>
|
|
|
+ <if test="productColour != null and productColour != ''">and product_colour = #{productColour}</if>
|
|
|
+ <if test="inventoryType != null and inventoryType != ''">and inventory_type = #{inventoryType}</if>
|
|
|
</select>
|
|
|
|
|
|
<select id="selectComprehensiveInventoryList" resultType="com.zkqy.business.domain.vo.ProductCodeListVO">
|
|
|
SELECT
|
|
|
- pi.product_id as productId,
|
|
|
- p.product_name as productName,
|
|
|
- p.product_specifications as productSpecifications,
|
|
|
- p.product_type productType,
|
|
|
- pi.product_colour productColor,
|
|
|
- TRUNCATE ( SUM( pi.total_suttle ), 2 ) AS totalSuttle,
|
|
|
- SUM( pi.total_box_num ) as totalBoxNum,
|
|
|
- SUM( pi.total_canister_num ) as totalCanisterNum,
|
|
|
- pi.levels,
|
|
|
- GROUP_CONCAT( DISTINCT pi.lot_num SEPARATOR '、' ) AS lotNum
|
|
|
+ pi.product_id as productId,
|
|
|
+ p.product_name as productName,
|
|
|
+ p.product_specifications as productSpecifications,
|
|
|
+ p.product_type productType,
|
|
|
+ pi.product_colour productColor,
|
|
|
+ TRUNCATE ( SUM( pi.total_suttle ), 2 ) AS totalSuttle,
|
|
|
+ SUM( pi.total_box_num ) as totalBoxNum,
|
|
|
+ SUM( pi.total_canister_num ) as totalCanisterNum,
|
|
|
+ pi.levels,
|
|
|
+ GROUP_CONCAT( DISTINCT pi.lot_num SEPARATOR '、' ) AS lotNum
|
|
|
FROM
|
|
|
- {DBNAME}.product_inventory pi
|
|
|
- LEFT JOIN {DBNAME}.production p ON pi.product_id = p.id
|
|
|
+ {DBNAME}.product_inventory pi
|
|
|
+ LEFT JOIN {DBNAME}.production p ON pi.product_id = p.id
|
|
|
WHERE
|
|
|
- pi.del_flag = '0'
|
|
|
- <if test="productColor != null and productColor != ''">and pi.product_colour like concat('%', #{productColor}, '%')</if>
|
|
|
- <if test="productId != null">and pi.product_id = #{productId}</if>
|
|
|
- <if test="levels != null and levels != ''">and pi.levels = #{levels}</if>
|
|
|
+ pi.del_flag = '0'
|
|
|
+ and pi.inventory_type = #{inventoryType}
|
|
|
+ <if test="productColor != null and productColor != ''">and pi.product_colour like concat('%', #{productColor},
|
|
|
+ '%')
|
|
|
+ </if>
|
|
|
+ <if test="productId != null">and pi.product_id = #{productId}</if>
|
|
|
+ <if test="levels != null and levels != ''">and pi.levels = #{levels}</if>
|
|
|
GROUP BY
|
|
|
- pi.product_id,
|
|
|
- pi.product_colour,
|
|
|
- pi.levels
|
|
|
- <if test="lotNum != null and lotNum != ''">HAVING GROUP_CONCAT( DISTINCT pi.lot_num SEPARATOR '、' ) like concat('%', #{lotNum}, '%')</if>
|
|
|
- order by pi.qr_code desc
|
|
|
+ pi.product_id,
|
|
|
+ pi.product_colour,
|
|
|
+ pi.levels
|
|
|
+ <if test="lotNum != null and lotNum != ''">HAVING GROUP_CONCAT( DISTINCT pi.lot_num SEPARATOR '、' ) like
|
|
|
+ concat('%', #{lotNum}, '%')
|
|
|
+ </if>
|
|
|
+ order by pi.qr_code desc
|
|
|
</select>
|
|
|
|
|
|
<select id="selectComprehensiveInventoryListTwo" resultType="com.zkqy.business.domain.vo.ProductCodeListVO">
|
|
@@ -268,6 +326,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
LEFT JOIN {DBNAME}.production p ON pi.product_id = p.id
|
|
|
WHERE
|
|
|
pi.del_flag = '0'
|
|
|
+ and pi.inventory_type = #{inventoryType}
|
|
|
<if test="productColor != null and productColor != ''">and pi.product_colour like concat('%', #{productColor},
|
|
|
'%')
|
|
|
</if>
|
|
@@ -283,6 +342,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
<insert id="batchInsertProductInventory" parameterType="com.zkqy.business.domain.ProductInventory">
|
|
|
INSERT INTO {DBNAME}.product_inventory (
|
|
|
qr_code,
|
|
@@ -356,12 +417,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
|
|
|
- <select id="selectProductInventoryInfo" resultMap="ProductInventoryResult">
|
|
|
+ <select id="selectProductInventoryInfo" resultMap="ProductInventoryResult">
|
|
|
<include refid="selectProductInventoryVo"/>
|
|
|
where del_flag = '0'
|
|
|
and product_id = #{productId} and lot_num = #{lotNum}
|
|
|
- and product_colour = #{productColour}
|
|
|
- group by product_id,lot_num,product_colour
|
|
|
+ and product_colour = #{productColour}
|
|
|
+ group by product_id,lot_num,product_colour
|
|
|
</select>
|
|
|
|
|
|
<select id="statisticsSuttleByLevels" resultType="map">
|