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

	<select id="getExpressFees" parameterType="ExpressFee"
		resultType="ExpressFee">
		SELECT
		*
		FROM
		tbl_express_fee
		<where>
			<if test="province != null and province != ''">
				province like '%${province}%'
			</if>
		</where>
		order by id
	</select>
	
	<insert id="addExpressFee" parameterType="ExpressFee">
		insert into
		tbl_express_fee
		(province,pro_type_label,first_weight_price,continued_weight_price,start_price,createBy,createDate)
		values
		(#{province},#{proTypeLabel},#{firstWeight},#{continuedWeightPrice},#{startPrice},#{createBy},now())
	</insert>

	<update id="updateExpressFeeById" parameterType="ExpressFee">
		update tbl_express_fee
		<set>
			<if test="province != null">
				province = #{province,jdbcType=VARCHAR},
			</if>
			<if test="firstWeightPrice != null and firstWeightPrice != 0.0">
				first_weight_price = #{firstWeightPrice},
			</if>
			<if test="continuedWeightPrice != null and continuedWeightPrice != 0.0">
				continued_weight_price = #{continuedWeightPrice},
			</if>
			<if test="startPrice != null and startPrice != 0.0">
				start_price = #{startPrice},
			</if>
			<if test="updateBy != null">
				updateBy = #{updateBy,jdbcType=VARCHAR},
			</if>
			updateDate = now()
		</set>
		where id = #{id,jdbcType=INTEGER}
	</update>

	<delete id="deleteExpressFeeById">
		delete from tbl_express_fee where id = #{id}
	</delete>
</mapper>