Helius
2021-01-28 5cc9058fb151d4285eb9d5e521060b57abf2d6c0
zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderFlowDao.xml
@@ -75,4 +75,108 @@
      where order_id=#{orderId}
      group by pay_method
   </select>
   <select id="selectInPage" resultType="com.matrix.system.hive.vo.OrderFlowVo">
      SELECT
      a.id,
      b.id as orderId,
      a.create_time as createTime,
      b.ORDER_NO as orderNo,
      a.flow_content as flowContent,
      a.flow_type as flowType,
      a.amount as amount,
      c.VIP_NAME as vipName,
      a.pay_method as payMethod,
      a.flow_no as flowNo,
      d.shop_short_name as shopName,
      e.su_name as staffName
      from sys_order_flow a
      LEFT JOIN sys_order b on a.order_id=b.ID
      LEFT JOIN sys_vip_info c on a.vip_id=c.ID
      LEFT JOIN sys_shop_info d on a.shop_id=d.ID
      LEFT JOIN sys_users e on e.su_id=b.STAFF_ID
      <where>
            and a.company_id=#{record.companyId}
         <if test="record.queryKey != null and record.queryKey != ''">
            and (instr(c.vip_name, #{record.queryKey}) or instr(c.phone, #{record.queryKey}) )
         </if>
         <if test="record.oprationMan != null and record.oprationMan != ''">
            and instr(e.su_name, #{record.oprationMan})
         </if>
         <if test="record.orderNo != null and record.orderNo != ''">
            and instr(b.ORDER_NO, #{record.orderNo})
         </if>
         <if test="record.payMethod != null and record.payMethod != ''">
            and a.pay_method=#{record.payMethod}
         </if>
         <if test="record.flowType != null and record.flowType != ''">
            and a.flow_type=#{record.flowType}
         </if>
         <if test="record.startTime != null ">
            and a.create_time >= #{record.startTime}
         </if>
         <if test="record.endTime != null   ">
            <![CDATA[and a.create_time <= #{record.endTime}]]>
         </if>
         <if test="record.shopId != null and record.shopId != ''">
            and a.shop_id=#{record.shopId}
         </if>
      </where>
      <if test="record.sort !=null">
         order by
         a.${record.sort} ${record.order}
      </if>
      <if test="record.offset >=0  and record.limit >0">
         limit
         #{record.offset},#{record.limit}
      </if>
   </select>
   <select id="selectTotal" resultType="java.lang.Integer">
      SELECT count(*)
      from sys_order_flow a
      LEFT JOIN sys_order b on a.order_id=b.ID
      LEFT JOIN sys_vip_info c on a.vip_id=c.ID
      LEFT JOIN sys_shop_info d on a.shop_id=d.ID
      LEFT JOIN sys_users e on e.su_id=b.STAFF_ID
      <where>
         and a.company_id=#{record.companyId}
         <if test="record.queryKey != null and record.queryKey != ''">
            and (instr(c.vip_name, #{record.queryKey}) or instr(c.phone, #{record.queryKey}) )
         </if>
         <if test="record.oprationMan != null and record.oprationMan != ''">
            and instr(e.su_name, #{record.oprationMan})
         </if>
         <if test="record.orderNo != null and record.orderNo != ''">
            and instr(b.ORDER_NO, #{record.orderNo})
         </if>
         <if test="record.payMethod != null and record.payMethod != ''">
            and a.pay_method=#{record.payMethod}
         </if>
         <if test="record.flowType != null and record.flowType != ''">
            and a.flow_type=#{record.flowType}
         </if>
         <if test="record.startTime != null ">
            and a.create_time >= #{record.startTime}
         </if>
         <if test="record.endTime != null   ">
            <![CDATA[and a.create_time <= #{record.endTime}]]>
         </if>
         <if test="record.shopId != null and record.shopId != ''">
            and a.shop_id=#{record.shopId}
         </if>
      </where>
   </select>
</mapper>