42 lines
1.8 KiB
XML
42 lines
1.8 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.gear.oa.mapper.GearStockMapper">
|
|||
|
|
|
|||
|
|
<resultMap type="com.gear.oa.domain.GearStock" id="GearStockResult">
|
|||
|
|
<result property="stockId" column="stock_id"/>
|
|||
|
|
<result property="warehouseId" column="warehouse_id"/>
|
|||
|
|
<result property="itemType" column="item_type"/>
|
|||
|
|
<result property="itemId" column="item_id"/>
|
|||
|
|
<result property="quantity" column="quantity"/>
|
|||
|
|
<result property="unit" column="unit"/>
|
|||
|
|
<result property="batchNo" column="batch_no"/>
|
|||
|
|
<result property="remark" column="remark"/>
|
|||
|
|
<result property="delFlag" column="del_flag"/>
|
|||
|
|
<result property="createTime" column="create_time"/>
|
|||
|
|
<result property="createBy" column="create_by"/>
|
|||
|
|
<result property="updateTime" column="update_time"/>
|
|||
|
|
<result property="updateBy" column="update_by"/>
|
|||
|
|
</resultMap>
|
|||
|
|
|
|||
|
|
<select id="getStockByItemId" resultType="java.math.BigDecimal">
|
|||
|
|
select sum(quantity) as quantity from gear_stock
|
|||
|
|
where item_id = #{rawMaterialId} and item_type = 'raw_material' and del_flag = 0
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
<!-- 分页联查物品名称和编码,支持Wrapper动态条件,返回Page<GearStockVo> -->
|
|||
|
|
<select id="selectVoPagePlus" resultType="com.gear.oa.domain.vo.GearStockVo">
|
|||
|
|
SELECT
|
|||
|
|
s.*,
|
|||
|
|
w.warehouse_name,
|
|||
|
|
p.product_name AS itemName,
|
|||
|
|
p.product_code AS itemCode
|
|||
|
|
FROM gear_stock s
|
|||
|
|
LEFT JOIN gear_product p ON s.item_type = 'product' AND s.item_id = p.product_id and p.del_flag = 0
|
|||
|
|
left join gear_warehouse w on s.warehouse_id = w.warehouse_id and w.del_flag = 0
|
|||
|
|
${ew.customSqlSegment}
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
</mapper>
|