<?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="lingtao.net.dao.FinanceDifferenceMapper">

	<!-- 查询列表 -->
	<select id="get" parameterType="FinanceDifference" resultType="FinanceDifference">
		select * from tbl_sys_finance_difference
		<where>
			<if test="creator != null and creator != ''">
				and creator = #{creator}
			</if>
			<if test="filename != null and filename != ''">
				and filename = #{filename}
			</if>
			<if test="orderNumber != null and orderNumber != ''">
				and order_number like "%${orderNumber}%"
			</if>
		</where>
		order by create_date DESC
	</select>
	
	<select id="getAllFilename" parameterType="String" resultType="String">
		SELECT
		  DISTINCT filename
		FROM
		  tbl_sys_finance_difference
		WHERE creator = #{creator}
		ORDER BY create_date DESC
	</select>

   	<!-- 批量插入 -->
  	<insert id="insertForeach" parameterType="java.util.List">
	    insert into tbl_sys_finance_difference (
	      id, order_number, shopname,
	      wangwang, pay_time, price,
	      remark, taobao_status, open_order_number,
	      filename, creator)
	    values 
	    <foreach collection="list" item="item" index="index" separator=",">
	     (
	      null,#{item.orderNumber},#{item.shopname},#{item.wangwang},#{item.payTime},
	      #{item.price},#{item.remark},#{item.taobaoStatus},#{item.openOrderNumber},
	      #{item.filename},#{item.creator})
	    </foreach>		
  	</insert>
</mapper>