<?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.FinanceExtractMapper">

	<!-- 查询列表 -->
	<select id="getFinanceExtract" parameterType="FinanceExtract" resultType="FinanceExtract">
		select * from tbl_sys_finance_extract
		<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,id ASC 
	</select>
	
	<select id="getFilename_extract" parameterType="String" resultType="String">
		SELECT 
		  	DISTINCT filename 
		FROM
		  	tbl_sys_finance_extract 
		WHERE creator = #{creator}
		ORDER BY create_date DESC 
	</select>

   	<!-- 批量插入 -->
  	<insert id="insertForeach" parameterType="java.util.List">
	    insert into tbl_sys_finance_extract (
	      id, order_number, remark, length, width,
	      height, count, filename, creator,create_date)
	    values 
	    <foreach collection="list" item="item" index="index" separator=",">
	     (
	      null,#{item.orderNumber},#{item.remark},#{item.length},#{item.width},
	      #{item.height},#{item.count},#{item.filename},#{item.creator},now())
	    </foreach>		
  	</insert>
</mapper>