<?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.fjhx.wms.mapper.stock.StockJournalDetailsMapper">
    <select id="getPage" resultType="com.fjhx.wms.entity.stock.vo.StockJournalDetailsVo">
        SELECT sjd.id,
               sj.op_type,
               sj.type,
               sj.`code`,
               sj.warehouse_id,
               w.`name`     warehouseName,
               sjd.product_id,
               sjd.quantity,
               sjd.create_time,
               sjd.create_user,
               sj.business_id,
               sjd.stock_journal_id,
               po.`code` as prodOrderCode,
               sj.expect_restitution_time,
               sj.restitution_time,
               sj.ex_warehouse_person,
               sj.remarks,
               sjd.company_id
        FROM stock_journal_details sjd
                 LEFT JOIN stock_journal sj ON sjd.stock_journal_id = sj.id
                 LEFT JOIN warehouse w ON sj.warehouse_id = w.id
                 LEFT JOIN production_order po ON sj.prod_order_id = po.id
            ${ew.customSqlSegment}
    </select>

    <select id="getList" resultType="com.fjhx.wms.entity.stock.vo.StockJournalDetailsVo">
        SELECT sj.op_type,
               sj.type,
               sjd.*
        FROM stock_journal_details sjd
                 LEFT JOIN stock_journal sj ON sjd.stock_journal_id = sj.id
            ${ew.customSqlSegment}
    </select>

</mapper>
