|  |  |  | 
|---|
|  |  |  | </association> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <select id="getStatisticsStockList" parameterType="doumeemes.dao.ext.dto.QueryWStockExtDTO" resultType="doumeemes.dao.business.dto.statistics.StockDataModel"> | 
|---|
|  |  |  | select sum(a.NUM) as num,c.`NAME` as materialName,d.name as warehouseName,f.UNION_NAME as location,u.name as unitName | 
|---|
|  |  |  | select sum(a.NUM) as num,c.`NAME` as materialName,d.name as warehouseName,f.UNION_NAME as location,u.name as unitName,p.`NAME` as procedureName | 
|---|
|  |  |  | from w_stock a | 
|---|
|  |  |  | left join material_distribute b on a.MATERIAL_ID=b.ID | 
|---|
|  |  |  | left join material c on b.MATERIAL_ID=c.ID | 
|---|
|  |  |  | left join warehouse d on a.WAREHOUSE_ID=d.ID | 
|---|
|  |  |  | left join warehouse_location f on a.LOCATION_ID=f.ID | 
|---|
|  |  |  | left join procedures p on p.ID=a.PROCEDURE_ID | 
|---|
|  |  |  | left join unit u on a.UNIT_ID=u.id | 
|---|
|  |  |  | where a.DELETED = 0 AND a.ROOT_DEPART_ID = #{rootDepartId} AND d.DEPART_ID=#{wmodelDepartId} | 
|---|
|  |  |  | GROUP BY a.MATERIAL_ID,a.WAREHOUSE_ID,a.BATCH | 
|---|
|  |  |  | ORDER BY num DESC | 
|---|
|  |  |  | ORDER BY c.code , p.SORTNUM | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <select id="selectAllList" parameterType="doumeemes.dao.ext.dto.QueryWStockExtDTO" resultMap="WStockExtListVO"> | 
|---|
|  |  |  | SELECT a.* | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="stockNewDTO.qualityType != null"> | 
|---|
|  |  |  | and a.QUALITY_TYPE = #{stockNewDTO.qualityType} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="stockNewDTO.locationId != null"> | 
|---|
|  |  |  | and a.LOCATION_ID = #{stockNewDTO.locationId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="stockNewDTO.batch != null and stockNewDTO.batch != '' "> | 
|---|
|  |  |  | and a.BATCH = #{stockNewDTO.batch} | 
|---|
|  |  |  | </if> | 
|---|