123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?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.sd.business.mapper.inventory.InventoryMapper">
- <select id="getPage" resultType="com.sd.business.entity.inventory.vo.InventoryVo">
- select i.id,
- i.warehouse_id,
- i.bom_spec_id,
- i.balance_unit_price,
- i.quantity,
- i.department_id,
- w.name warehouseName,
- bs.name bomSpecName,
- bs.code bomSpecCode,
- d.name departmentName
- from ${tableName} i
- left join bom_spec bs on i.bom_spec_id = bs.id
- left join bom b on bs.bom_id = b.id
- left join warehouse w on i.warehouse_id = w.id
- left join department d on i.department_id = d.id
- ${ew.customSqlSegment}
- </select>
- <select id="getQuantityByWarehouse" resultType="com.sd.business.entity.inventory.vo.QuantityByWarehouseVo">
- select sum(ifnull(i.quantity, 0)) inventoryQuantity,
- w.id warehouseId,
- w.name warehouseName
- from inventory i
- left join warehouse w on i.warehouse_id = w.id
- group by w.id
- order by w.id
- </select>
- <select id="getQuantityByDepartment" resultType="com.sd.business.entity.inventory.vo.QuantityByDepartmentVo">
- select sum(ifnull(i.quantity, 0)) inventoryQuantity,
- d.id departmentId,
- d.name departmentName
- from inventory i
- left join department d on i.department_id = d.id
- group by d.id
- order by d.id
- </select>
- <select id="getNum" resultType="decimal">
- select sum(ifnull(i.quantity, 0))
- from in_out_storage_details i
- <where>
- <if test="bomSpecId != null">
- and bom_spec_id = #{bomSpecId}
- </if>
- <if test="warehouseId != null">
- and warehouse_id = #{warehouseId}
- </if>
- and type = 1
- </where>
- </select>
- <select id="getprice" resultType="decimal">
- select sum(ifnull(i.in_sum_price, 0))
- from in_out_storage_details i
- <where>
- <if test="bomSpecId != null">
- and bom_spec_id = #{bomSpecId}
- </if>
- <if test="warehouseId != null">
- and warehouse_id = #{warehouseId}
- </if>
- and type = 1
- </where>
- </select>
- <select id="getInOutDetails" resultType="com.sd.business.entity.in.po.InOutStorageDetails">
- select i.quantity,
- i.in_unit_price,
- i.in_sum_price
- from in_out_storage_details i
- <where>
- <if test="bomSpecId != null">
- and bom_spec_id = #{bomSpecId}
- </if>
- <if test="warehouseId != null">
- and warehouse_id = #{warehouseId}
- </if>
- <if test="departmentId != null">
- and department_id = #{departmentId}
- </if>
- and type = 1
- and quantity > 0
- </where>
- order by i.create
- </select>
- </mapper>
|