<?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.ym.mec.biz.dal.dao.GoodsOrderPaymentDao">

	<resultMap type="com.ym.mec.biz.dal.entity.GoodsOrderPayment"
		id="GoodsOrderPayment">
		<result column="id_" property="id" />
		<result column="user_id_" property="userId" />
		<result column="goods_order_id_" property="goodsOrderId" />
		<result column="payment_channel_" property="paymentChannel" />
		<result column="payment_business_channel_" property="paymentBusinessChannel" />
		<result column="payment_account_no_" property="paymentAccountNo" />
		<result column="amount_" property="amount" />
		<result column="trans_no_" property="transNo" />
		<result column="order_no_" property="orderNo" />
		<result column="pay_status_" property="payStatus" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
		<result column="arrival_time_" property="arrivalTime" />
		<result column="remark_" property="remark" />
		<result column="create_time_" property="createTime" />
		<result column="update_time_" property="updateTime" />
	</resultMap>

	<!-- 根据主键查询一条记录 -->
	<select id="get" resultMap="GoodsOrderPayment">
		SELECT * FROM
		goods_order_payment WHERE id_ = #{id}
	</select>

	<!-- 全查询 -->
	<select id="findAll" resultMap="GoodsOrderPayment">
		SELECT * FROM goods_order_payment
		ORDER BY id_
	</select>

	<!-- 向数据库增加一条记录 -->
	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.GoodsOrderPayment"
		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
		INSERT INTO goods_order_payment
		(id_,user_id_,goods_order_id_,payment_channel_,payment_business_channel_,payment_account_no_,amount_,trans_no_,order_no_,pay_status_,arrival_time_,remark_,create_time_,update_time_)
		VALUES(#{id},#{userId},#{goodsOrderId},#{paymentChannel},#{paymentBusinessChannel},#{paymentAccountNo},#{amount},#{transNo},#{orderNo},#{payStatus, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{arrivalTime},#{remark},now(),now())
	</insert>

	<!-- 根据主键查询一条记录 -->
	<update id="update" parameterType="com.ym.mec.biz.dal.entity.GoodsOrderPayment">
		UPDATE goods_order_payment
		<set>
			<if test="payStatus != null">
				pay_status_ = #{payStatus, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
			</if>
			<if test="orderNo != null">
				order_no_ = #{orderNo},
			</if>
			<if test="id != null">
				id_ = #{id},
			</if>
			<if test="amount != null">
				amount_ = #{amount},
			</if>
			<if test="arrivalTime != null">
				arrival_time_ = #{arrivalTime},
			</if>
			<if test="paymentChannel != null">
				payment_channel_ = #{paymentChannel},
			</if>
			<if test="createTime != null">
				create_time_ = #{createTime},
			</if>
			<if test="userId != null">
				user_id_ = #{userId},
			</if>
			<if test="remark != null">
				remark_ = #{remark},
			</if>
			<if test="paymentAccountNo != null">
				payment_account_no_ = #{paymentAccountNo},
			</if>
			<if test="paymentBusinessChannel != null">
				payment_business_channel_ = #{paymentBusinessChannel},
			</if>
			<if test="updateTime != null">
				update_time_ = #{updateTime},
			</if>
			<if test="goodsOrderId != null">
				goods_order_id_ = #{goodsOrderId},
			</if>
			<if test="transNo != null">
				trans_no_ = #{transNo},
			</if>
		</set>
		WHERE id_ = #{id}
	</update>

	<!-- 根据主键删除一条记录 -->
	<delete id="delete">
		DELETE FROM goods_order_payment WHERE id_ =
		#{id}
	</delete>

	<!-- 分页查询 -->
	<select id="queryPage" resultMap="GoodsOrderPayment"
		parameterType="map">
		SELECT * FROM goods_order_payment ORDER BY id_
		<include refid="global.limit" />
	</select>

	<!-- 查询当前表的总记录数 -->
	<select id="queryCount" resultType="int">
		SELECT COUNT(*) FROM
		goods_order_payment
	</select>
</mapper>
