<?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.fuxi.ws.data.dao.PossalesMapper">
	<resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.Possales">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Tue Dec 09 
			15:15:10 CST 2014. -->
		<id column="PosSalesID" property="possalesid" jdbcType="VARCHAR" />
		<result column="No" property="no" jdbcType="VARCHAR" />
		<result column="Type" property="type" jdbcType="VARCHAR" />
		<result column="Date" property="date" jdbcType="TIMESTAMP" />
		<result column="SPType" property="sptype" jdbcType="VARCHAR" />
		<result column="CustomerCode" property="customercode" jdbcType="VARCHAR" />
		<result column="DepartmentID" property="departmentid" jdbcType="VARCHAR" />
		<result column="EmployeeID" property="employeeid" jdbcType="VARCHAR" />
		<result column="QuantitySum" property="quantitysum" jdbcType="INTEGER" />
		<result column="DiscountSum" property="discountsum" jdbcType="DECIMAL" />
		<result column="AmountSum" property="amountsum" jdbcType="DECIMAL" />
		<result column="AlterMoney" property="altermoney" jdbcType="DECIMAL" />
		<result column="DiscountMoney" property="discountmoney"
			jdbcType="DECIMAL" />
		<result column="AddMoney" property="addmoney" jdbcType="DECIMAL" />
		<result column="CardMoney" property="cardmoney" jdbcType="DECIMAL" />
		<result column="CashMoney" property="cashmoney" jdbcType="DECIMAL" />
		<result column="CashPaper" property="cashpaper" jdbcType="DECIMAL" />
		<result column="ReturnMoney" property="returnmoney" jdbcType="DECIMAL" />
		<result column="MadeBy" property="madeby" jdbcType="VARCHAR" />
		<result column="MadeByDate" property="madebydate" jdbcType="TIMESTAMP" />
		<result column="AuditFlag" property="auditflag" jdbcType="BIT" />
		<result column="Audit" property="audit" jdbcType="VARCHAR" />
		<result column="AuditDate" property="auditdate" jdbcType="TIMESTAMP" />
		<result column="Year" property="year" jdbcType="CHAR" />
		<result column="Month" property="month" jdbcType="CHAR" />
		<result column="DaySumFlag" property="daysumflag" jdbcType="BIT" />
		<result column="SendFlag" property="sendflag" jdbcType="BIT" />
		<result column="Memo" property="memo" jdbcType="VARCHAR" />
		<result column="ReceivalFlag" property="receivalflag" jdbcType="INTEGER" />
		<result column="ReceivalID" property="receivalid" jdbcType="VARCHAR" />
		<result column="VIPCode" property="vipcode" jdbcType="VARCHAR" />
		<result column="TallyFlag" property="tallyflag" jdbcType="BIT" />
		<result column="OnDutyNo" property="ondutyno" jdbcType="VARCHAR" />
		<result column="OrderFlag" property="orderflag" jdbcType="INTEGER" />
		<result column="OrderNo" property="orderno" jdbcType="VARCHAR" />
		<result column="OrderAmount" property="orderamount" jdbcType="DECIMAL" />
		<result column="CashAmount1" property="cashamount1" jdbcType="DECIMAL" />
		<result column="CashRate1" property="cashrate1" jdbcType="DECIMAL" />
		<result column="CashAmount2" property="cashamount2" jdbcType="DECIMAL" />
		<result column="CashRate2" property="cashrate2" jdbcType="DECIMAL" />
		<result column="CardType" property="cardtype" jdbcType="VARCHAR" />
		<result column="Employee2ID" property="employee2id" jdbcType="VARCHAR" />
		<result column="Employee3ID" property="employee3id" jdbcType="VARCHAR" />
		<result column="WebNo" property="webno" jdbcType="VARCHAR" />
		<result column="SalesPoint" property="salespoint" jdbcType="DECIMAL" />
		<result column="CounterNo" property="counterno" jdbcType="VARCHAR" />
		<result column="CashPaperNo" property="cashpaperno" jdbcType="VARCHAR" />
		<result column="PresentAmount" property="presentamount"
			jdbcType="DECIMAL" />
		<result column="DepositAmount" property="depositamount"
			jdbcType="DECIMAL" />
		<result column="VIPID" property="vipid" jdbcType="VARCHAR" />
		<result column="PointRate" property="pointrate" jdbcType="DECIMAL" />
		<result column="ThisSalesPoint" property="thissalespoint"
			jdbcType="INTEGER" />
		<result column="ExchangedPoint" property="exchangedpoint"
			jdbcType="INTEGER" />
		<result column="DelFlag" property="delflag" jdbcType="SMALLINT" />
		<result column="CommandFlag" property="commandflag" jdbcType="VARCHAR" />
		<result column="ReturnCash" property="returncash" jdbcType="DECIMAL" />
		<result column="VIPDeposit" property="vipdeposit" jdbcType="DECIMAL" />
		<result column="Charge" property="charge" jdbcType="VARCHAR" />
		<result column="FactAmountSum" property="factamountsum"
			jdbcType="DECIMAL" />
		<result column="EShopOrderID" property="eshoporderid" jdbcType="BIGINT" />
		<result column="print_shipping" property="printShipping"
			jdbcType="INTEGER" />
		<result column="print_send" property="printSend" jdbcType="INTEGER" />
		<result column="AnnualFeeCount" property="annualfeecount"
			jdbcType="INTEGER" />
		<result column="TaxCost" property="taxcost" jdbcType="DECIMAL" />
		<result column="LogisticsCost" property="logisticscost"
			jdbcType="DECIMAL" />
		<result column="BusinessDeptID" property="businessdeptid"
			jdbcType="VARCHAR" />
		<result column="UpdateFlag" property="updateflag" jdbcType="BIT" />
	</resultMap>
	<sql id="Example_Where_Clause">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Tue Dec 09 
			15:15:10 CST 2014. -->
		<where>
			<foreach collection="oredCriteria" item="criteria" separator="or">
				<if test="criteria.valid">
					<trim prefix="(" suffix=")" prefixOverrides="and">
						<foreach collection="criteria.criteria" item="criterion">
							<choose>
								<when test="criterion.noValue">
									and ${criterion.condition}
								</when>
								<when test="criterion.singleValue">
									and ${criterion.condition} #{criterion.value}
								</when>
								<when test="criterion.betweenValue">
									and ${criterion.condition} #{criterion.value}
									and
									#{criterion.secondValue}
								</when>
								<when test="criterion.listValue">
									and ${criterion.condition}
									<foreach collection="criterion.value" item="listItem"
										open="(" close=")" separator=",">
										#{listItem}
									</foreach>
								</when>
							</choose>
						</foreach>
					</trim>
				</if>
			</foreach>
		</where>
	</sql>
	<sql id="Base_Column_List">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Tue Dec 09 
			15:15:10 CST 2014. -->
		PosSalesID, No, Type, Date, SPType, CustomerCode, DepartmentID,
		EmployeeID, QuantitySum,
		DiscountSum, AmountSum, AlterMoney,
		DiscountMoney, AddMoney, CardMoney, CashMoney,
		CashPaper, ReturnMoney,
		MadeBy, MadeByDate, AuditFlag, Audit,
		AuditDate, Year, Month,
		DaySumFlag, SendFlag, Memo, ReceivalFlag, ReceivalID, VIPCode,
		TallyFlag,
		OnDutyNo,
		OrderFlag, OrderNo, OrderAmount, CashAmount1,
		CashRate1, CashAmount2, CashRate2,
		CardType, Employee2ID, Employee3ID,
		WebNo, SalesPoint, CounterNo,
		CashPaperNo, PresentAmount,
		DepositAmount, VIPID, PointRate, ThisSalesPoint, ExchangedPoint,
		DelFlag,
		CommandFlag,
		ReturnCash, VIPDeposit, Charge, FactAmountSum,
		EShopOrderID, print_shipping,
		print_send,
		AnnualFeeCount, TaxCost,
		LogisticsCost, BusinessDeptID, UpdateFlag
	</sql>
	<select id="selectByExample" resultMap="BaseResultMap"
		parameterType="com.fuxi.ws.data.entity.PossalesExample">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Tue Dec 09 
			15:15:10 CST 2014. -->
		select
		<if test="distinct">
			distinct
		</if>
		'false' as QUERYID,
		<include refid="Base_Column_List" />
		from POSSales
		<if test="_parameter != null">
			<include refid="Example_Where_Clause" />
		</if>
		<if test="orderByClause != null">
			order by ${orderByClause}
		</if>
	</select>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
		parameterType="java.lang.String">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Tue Dec 09 
			15:15:10 CST 2014. -->
		select
		<include refid="Base_Column_List" />
		from POSSales
		where PosSalesID = #{possalesid,jdbcType=VARCHAR}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Tue Dec 09 
			15:15:10 CST 2014. -->
		delete from POSSales
		where PosSalesID = #{possalesid,jdbcType=VARCHAR}
	</delete>
	<insert id="insert" parameterType="com.fuxi.ws.data.entity.Possales">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Tue Dec 09 
			15:15:10 CST 2014. -->
		insert into POSSales (PosSalesID, No, Type,
		Date, SPType, CustomerCode,
		DepartmentID, EmployeeID, QuantitySum,
		DiscountSum, AmountSum,
		AlterMoney,
		DiscountMoney, AddMoney, CardMoney,
		CashMoney, CashPaper,
		ReturnMoney,
		MadeBy, MadeByDate, AuditFlag,
		Audit, AuditDate, Year,
		Month, DaySumFlag, SendFlag, Memo,
		ReceivalFlag, ReceivalID, VIPCode,
		TallyFlag, OnDutyNo, OrderFlag,
		OrderNo, OrderAmount, CashAmount1,
		CashRate1, CashAmount2, CashRate2,
		CardType, Employee2ID, Employee3ID,
		WebNo, SalesPoint, CounterNo,
		CashPaperNo, PresentAmount,
		DepositAmount,
		VIPID, PointRate, ThisSalesPoint,
		ExchangedPoint,
		DelFlag, CommandFlag,
		ReturnCash, VIPDeposit, Charge,
		FactAmountSum,
		EShopOrderID, print_shipping,
		print_send, AnnualFeeCount, TaxCost,
		LogisticsCost, BusinessDeptID, UpdateFlag
		)
		values
		(#{possalesid,jdbcType=VARCHAR}, #{no,jdbcType=VARCHAR},
		#{type,jdbcType=VARCHAR},
		#{date,jdbcType=TIMESTAMP},
		#{sptype,jdbcType=VARCHAR}, #{customercode,jdbcType=VARCHAR},
		#{departmentid,jdbcType=VARCHAR}, #{employeeid,jdbcType=VARCHAR},
		#{quantitysum,jdbcType=INTEGER},
		#{discountsum,jdbcType=DECIMAL},
		#{amountsum,jdbcType=DECIMAL}, #{altermoney,jdbcType=DECIMAL},
		#{discountmoney,jdbcType=DECIMAL}, #{addmoney,jdbcType=DECIMAL},
		#{cardmoney,jdbcType=DECIMAL},
		#{cashmoney,jdbcType=DECIMAL},
		#{cashpaper,jdbcType=DECIMAL}, #{returnmoney,jdbcType=DECIMAL},
		#{madeby,jdbcType=VARCHAR}, #{madebydate,jdbcType=TIMESTAMP},
		#{auditflag,jdbcType=BIT},
		#{audit,jdbcType=VARCHAR},
		#{auditdate,jdbcType=TIMESTAMP}, #{year,jdbcType=CHAR},
		#{month,jdbcType=CHAR}, #{daysumflag,jdbcType=BIT},
		#{sendflag,jdbcType=BIT}, #{memo,jdbcType=VARCHAR},
		#{receivalflag,jdbcType=INTEGER}, #{receivalid,jdbcType=VARCHAR},
		#{vipcode,jdbcType=VARCHAR},
		#{tallyflag,jdbcType=BIT},
		#{ondutyno,jdbcType=VARCHAR}, #{orderflag,jdbcType=INTEGER},
		#{orderno,jdbcType=VARCHAR}, #{orderamount,jdbcType=DECIMAL},
		#{cashamount1,jdbcType=DECIMAL},
		#{cashrate1,jdbcType=DECIMAL},
		#{cashamount2,jdbcType=DECIMAL}, #{cashrate2,jdbcType=DECIMAL},
		#{cardtype,jdbcType=VARCHAR}, #{employee2id,jdbcType=VARCHAR},
		#{employee3id,jdbcType=VARCHAR},
		#{webno,jdbcType=VARCHAR},
		#{salespoint,jdbcType=DECIMAL}, #{counterno,jdbcType=VARCHAR},
		#{cashpaperno,jdbcType=VARCHAR}, #{presentamount,jdbcType=DECIMAL},
		#{depositamount,jdbcType=DECIMAL},
		#{vipid,jdbcType=VARCHAR},
		#{pointrate,jdbcType=DECIMAL}, #{thissalespoint,jdbcType=INTEGER},
		#{exchangedpoint,jdbcType=INTEGER}, #{delflag,jdbcType=SMALLINT},
		#{commandflag,jdbcType=VARCHAR},
		#{returncash,jdbcType=DECIMAL},
		#{vipdeposit,jdbcType=DECIMAL}, #{charge,jdbcType=VARCHAR},
		#{factamountsum,jdbcType=DECIMAL}, #{eshoporderid,jdbcType=BIGINT},
		#{printShipping,jdbcType=INTEGER},
		#{printSend,jdbcType=INTEGER},
		#{annualfeecount,jdbcType=INTEGER}, #{taxcost,jdbcType=DECIMAL},
		#{logisticscost,jdbcType=DECIMAL}, #{businessdeptid,jdbcType=VARCHAR},
		#{updateflag,jdbcType=BIT}
		)
	</insert>
	<insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.Possales">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Tue Dec 09 
			15:15:10 CST 2014. -->
		insert into POSSales
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="possalesid != null">
				PosSalesID,
			</if>
			<if test="no != null">
				No,
			</if>
			<if test="type != null">
				Type,
			</if>
			<if test="date != null">
				Date,
			</if>
			<if test="sptype != null">
				SPType,
			</if>
			<if test="customercode != null">
				CustomerCode,
			</if>
			<if test="departmentid != null">
				DepartmentID,
			</if>
			<if test="employeeid != null">
				EmployeeID,
			</if>
			<if test="quantitysum != null">
				QuantitySum,
			</if>
			<if test="discountsum != null">
				DiscountSum,
			</if>
			<if test="amountsum != null">
				AmountSum,
			</if>
			<if test="altermoney != null">
				AlterMoney,
			</if>
			<if test="discountmoney != null">
				DiscountMoney,
			</if>
			<if test="addmoney != null">
				AddMoney,
			</if>
			<if test="cardmoney != null">
				CardMoney,
			</if>
			<if test="cashmoney != null">
				CashMoney,
			</if>
			<if test="cashpaper != null">
				CashPaper,
			</if>
			<if test="returnmoney != null">
				ReturnMoney,
			</if>
			<if test="madeby != null">
				MadeBy,
			</if>
			<if test="madebydate != null">
				MadeByDate,
			</if>
			<if test="auditflag != null">
				AuditFlag,
			</if>
			<if test="audit != null">
				Audit,
			</if>
			<if test="auditdate != null">
				AuditDate,
			</if>
			<if test="year != null">
				Year,
			</if>
			<if test="month != null">
				Month,
			</if>
			<if test="daysumflag != null">
				DaySumFlag,
			</if>
			<if test="sendflag != null">
				SendFlag,
			</if>
			<if test="memo != null">
				Memo,
			</if>
			<if test="receivalflag != null">
				ReceivalFlag,
			</if>
			<if test="receivalid != null">
				ReceivalID,
			</if>
			<if test="vipcode != null">
				VIPCode,
			</if>
			<if test="tallyflag != null">
				TallyFlag,
			</if>
			<if test="ondutyno != null">
				OnDutyNo,
			</if>
			<if test="orderflag != null">
				OrderFlag,
			</if>
			<if test="orderno != null">
				OrderNo,
			</if>
			<if test="orderamount != null">
				OrderAmount,
			</if>
			<if test="cashamount1 != null">
				CashAmount1,
			</if>
			<if test="cashrate1 != null">
				CashRate1,
			</if>
			<if test="cashamount2 != null">
				CashAmount2,
			</if>
			<if test="cashrate2 != null">
				CashRate2,
			</if>
			<if test="cardtype != null">
				CardType,
			</if>
			<if test="employee2id != null">
				Employee2ID,
			</if>
			<if test="employee3id != null">
				Employee3ID,
			</if>
			<if test="webno != null">
				WebNo,
			</if>
			<if test="salespoint != null">
				SalesPoint,
			</if>
			<if test="counterno != null">
				CounterNo,
			</if>
			<if test="cashpaperno != null">
				CashPaperNo,
			</if>
			<if test="presentamount != null">
				PresentAmount,
			</if>
			<if test="depositamount != null">
				DepositAmount,
			</if>
			<if test="vipid != null">
				VIPID,
			</if>
			<if test="pointrate != null">
				PointRate,
			</if>
			<if test="thissalespoint != null">
				ThisSalesPoint,
			</if>
			<if test="exchangedpoint != null">
				ExchangedPoint,
			</if>
			<if test="delflag != null">
				DelFlag,
			</if>
			<if test="commandflag != null">
				CommandFlag,
			</if>
			<if test="returncash != null">
				ReturnCash,
			</if>
			<if test="vipdeposit != null">
				VIPDeposit,
			</if>
			<if test="charge != null">
				Charge,
			</if>
			<if test="factamountsum != null">
				FactAmountSum,
			</if>
			<if test="eshoporderid != null">
				EShopOrderID,
			</if>
			<if test="printShipping != null">
				print_shipping,
			</if>
			<if test="printSend != null">
				print_send,
			</if>
			<if test="annualfeecount != null">
				AnnualFeeCount,
			</if>
			<if test="taxcost != null">
				TaxCost,
			</if>
			<if test="logisticscost != null">
				LogisticsCost,
			</if>
			<if test="businessdeptid != null">
				BusinessDeptID,
			</if>
			<if test="updateflag != null">
				UpdateFlag,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="possalesid != null">
				#{possalesid,jdbcType=VARCHAR},
			</if>
			<if test="no != null">
				#{no,jdbcType=VARCHAR},
			</if>
			<if test="type != null">
				#{type,jdbcType=VARCHAR},
			</if>
			<if test="date != null">
				#{date,jdbcType=TIMESTAMP},
			</if>
			<if test="sptype != null">
				#{sptype,jdbcType=VARCHAR},
			</if>
			<if test="customercode != null">
				#{customercode,jdbcType=VARCHAR},
			</if>
			<if test="departmentid != null">
				#{departmentid,jdbcType=VARCHAR},
			</if>
			<if test="employeeid != null">
				#{employeeid,jdbcType=VARCHAR},
			</if>
			<if test="quantitysum != null">
				#{quantitysum,jdbcType=INTEGER},
			</if>
			<if test="discountsum != null">
				#{discountsum,jdbcType=DECIMAL},
			</if>
			<if test="amountsum != null">
				#{amountsum,jdbcType=DECIMAL},
			</if>
			<if test="altermoney != null">
				#{altermoney,jdbcType=DECIMAL},
			</if>
			<if test="discountmoney != null">
				#{discountmoney,jdbcType=DECIMAL},
			</if>
			<if test="addmoney != null">
				#{addmoney,jdbcType=DECIMAL},
			</if>
			<if test="cardmoney != null">
				#{cardmoney,jdbcType=DECIMAL},
			</if>
			<if test="cashmoney != null">
				#{cashmoney,jdbcType=DECIMAL},
			</if>
			<if test="cashpaper != null">
				#{cashpaper,jdbcType=DECIMAL},
			</if>
			<if test="returnmoney != null">
				#{returnmoney,jdbcType=DECIMAL},
			</if>
			<if test="madeby != null">
				#{madeby,jdbcType=VARCHAR},
			</if>
			<if test="madebydate != null">
				#{madebydate,jdbcType=TIMESTAMP},
			</if>
			<if test="auditflag != null">
				#{auditflag,jdbcType=BIT},
			</if>
			<if test="audit != null">
				#{audit,jdbcType=VARCHAR},
			</if>
			<if test="auditdate != null">
				#{auditdate,jdbcType=TIMESTAMP},
			</if>
			<if test="year != null">
				#{year,jdbcType=CHAR},
			</if>
			<if test="month != null">
				#{month,jdbcType=CHAR},
			</if>
			<if test="daysumflag != null">
				#{daysumflag,jdbcType=BIT},
			</if>
			<if test="sendflag != null">
				#{sendflag,jdbcType=BIT},
			</if>
			<if test="memo != null">
				#{memo,jdbcType=VARCHAR},
			</if>
			<if test="receivalflag != null">
				#{receivalflag,jdbcType=INTEGER},
			</if>
			<if test="receivalid != null">
				#{receivalid,jdbcType=VARCHAR},
			</if>
			<if test="vipcode != null">
				#{vipcode,jdbcType=VARCHAR},
			</if>
			<if test="tallyflag != null">
				#{tallyflag,jdbcType=BIT},
			</if>
			<if test="ondutyno != null">
				#{ondutyno,jdbcType=VARCHAR},
			</if>
			<if test="orderflag != null">
				#{orderflag,jdbcType=INTEGER},
			</if>
			<if test="orderno != null">
				#{orderno,jdbcType=VARCHAR},
			</if>
			<if test="orderamount != null">
				#{orderamount,jdbcType=DECIMAL},
			</if>
			<if test="cashamount1 != null">
				#{cashamount1,jdbcType=DECIMAL},
			</if>
			<if test="cashrate1 != null">
				#{cashrate1,jdbcType=DECIMAL},
			</if>
			<if test="cashamount2 != null">
				#{cashamount2,jdbcType=DECIMAL},
			</if>
			<if test="cashrate2 != null">
				#{cashrate2,jdbcType=DECIMAL},
			</if>
			<if test="cardtype != null">
				#{cardtype,jdbcType=VARCHAR},
			</if>
			<if test="employee2id != null">
				#{employee2id,jdbcType=VARCHAR},
			</if>
			<if test="employee3id != null">
				#{employee3id,jdbcType=VARCHAR},
			</if>
			<if test="webno != null">
				#{webno,jdbcType=VARCHAR},
			</if>
			<if test="salespoint != null">
				#{salespoint,jdbcType=DECIMAL},
			</if>
			<if test="counterno != null">
				#{counterno,jdbcType=VARCHAR},
			</if>
			<if test="cashpaperno != null">
				#{cashpaperno,jdbcType=VARCHAR},
			</if>
			<if test="presentamount != null">
				#{presentamount,jdbcType=DECIMAL},
			</if>
			<if test="depositamount != null">
				#{depositamount,jdbcType=DECIMAL},
			</if>
			<if test="vipid != null">
				#{vipid,jdbcType=VARCHAR},
			</if>
			<if test="pointrate != null">
				#{pointrate,jdbcType=DECIMAL},
			</if>
			<if test="thissalespoint != null">
				#{thissalespoint,jdbcType=INTEGER},
			</if>
			<if test="exchangedpoint != null">
				#{exchangedpoint,jdbcType=INTEGER},
			</if>
			<if test="delflag != null">
				#{delflag,jdbcType=SMALLINT},
			</if>
			<if test="commandflag != null">
				#{commandflag,jdbcType=VARCHAR},
			</if>
			<if test="returncash != null">
				#{returncash,jdbcType=DECIMAL},
			</if>
			<if test="vipdeposit != null">
				#{vipdeposit,jdbcType=DECIMAL},
			</if>
			<if test="charge != null">
				#{charge,jdbcType=VARCHAR},
			</if>
			<if test="factamountsum != null">
				#{factamountsum,jdbcType=DECIMAL},
			</if>
			<if test="eshoporderid != null">
				#{eshoporderid,jdbcType=BIGINT},
			</if>
			<if test="printShipping != null">
				#{printShipping,jdbcType=INTEGER},
			</if>
			<if test="printSend != null">
				#{printSend,jdbcType=INTEGER},
			</if>
			<if test="annualfeecount != null">
				#{annualfeecount,jdbcType=INTEGER},
			</if>
			<if test="taxcost != null">
				#{taxcost,jdbcType=DECIMAL},
			</if>
			<if test="logisticscost != null">
				#{logisticscost,jdbcType=DECIMAL},
			</if>
			<if test="businessdeptid != null">
				#{businessdeptid,jdbcType=VARCHAR},
			</if>
			<if test="updateflag != null">
				#{updateflag,jdbcType=BIT},
			</if>
		</trim>
	</insert>
	<select id="countByExample" parameterType="com.fuxi.ws.data.entity.PossalesExample"
		resultType="java.lang.Integer">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Tue Dec 09 
			15:15:10 CST 2014. -->
		select count(*) from POSSales
		<if test="_parameter != null">
			<include refid="Example_Where_Clause" />
		</if>
	</select>
	<update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.Possales">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Tue Dec 09 
			15:15:10 CST 2014. -->
		update POSSales
		<set>
			<if test="no != null">
				No = #{no,jdbcType=VARCHAR},
			</if>
			<if test="type != null">
				Type = #{type,jdbcType=VARCHAR},
			</if>
			<if test="date != null">
				Date = #{date,jdbcType=TIMESTAMP},
			</if>
			<if test="sptype != null">
				SPType = #{sptype,jdbcType=VARCHAR},
			</if>
			<if test="customercode != null">
				CustomerCode = #{customercode,jdbcType=VARCHAR},
			</if>
			<if test="departmentid != null">
				DepartmentID = #{departmentid,jdbcType=VARCHAR},
			</if>
			<if test="employeeid != null">
				EmployeeID = #{employeeid,jdbcType=VARCHAR},
			</if>
			<if test="quantitysum != null">
				QuantitySum = #{quantitysum,jdbcType=INTEGER},
			</if>
			<if test="discountsum != null">
				DiscountSum = #{discountsum,jdbcType=DECIMAL},
			</if>
			<if test="amountsum != null">
				AmountSum = #{amountsum,jdbcType=DECIMAL},
			</if>
			<if test="altermoney != null">
				AlterMoney = #{altermoney,jdbcType=DECIMAL},
			</if>
			<if test="discountmoney != null">
				DiscountMoney = #{discountmoney,jdbcType=DECIMAL},
			</if>
			<if test="addmoney != null">
				AddMoney = #{addmoney,jdbcType=DECIMAL},
			</if>
			<if test="cardmoney != null">
				CardMoney = #{cardmoney,jdbcType=DECIMAL},
			</if>
			<if test="cashmoney != null">
				CashMoney = #{cashmoney,jdbcType=DECIMAL},
			</if>
			<if test="cashpaper != null">
				CashPaper = #{cashpaper,jdbcType=DECIMAL},
			</if>
			<if test="returnmoney != null">
				ReturnMoney = #{returnmoney,jdbcType=DECIMAL},
			</if>
			<if test="madeby != null">
				MadeBy = #{madeby,jdbcType=VARCHAR},
			</if>
			<if test="madebydate != null">
				MadeByDate = #{madebydate,jdbcType=TIMESTAMP},
			</if>
			<if test="auditflag != null">
				AuditFlag = #{auditflag,jdbcType=BIT},
			</if>
			<if test="audit != null">
				Audit = #{audit,jdbcType=VARCHAR},
			</if>
			<if test="auditdate != null">
				AuditDate = #{auditdate,jdbcType=TIMESTAMP},
			</if>
			<if test="year != null">
				Year = #{year,jdbcType=CHAR},
			</if>
			<if test="month != null">
				Month = #{month,jdbcType=CHAR},
			</if>
			<if test="daysumflag != null">
				DaySumFlag = #{daysumflag,jdbcType=BIT},
			</if>
			<if test="sendflag != null">
				SendFlag = #{sendflag,jdbcType=BIT},
			</if>
			<if test="memo != null">
				Memo = #{memo,jdbcType=VARCHAR},
			</if>
			<if test="receivalflag != null">
				ReceivalFlag = #{receivalflag,jdbcType=INTEGER},
			</if>
			<if test="receivalid != null">
				ReceivalID = #{receivalid,jdbcType=VARCHAR},
			</if>
			<if test="vipcode != null">
				VIPCode = #{vipcode,jdbcType=VARCHAR},
			</if>
			<if test="tallyflag != null">
				TallyFlag = #{tallyflag,jdbcType=BIT},
			</if>
			<if test="ondutyno != null">
				OnDutyNo = #{ondutyno,jdbcType=VARCHAR},
			</if>
			<if test="orderflag != null">
				OrderFlag = #{orderflag,jdbcType=INTEGER},
			</if>
			<if test="orderno != null">
				OrderNo = #{orderno,jdbcType=VARCHAR},
			</if>
			<if test="orderamount != null">
				OrderAmount = #{orderamount,jdbcType=DECIMAL},
			</if>
			<if test="cashamount1 != null">
				CashAmount1 = #{cashamount1,jdbcType=DECIMAL},
			</if>
			<if test="cashrate1 != null">
				CashRate1 = #{cashrate1,jdbcType=DECIMAL},
			</if>
			<if test="cashamount2 != null">
				CashAmount2 = #{cashamount2,jdbcType=DECIMAL},
			</if>
			<if test="cashrate2 != null">
				CashRate2 = #{cashrate2,jdbcType=DECIMAL},
			</if>
			<if test="cardtype != null">
				CardType = #{cardtype,jdbcType=VARCHAR},
			</if>
			<if test="employee2id != null">
				Employee2ID = #{employee2id,jdbcType=VARCHAR},
			</if>
			<if test="employee3id != null">
				Employee3ID = #{employee3id,jdbcType=VARCHAR},
			</if>
			<if test="webno != null">
				WebNo = #{webno,jdbcType=VARCHAR},
			</if>
			<if test="salespoint != null">
				SalesPoint = #{salespoint,jdbcType=DECIMAL},
			</if>
			<if test="counterno != null">
				CounterNo = #{counterno,jdbcType=VARCHAR},
			</if>
			<if test="cashpaperno != null">
				CashPaperNo = #{cashpaperno,jdbcType=VARCHAR},
			</if>
			<if test="presentamount != null">
				PresentAmount = #{presentamount,jdbcType=DECIMAL},
			</if>
			<if test="depositamount != null">
				DepositAmount = #{depositamount,jdbcType=DECIMAL},
			</if>
			<if test="vipid != null">
				VIPID = #{vipid,jdbcType=VARCHAR},
			</if>
			<if test="pointrate != null">
				PointRate = #{pointrate,jdbcType=DECIMAL},
			</if>
			<if test="thissalespoint != null">
				ThisSalesPoint = #{thissalespoint,jdbcType=INTEGER},
			</if>
			<if test="exchangedpoint != null">
				ExchangedPoint = #{exchangedpoint,jdbcType=INTEGER},
			</if>
			<if test="delflag != null">
				DelFlag = #{delflag,jdbcType=SMALLINT},
			</if>
			<if test="commandflag != null">
				CommandFlag = #{commandflag,jdbcType=VARCHAR},
			</if>
			<if test="returncash != null">
				ReturnCash = #{returncash,jdbcType=DECIMAL},
			</if>
			<if test="vipdeposit != null">
				VIPDeposit = #{vipdeposit,jdbcType=DECIMAL},
			</if>
			<if test="charge != null">
				Charge = #{charge,jdbcType=VARCHAR},
			</if>
			<if test="factamountsum != null">
				FactAmountSum = #{factamountsum,jdbcType=DECIMAL},
			</if>
			<if test="eshoporderid != null">
				EShopOrderID = #{eshoporderid,jdbcType=BIGINT},
			</if>
			<if test="printShipping != null">
				print_shipping = #{printShipping,jdbcType=INTEGER},
			</if>
			<if test="printSend != null">
				print_send = #{printSend,jdbcType=INTEGER},
			</if>
			<if test="annualfeecount != null">
				AnnualFeeCount = #{annualfeecount,jdbcType=INTEGER},
			</if>
			<if test="taxcost != null">
				TaxCost = #{taxcost,jdbcType=DECIMAL},
			</if>
			<if test="logisticscost != null">
				LogisticsCost = #{logisticscost,jdbcType=DECIMAL},
			</if>
			<if test="businessdeptid != null">
				BusinessDeptID = #{businessdeptid,jdbcType=VARCHAR},
			</if>
			<if test="updateflag != null">
				UpdateFlag = #{updateflag,jdbcType=BIT},
			</if>
		</set>
		where PosSalesID = #{possalesid,jdbcType=VARCHAR}
	</update>
	<update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.Possales">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Tue Dec 09 
			15:15:10 CST 2014. -->
		update POSSales
		set No = #{no,jdbcType=VARCHAR},
		Type =
		#{type,jdbcType=VARCHAR},
		Date = #{date,jdbcType=TIMESTAMP},
		SPType =
		#{sptype,jdbcType=VARCHAR},
		CustomerCode =
		#{customercode,jdbcType=VARCHAR},
		DepartmentID =
		#{departmentid,jdbcType=VARCHAR},
		EmployeeID =
		#{employeeid,jdbcType=VARCHAR},
		QuantitySum =
		#{quantitysum,jdbcType=INTEGER},
		DiscountSum =
		#{discountsum,jdbcType=DECIMAL},
		AmountSum =
		#{amountsum,jdbcType=DECIMAL},
		AlterMoney =
		#{altermoney,jdbcType=DECIMAL},
		DiscountMoney =
		#{discountmoney,jdbcType=DECIMAL},
		AddMoney =
		#{addmoney,jdbcType=DECIMAL},
		CardMoney =
		#{cardmoney,jdbcType=DECIMAL},
		CashMoney =
		#{cashmoney,jdbcType=DECIMAL},
		CashPaper =
		#{cashpaper,jdbcType=DECIMAL},
		ReturnMoney =
		#{returnmoney,jdbcType=DECIMAL},
		MadeBy = #{madeby,jdbcType=VARCHAR},
		MadeByDate = #{madebydate,jdbcType=TIMESTAMP},
		AuditFlag =
		#{auditflag,jdbcType=BIT},
		Audit = #{audit,jdbcType=VARCHAR},
		AuditDate
		= #{auditdate,jdbcType=TIMESTAMP},
		Year = #{year,jdbcType=CHAR},
		Month =
		#{month,jdbcType=CHAR},
		DaySumFlag = #{daysumflag,jdbcType=BIT},
		SendFlag = #{sendflag,jdbcType=BIT},
		Memo = #{memo,jdbcType=VARCHAR},
		ReceivalFlag = #{receivalflag,jdbcType=INTEGER},
		ReceivalID =
		#{receivalid,jdbcType=VARCHAR},
		VIPCode = #{vipcode,jdbcType=VARCHAR},
		TallyFlag = #{tallyflag,jdbcType=BIT},
		OnDutyNo =
		#{ondutyno,jdbcType=VARCHAR},
		OrderFlag =
		#{orderflag,jdbcType=INTEGER},
		OrderNo = #{orderno,jdbcType=VARCHAR},
		OrderAmount = #{orderamount,jdbcType=DECIMAL},
		CashAmount1 =
		#{cashamount1,jdbcType=DECIMAL},
		CashRate1 =
		#{cashrate1,jdbcType=DECIMAL},
		CashAmount2 =
		#{cashamount2,jdbcType=DECIMAL},
		CashRate2 =
		#{cashrate2,jdbcType=DECIMAL},
		CardType = #{cardtype,jdbcType=VARCHAR},
		Employee2ID = #{employee2id,jdbcType=VARCHAR},
		Employee3ID =
		#{employee3id,jdbcType=VARCHAR},
		WebNo = #{webno,jdbcType=VARCHAR},
		SalesPoint = #{salespoint,jdbcType=DECIMAL},
		CounterNo =
		#{counterno,jdbcType=VARCHAR},
		CashPaperNo =
		#{cashpaperno,jdbcType=VARCHAR},
		PresentAmount =
		#{presentamount,jdbcType=DECIMAL},
		DepositAmount =
		#{depositamount,jdbcType=DECIMAL},
		VIPID = #{vipid,jdbcType=VARCHAR},
		PointRate = #{pointrate,jdbcType=DECIMAL},
		ThisSalesPoint =
		#{thissalespoint,jdbcType=INTEGER},
		ExchangedPoint =
		#{exchangedpoint,jdbcType=INTEGER},
		DelFlag =
		#{delflag,jdbcType=SMALLINT},
		CommandFlag =
		#{commandflag,jdbcType=VARCHAR},
		ReturnCash =
		#{returncash,jdbcType=DECIMAL},
		VIPDeposit =
		#{vipdeposit,jdbcType=DECIMAL},
		Charge = #{charge,jdbcType=VARCHAR},
		FactAmountSum = #{factamountsum,jdbcType=DECIMAL},
		EShopOrderID =
		#{eshoporderid,jdbcType=BIGINT},
		print_shipping =
		#{printShipping,jdbcType=INTEGER},
		print_send =
		#{printSend,jdbcType=INTEGER},
		AnnualFeeCount =
		#{annualfeecount,jdbcType=INTEGER},
		TaxCost =
		#{taxcost,jdbcType=DECIMAL},
		LogisticsCost =
		#{logisticscost,jdbcType=DECIMAL},
		BusinessDeptID =
		#{businessdeptid,jdbcType=VARCHAR},
		UpdateFlag =
		#{updateflag,jdbcType=BIT}
		where PosSalesID =
		#{possalesid,jdbcType=VARCHAR}
	</update>

	<!--积分记录 查询小票表POSSales 与积分兑换表DeductSalesPoint -->
	<select id="queryPOSSalesAndDeductSalesPointBySql" resultType="java.util.LinkedHashMap">
		${textSQL}
	</select>

	<!--充值记录 查询小票表POSSales 与充值记录表VIPDepositLog -->
	<select id="queryPOSSalesAndVIPDepositLogBySql" resultType="java.util.LinkedHashMap">
		${textSQL}
	</select>

	<!-- 会员中心:我的消费 -->
	<select id="vipBuy" resultType="java.util.LinkedHashMap">
		select
		a.Date,ISNULL(a.FactAmountSum,0) Money,b.Department,a.Memo
		from POSSales a
		join Department b on a.BusinessDeptID=b.DepartmentID
		where a.VIPID=#{
		vipid } and a.Type='销售单' and a.AuditFlag='1'
	</select>
	
	<!-- 后台消费记录统计 -->
	<select id="vipBuySum" resultType="java.util.LinkedHashMap">
		select t.purchasedamount,t.Times,case when t.Times>0 then round(t.purchasedamount/t.Times,2) else 0 end as buyPrice
		,t.Buynumbers
		from(
		select a.VIPID,round(sum(b.AllotSales),2) purchasedamount,(select count(wds.date) from WD_Orders wds where wds.vipid=a.vipid) Times,sum(b.Quantity) as Buynumbers 
		from WD_Orders a inner join WD_Ordersdtl b on a.OrderID=b.OrderID 
		where a.VIPID=#{
		vipid } and a.Status in (4,5,7,8)and a.OrderType=1 group by a.VIPID) t 
	</select>

	<!-- 根据订单ID删除对应发货单 -->
	<delete id="deleteByEshoporderID">
		delete from POSSales where EShopOrderID=#{
		eshoporderid }
	</delete>
</mapper>