| <?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.xzx.gc.system.mapper.OrderStorageInfoMapper">  | 
|   | 
|     <select id="queryDayDiff" resultType="java.lang.Integer">  | 
|         select IFNULL(timestampdiff(day,  | 
|         (select substring_index(storage_time,"  | 
|         ",1)  | 
|         from xzx_order_storage_info  | 
|         where storage_status=0  | 
|         <if test="sysStorageId != null and sysStorageId != ''">  | 
|             AND sys_storage_id <![CDATA[>= ]]>#{sysStorageId}  | 
|         </if>  | 
|         <if test="startTime != null and startTime != ''">  | 
|             AND storage_time <![CDATA[>= ]]>#{startTime}  | 
|         </if>  | 
|         <if test="endTime != null and endTime != ''">  | 
|             AND storage_time<![CDATA[<= ]]>#{endTime}  | 
|         </if>  | 
|         order by storage_time  | 
|         asc limit 1),  | 
|         (select substring_index(storage_time," ",1)  | 
|         from xzx_order_storage_info  | 
|         where storage_status=0  | 
|         <if test="sysStorageId != null and sysStorageId != ''">  | 
|             AND sys_storage_id <![CDATA[>= ]]>#{sysStorageId}  | 
|         </if>  | 
|         <if test="startTime != null and startTime != ''">  | 
|             AND storage_time <![CDATA[>= ]]>#{startTime}  | 
|         </if>  | 
|         <if test="endTime != null and endTime != ''">  | 
|             AND storage_time<![CDATA[<= ]]>#{endTime}  | 
|         </if>  | 
|         order by storage_time  | 
|         desc limit 1)),0) from dual  | 
|     </select>  | 
|   | 
|     <select id="querySysStorageAll" resultType="java.util.HashMap">  | 
|         select  | 
|         IFNULL(sum(a.storage_weight),0) as storageWeight,  | 
|         IFNULL(sum(a.storage_money),0) as storageMoney,  | 
|         IFNULL(sum(a.recycle_weight),0) as recycleWeight,  | 
|         IFNULL(sum(a.recycle_money),0) as recycleMoney  | 
|         from xzx_order_storage_info a  | 
|         left join xzx_user_other_info b on a.receiver = b.user_id  | 
|         where a.storage_status=0  | 
|         <if test=" sysStorageId != null and sysStorageId != ''">  | 
|             AND a.sys_storage_id =#{sysStorageId}  | 
|         </if>  | 
|         <if test="startTime != null and startTime != ''">  | 
|             AND a.storage_time <![CDATA[>= ]]>#{startTime}  | 
|         </if>  | 
|         <if test="endTime != null and endTime != ''">  | 
|             AND a.storage_time<![CDATA[<= ]]>#{endTime}  | 
|         </if>  | 
|         <if test=" partnerIds != null and partnerIds.size() != 0">  | 
|             AND b.partner_id in  | 
|             <foreach collection="partnerIds" index="index" item="id" open="(" separator="," close=")">  | 
|                 #{id}  | 
|             </foreach>  | 
|         </if>  | 
|     </select>  | 
|   | 
|     <select id="sysStorageOrderNum" resultType="java.lang.String">  | 
|         select a.order_id  | 
|         from xzx_order_storage_info a  | 
|         left join xzx_user_other_info b on a.receiver = b.user_id  | 
|         where a.storage_status=0  | 
|         <if test="sysStorageId != null  and sysStorageId != ''">  | 
|             AND a.sys_storage_id =#{sysStorageId}  | 
|         </if>  | 
|         <if test="startTime != null and startTime != ''">  | 
|             AND a.storage_time <![CDATA[>= ]]>#{startTime}  | 
|         </if>  | 
|         <if test="endTime != null and endTime != ''">  | 
|             AND a.storage_time<![CDATA[<= ]]>#{endTime}  | 
|         </if>  | 
|         <if test=" partnerIds != null and partnerIds.size() != 0">  | 
|             AND b.partner_id in  | 
|             <foreach collection="partnerIds" index="index" item="id" open="(" separator="," close=")">  | 
|                 #{id}  | 
|             </foreach>  | 
|         </if>  | 
|     </select>  | 
| </mapper> |