Files
wb-java-nc-shop/target/classes/mapper/InventoryLogMapper.xml
2026-01-11 18:14:42 +08:00

22 lines
1.1 KiB
XML

<?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">
<mapper namespace="com.nlshop.mapper.InventoryLogMapper">
<resultMap id="BaseResultMap" type="com.nlshop.entity.InventoryLog">
<id column="id" property="id"/>
<result column="inventory_id" property="inventoryId"/>
<result column="operation_type" property="operationType"/>
<result column="quantity" property="quantity"/>
<result column="operator" property="operator"/>
<result column="create_time" property="createTime"/>
</resultMap>
<insert id="insert" parameterType="com.nlshop.entity.InventoryLog" useGeneratedKeys="true" keyProperty="id">
INSERT INTO inventory_log (inventory_id, operation_type, quantity, operator)
VALUES (#{inventoryId}, #{operationType}, #{quantity}, #{operator})
</insert>
<select id="selectByInventoryId" resultMap="BaseResultMap">
SELECT * FROM inventory_log WHERE inventory_id = #{inventoryId} ORDER BY create_time DESC
</select>
</mapper>