| | |
| | | </resultMap> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.stock.dto.StockOutRecordDto"> |
| | | WITH RECURSIVE product_tree AS ( |
| | | SELECT id |
| | | FROM product |
| | | WHERE id = #{params.topParentProductId} |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT p.id |
| | | FROM product p |
| | | INNER JOIN product_tree pt ON p.parent_id = pt.id |
| | | ) |
| | | SELECT |
| | | sor.*, |
| | | p.product_name as productName, |
| | |
| | | <if test="params.recordType != null and params.recordType != ''"> |
| | | and sor.record_type = #{params.recordType} |
| | | </if> |
| | | <if test="params.topParentProductId != null and params.topParentProductId > 0"> |
| | | and p.id in (select id from product_tree) |
| | | </if> |
| | | </where> |
| | | order by sor.id desc |
| | | </select> |