27 lines
1.2 KiB
Java
27 lines
1.2 KiB
Java
package com.erp.example.seata.mapper;
|
|
|
|
import com.erp.example.seata.entity.InventoryLog;
|
|
import org.apache.ibatis.annotations.*;
|
|
|
|
@Mapper
|
|
public interface InventoryLogMapper {
|
|
|
|
@Insert("INSERT INTO inventory_log (product_id, order_no, change_type, quantity, before_stock, after_stock, create_time) " +
|
|
"VALUES (#{productId}, #{orderNo}, #{changeType}, #{quantity}, #{beforeStock}, #{afterStock}, #{createTime})")
|
|
@Options(useGeneratedKeys = true, keyProperty = "id")
|
|
void insert(InventoryLog log);
|
|
|
|
@Select("SELECT * FROM inventory_log WHERE order_no = #{orderNo}")
|
|
@Results({
|
|
@Result(property = "id", column = "id"),
|
|
@Result(property = "productId", column = "product_id"),
|
|
@Result(property = "orderNo", column = "order_no"),
|
|
@Result(property = "changeType", column = "change_type"),
|
|
@Result(property = "quantity", column = "quantity"),
|
|
@Result(property = "beforeStock", column = "before_stock"),
|
|
@Result(property = "afterStock", column = "after_stock"),
|
|
@Result(property = "createTime", column = "create_time")
|
|
})
|
|
java.util.List<InventoryLog> findByOrderNo(@Param("orderNo") String orderNo);
|
|
}
|