|  |  |  | @ -196,4 +196,42 @@ | 
			
		
	
		
			
				
					|  |  |  |  |             </if> | 
			
		
	
		
			
				
					|  |  |  |  |         </where> | 
			
		
	
		
			
				
					|  |  |  |  |     </select> | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     <select id="getCountInvProduct" resultType="com.glxp.api.res.inv.InvProductResponse"> | 
			
		
	
		
			
				
					|  |  |  |  |         select inv_product_detail.id, | 
			
		
	
		
			
				
					|  |  |  |  |                inv_product.relIdFk, | 
			
		
	
		
			
				
					|  |  |  |  |                inv_product.nameCode, | 
			
		
	
		
			
				
					|  |  |  |  |                inv_product.batchNo, | 
			
		
	
		
			
				
					|  |  |  |  |                inv_product.productionDate, | 
			
		
	
		
			
				
					|  |  |  |  |                inv_product.expireDate, | 
			
		
	
		
			
				
					|  |  |  |  |                basic_products.ggxh, | 
			
		
	
		
			
				
					|  |  |  |  |                inv_product.inCount, | 
			
		
	
		
			
				
					|  |  |  |  |                inv_product.outCount, | 
			
		
	
		
			
				
					|  |  |  |  |                sum(inv_product.inCount - inv_product.outCount) reCount, | 
			
		
	
		
			
				
					|  |  |  |  |                basic_products.cpmctymc | 
			
		
	
		
			
				
					|  |  |  |  |         from inv_product_detail | 
			
		
	
		
			
				
					|  |  |  |  |                  left join inv_product on inv_product_detail.relId = inv_product.relIdFk | 
			
		
	
		
			
				
					|  |  |  |  |             and inv_product.invCode = inv_product_detail.invCode | 
			
		
	
		
			
				
					|  |  |  |  |             AND IFNULL(inv_product.batchNo, 'empty') = IFNULL(inv_product_detail.batchNo, 'empty') | 
			
		
	
		
			
				
					|  |  |  |  |                  left join basic_udirel on inv_product_detail.relId = basic_udirel.id | 
			
		
	
		
			
				
					|  |  |  |  |                  left join basic_products on basic_products.uuid = basic_udirel.uuid | 
			
		
	
		
			
				
					|  |  |  |  |         <where> | 
			
		
	
		
			
				
					|  |  |  |  |             <if test="invCode != null and invCode != ''"> | 
			
		
	
		
			
				
					|  |  |  |  |                 AND inv_product_detail.invCode = #{invCode} | 
			
		
	
		
			
				
					|  |  |  |  |             </if> | 
			
		
	
		
			
				
					|  |  |  |  |             <if test="invSpaceCode != null and invSpaceCode != ''"> | 
			
		
	
		
			
				
					|  |  |  |  |                 AND inv_product_detail.invSpaceCode = #{invSpaceCode} | 
			
		
	
		
			
				
					|  |  |  |  |             </if> | 
			
		
	
		
			
				
					|  |  |  |  |             <if test="nameCode != null and nameCode != ''"> | 
			
		
	
		
			
				
					|  |  |  |  |                 AND inv_product.nameCode like concat('%', #{nameCode}, '%') | 
			
		
	
		
			
				
					|  |  |  |  |             </if> | 
			
		
	
		
			
				
					|  |  |  |  |             <if test="cpmctymc != null and cpmctymc != ''"> | 
			
		
	
		
			
				
					|  |  |  |  |                 AND basic_products.cpmctymc like concat('%', #{cpmctymc}, '%') | 
			
		
	
		
			
				
					|  |  |  |  |             </if> | 
			
		
	
		
			
				
					|  |  |  |  |             <if test="batchNo != null and batchNo != ''"> | 
			
		
	
		
			
				
					|  |  |  |  |                 AND inv_product.batchNo like concat('%', #{batchNo}, '%') | 
			
		
	
		
			
				
					|  |  |  |  |             </if> | 
			
		
	
		
			
				
					|  |  |  |  |             group by inv_product_detail.relId, inv_product_detail.batchNo | 
			
		
	
		
			
				
					|  |  |  |  |         </where> | 
			
		
	
		
			
				
					|  |  |  |  |     </select> | 
			
		
	
		
			
				
					|  |  |  |  | </mapper> | 
			
		
	
	
		
			
				
					|  |  |  | 
 |