<?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.WFcartMapper">
	<resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.WFcart">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Thu May 19 
			11:24:40 CST 2016. -->
		<id column="Vipid" jdbcType="VARCHAR" property="vipid" />
		<id column="GoodsID" jdbcType="VARCHAR" property="goodsid" />
		<id column="ColorID" jdbcType="VARCHAR" property="colorid" />
		<id column="SizeID" jdbcType="VARCHAR" property="sizeid" />
		<result column="Quantity" jdbcType="INTEGER" property="quantity" />
		<result column="Dec" jdbcType="NVARCHAR" property="dec" />
		<result column="DepartmentID" jdbcType="VARCHAR" property="departmentid" />
	</resultMap>
	<sql id="Example_Where_Clause">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Thu May 19 
			11:24:40 CST 2016. -->
		<where>
			<foreach collection="oredCriteria" item="criteria" separator="or">
				<if test="criteria.valid">
					<trim prefix="(" prefixOverrides="and" suffix=")">
						<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 close=")" collection="criterion.value" item="listItem"
										open="(" 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 Thu May 19 
			11:24:40 CST 2016. -->
		Vipid, GoodsID, ColorID, SizeID, Quantity, Dec, DepartmentID
	</sql>
	<select id="selectByExample" parameterType="com.fuxi.ws.data.entity.WFcartExample"
		resultMap="BaseResultMap">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Thu May 19 
			11:24:40 CST 2016. -->
		select
		<if test="distinct">
			distinct
		</if>
		'false' as QUERYID,
		<include refid="Base_Column_List" />
		from W_Fcart
		<if test="_parameter != null">
			<include refid="Example_Where_Clause" />
		</if>
		<if test="orderByClause != null">
			order by ${orderByClause}
		</if>
	</select>
	<select id="selectByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WFcartKey"
		resultMap="BaseResultMap">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Thu May 19 
			11:24:40 CST 2016. -->
		select
		<include refid="Base_Column_List" />
		from W_Fcart
		where Vipid = #{vipid,jdbcType=VARCHAR}
		and GoodsID =
		#{goodsid,jdbcType=VARCHAR}
		and ColorID = #{colorid,jdbcType=VARCHAR}
		and SizeID = #{sizeid,jdbcType=VARCHAR}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WFcartKey">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Thu May 19 
			11:24:40 CST 2016. -->
		delete from W_Fcart
		where Vipid = #{vipid,jdbcType=VARCHAR}
		and GoodsID
		= #{goodsid,jdbcType=VARCHAR}
		and ColorID = #{colorid,jdbcType=VARCHAR}
		and SizeID = #{sizeid,jdbcType=VARCHAR}
	</delete>
	<insert id="insert" parameterType="com.fuxi.ws.data.entity.WFcart">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Thu May 19 
			11:24:40 CST 2016. -->
		insert into W_Fcart (Vipid, GoodsID, ColorID,
		SizeID, Quantity, Dec,
		DepartmentID)
		values (#{vipid,jdbcType=VARCHAR},
		#{goodsid,jdbcType=VARCHAR},
		#{colorid,jdbcType=VARCHAR},
		#{sizeid,jdbcType=VARCHAR}, #{quantity,jdbcType=INTEGER},
		#{dec,jdbcType=NVARCHAR},
		#{departmentid,jdbcType=VARCHAR})
	</insert>
	<insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.WFcart">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Thu May 19 
			11:24:40 CST 2016. -->
		insert into W_Fcart
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="vipid != null">
				Vipid,
			</if>
			<if test="goodsid != null">
				GoodsID,
			</if>
			<if test="colorid != null">
				ColorID,
			</if>
			<if test="sizeid != null">
				SizeID,
			</if>
			<if test="quantity != null">
				Quantity,
			</if>
			<if test="dec != null">
				Dec,
			</if>
			<if test="departmentid != null">
				DepartmentID,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="vipid != null">
				#{vipid,jdbcType=VARCHAR},
			</if>
			<if test="goodsid != null">
				#{goodsid,jdbcType=VARCHAR},
			</if>
			<if test="colorid != null">
				#{colorid,jdbcType=VARCHAR},
			</if>
			<if test="sizeid != null">
				#{sizeid,jdbcType=VARCHAR},
			</if>
			<if test="quantity != null">
				#{quantity,jdbcType=INTEGER},
			</if>
			<if test="dec != null">
				#{dec,jdbcType=NVARCHAR},
			</if>
			<if test="departmentid != null">
				#{departmentid,jdbcType=VARCHAR},
			</if>
		</trim>
	</insert>
	<select id="countByExample" parameterType="com.fuxi.ws.data.entity.WFcartExample"
		resultType="java.lang.Integer">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Thu May 19 
			11:24:40 CST 2016. -->
		select count(*) from W_Fcart
		<if test="_parameter != null">
			<include refid="Example_Where_Clause" />
		</if>
	</select>
	<update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.WFcart">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Thu May 19 
			11:24:40 CST 2016. -->
		update W_Fcart
		<set>
			<if test="quantity != null">
				Quantity = #{quantity,jdbcType=INTEGER},
			</if>
			<if test="dec != null">
				Dec = #{dec,jdbcType=NVARCHAR},
			</if>
			<if test="departmentid != null">
				DepartmentID = #{departmentid,jdbcType=VARCHAR},
			</if>
		</set>
		where Vipid = #{vipid,jdbcType=VARCHAR}
		and GoodsID =
		#{goodsid,jdbcType=VARCHAR}
		and ColorID = #{colorid,jdbcType=VARCHAR}
		and SizeID = #{sizeid,jdbcType=VARCHAR}
	</update>
	<update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WFcart">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Thu May 19 
			11:24:40 CST 2016. -->
		update W_Fcart
		set Quantity = #{quantity,jdbcType=INTEGER},
		Dec =
		#{dec,jdbcType=NVARCHAR},
		DepartmentID =
		#{departmentid,jdbcType=VARCHAR}
		where Vipid =
		#{vipid,jdbcType=VARCHAR}
		and GoodsID = #{goodsid,jdbcType=VARCHAR}
		and
		ColorID = #{colorid,jdbcType=VARCHAR}
		and SizeID =
		#{sizeid,jdbcType=VARCHAR}
	</update>

	<!-- 试穿列表 -->
	<select id="fCart" resultType="java.util.LinkedHashMap">
		select
		a.*,b.GoodName,b.ImgPath,c.Color,d.Size,b.ViewColor,b.ViewSize,b.Price,e.Price
		Price2 from
		W_Fcart a
		join W_Goods b on
		a.GoodsID=b.GoodsID
		join Color c
		on
		a.ColorID=c.ColorID
		join Size d on
		a.SizeID=d.SizeID
		left join W_Store
		e on a.GoodsID=e.GoodsID and a.ColorID=e.ColorID and
		a.SizeID=e.SizeID
		where
		a.VIPID=#{vipid}
	</select>

	<!-- 提交试衣单,删除试衣车商品 -->
	<delete id="deleteByVipID">
		delete from W_Fcart where VIPID=#{vipid}
	</delete>
</mapper>