<?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.WRepairdtlMapper">
	<resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.WRepairdtl">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Mon Aug 10 
			17:37:08 CST 2015. -->
		<id column="RepairID" jdbcType="BIGINT" property="repairid" />
		<id column="GoodsID" jdbcType="VARCHAR" property="goodsid" />
		<id column="ColorID" jdbcType="VARCHAR" property="colorid" />
		<id column="SizeID" jdbcType="VARCHAR" property="sizeid" />
		<result column="UnitPrice" jdbcType="DECIMAL" property="unitprice" />
		<result column="Quantity" jdbcType="INTEGER" property="quantity" />
		<result column="Fee" jdbcType="DECIMAL" property="fee" />
	</resultMap>
	<sql id="Example_Where_Clause">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Mon Aug 10 
			17:37:08 CST 2015. -->
		<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 Mon Aug 10 
			17:37:08 CST 2015. -->
		RepairID, GoodsID, ColorID, SizeID, UnitPrice, Quantity, Fee
	</sql>
	<select id="selectByExample" parameterType="com.fuxi.ws.data.entity.WRepairdtlExample"
		resultMap="BaseResultMap">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Mon Aug 10 
			17:37:08 CST 2015. -->
		select
		<if test="distinct">
			distinct
		</if>
		'false' as QUERYID,
		<include refid="Base_Column_List" />
		from W_RepairDtl
		<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.WRepairdtlKey"
		resultMap="BaseResultMap">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Mon Aug 10 
			17:37:08 CST 2015. -->
		select
		<include refid="Base_Column_List" />
		from W_RepairDtl
		where RepairID = #{repairid,jdbcType=BIGINT}
		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.WRepairdtlKey">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Mon Aug 10 
			17:37:08 CST 2015. -->
		delete from W_RepairDtl
		where RepairID = #{repairid,jdbcType=BIGINT}
		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.WRepairdtl">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Mon Aug 10 
			17:37:08 CST 2015. -->
		insert into W_RepairDtl (RepairID, GoodsID, ColorID,
		SizeID, UnitPrice,
		Quantity,
		Fee)
		values (#{repairid,jdbcType=BIGINT},
		#{goodsid,jdbcType=VARCHAR},
		#{colorid,jdbcType=VARCHAR},
		#{sizeid,jdbcType=VARCHAR}, #{unitprice,jdbcType=DECIMAL},
		#{quantity,jdbcType=INTEGER},
		#{fee,jdbcType=DECIMAL})
	</insert>
	<insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.WRepairdtl">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Mon Aug 10 
			17:37:08 CST 2015. -->
		insert into W_RepairDtl
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="repairid != null">
				RepairID,
			</if>
			<if test="goodsid != null">
				GoodsID,
			</if>
			<if test="colorid != null">
				ColorID,
			</if>
			<if test="sizeid != null">
				SizeID,
			</if>
			<if test="unitprice != null">
				UnitPrice,
			</if>
			<if test="quantity != null">
				Quantity,
			</if>
			<if test="fee != null">
				Fee,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="repairid != null">
				#{repairid,jdbcType=BIGINT},
			</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="unitprice != null">
				#{unitprice,jdbcType=DECIMAL},
			</if>
			<if test="quantity != null">
				#{quantity,jdbcType=INTEGER},
			</if>
			<if test="fee != null">
				#{fee,jdbcType=DECIMAL},
			</if>
		</trim>
	</insert>
	<select id="countByExample" parameterType="com.fuxi.ws.data.entity.WRepairdtlExample"
		resultType="java.lang.Integer">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Mon Aug 10 
			17:37:08 CST 2015. -->
		select count(*) from W_RepairDtl
		<if test="_parameter != null">
			<include refid="Example_Where_Clause" />
		</if>
	</select>
	<update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.WRepairdtl">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Mon Aug 10 
			17:37:08 CST 2015. -->
		update W_RepairDtl
		<set>
			<if test="unitprice != null">
				UnitPrice = #{unitprice,jdbcType=DECIMAL},
			</if>
			<if test="quantity != null">
				Quantity = #{quantity,jdbcType=INTEGER},
			</if>
			<if test="fee != null">
				Fee = #{fee,jdbcType=DECIMAL},
			</if>
		</set>
		where RepairID = #{repairid,jdbcType=BIGINT}
		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.WRepairdtl">
		<!-- WARNING - @mbggenerated This element is automatically generated by 
			MyBatis Generator, do not modify. This element was generated on Mon Aug 10 
			17:37:08 CST 2015. -->
		update W_RepairDtl
		set UnitPrice = #{unitprice,jdbcType=DECIMAL},
		Quantity = #{quantity,jdbcType=INTEGER},
		Fee = #{fee,jdbcType=DECIMAL}
		where RepairID = #{repairid,jdbcType=BIGINT}
		and GoodsID =
		#{goodsid,jdbcType=VARCHAR}
		and ColorID = #{colorid,jdbcType=VARCHAR}
		and SizeID = #{sizeid,jdbcType=VARCHAR}
	</update>

	<select id="getRepairDtl" resultType="java.util.LinkedHashMap">
		select
		a.Quantity,a.UnitPrice,b.GoodsID,b.GoodName,b.ImgPath,c.Color,d.Size,b.ViewColor,b.ViewSize
		from W_RepairDtl 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
		where a.RepairID=#{
		repairid }
	</select>
</mapper>