<?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.yeshi.fanli.dao.mybatis.redpack.RedPackGiveRecordMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.redpack.RedPackGiveRecord">
|
<id column="rpgr_id" property="id" jdbcType="BIGINT"/>
|
<result column="rpgr_money" property="amount" jdbcType="DECIMAL"/>
|
<result column="rpgr_give_uid" property="giveUid" jdbcType="BIGINT"/>
|
<result column="rpgr_give_time" property="giveTime" jdbcType="TIMESTAMP"/>
|
<result column="rpgr_end_time" property="endTime" jdbcType="TIMESTAMP"/>
|
<result column="rpgr_receive_uid" property="receiveUid" jdbcType="BIGINT"/>
|
<result column="rpgr_receive_time" property="receiveTime" jdbcType="TIMESTAMP"/>
|
<result column="rpgr_state" property="state" jdbcType="INTEGER"/>
|
</resultMap>
|
|
<resultMap id="VOResultMap" type="com.yeshi.fanli.vo.redpack.RedPackGiveVO">
|
<id column="rpgr_id" property="id" jdbcType="BIGINT"/>
|
<result column="rpgr_money" property="amount" jdbcType="DECIMAL"/>
|
<result column="rpgr_give_uid" property="giveUid" jdbcType="BIGINT"/>
|
<result column="rpgr_give_time" property="giveTime" jdbcType="TIMESTAMP"/>
|
<result column="rpgr_end_time" property="endTime" jdbcType="TIMESTAMP"/>
|
<result column="rpgr_receive_uid" property="receiveUid" jdbcType="BIGINT"/>
|
<result column="rpgr_receive_time" property="receiveTime" jdbcType="TIMESTAMP"/>
|
<result column="rpgr_state" property="state" jdbcType="INTEGER"/>
|
</resultMap>
|
|
|
<sql id="Base_Column_List">rpgr_id,rpgr_money,rpgr_give_uid,rpgr_give_time,rpgr_end_time,rpgr_receive_uid,rpgr_receive_time,rpgr_state</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
<include refid="Base_Column_List"/>from yeshi_ec_red_pack_give_record where rpgr_id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_red_pack_give_record where rpgr_id = #{id,jdbcType=BIGINT}</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.redpack.RedPackGiveRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_red_pack_give_record (rpgr_id,rpgr_money,rpgr_give_uid,rpgr_give_time,rpgr_end_time,rpgr_receive_uid,rpgr_receive_time,rpgr_state) values (#{id,jdbcType=BIGINT},#{amount,jdbcType=DECIMAL},#{giveUid,jdbcType=BIGINT},#{giveTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{receiveUid,jdbcType=BIGINT},#{receiveTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER})</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.redpack.RedPackGiveRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_red_pack_give_record
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">rpgr_id,</if>
|
<if test="amount != null">rpgr_money,</if>
|
<if test="giveUid != null">rpgr_give_uid,</if>
|
<if test="giveTime != null">rpgr_give_time,</if>
|
<if test="endTime != null">rpgr_end_time,</if>
|
<if test="receiveUid != null">rpgr_receive_uid,</if>
|
<if test="receiveTime != null">rpgr_receive_time,</if>
|
<if test="state != null">rpgr_state,</if>
|
</trim>values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="amount != null">#{amount,jdbcType=DECIMAL},</if>
|
<if test="giveUid != null">#{giveUid,jdbcType=BIGINT},</if>
|
<if test="giveTime != null">#{giveTime,jdbcType=TIMESTAMP},</if>
|
<if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
|
<if test="receiveUid != null">#{receiveUid,jdbcType=BIGINT},</if>
|
<if test="receiveTime != null">#{receiveTime,jdbcType=TIMESTAMP},</if>
|
<if test="state != null">#{state,jdbcType=INTEGER},</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.redpack.RedPackGiveRecord">update yeshi_ec_red_pack_give_record set rpgr_money = #{amount,jdbcType=DECIMAL},rpgr_give_uid = #{giveUid,jdbcType=BIGINT},rpgr_give_time = #{giveTime,jdbcType=TIMESTAMP},rpgr_end_time = #{endTime,jdbcType=TIMESTAMP},rpgr_receive_uid = #{receiveUid,jdbcType=BIGINT},rpgr_receive_time = #{receiveTime,jdbcType=TIMESTAMP},rpgr_state = #{state,jdbcType=INTEGER} where rpgr_id = #{id,jdbcType=BIGINT}</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.redpack.RedPackGiveRecord">update yeshi_ec_red_pack_give_record
|
<set>
|
<if test="amount != null">rpgr_money=#{amount,jdbcType=DECIMAL},</if>
|
<if test="giveUid != null">rpgr_give_uid=#{giveUid,jdbcType=BIGINT},</if>
|
<if test="giveTime != null">rpgr_give_time=#{giveTime,jdbcType=TIMESTAMP},</if>
|
<if test="endTime != null">rpgr_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
|
<if test="receiveUid != null">rpgr_receive_uid=#{receiveUid,jdbcType=BIGINT},</if>
|
<if test="receiveTime != null">rpgr_receive_time=#{receiveTime,jdbcType=TIMESTAMP},</if>
|
<if test="state != null">rpgr_state=#{state,jdbcType=INTEGER},</if>
|
</set> where rpgr_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<select id="overdueList" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_red_pack_give_record
|
WHERE rpgr_state = 0 AND rpgr_end_time IS NOT NULL AND rpgr_end_time <![CDATA[<]]> NOW()
|
LIMIT #{count}
|
</select>
|
|
<select id="getGiveList" resultMap="VOResultMap">
|
SELECT * FROM yeshi_ec_red_pack_give_record
|
WHERE rpgr_give_uid = #{uid}
|
ORDER BY rpgr_id DESC
|
LIMIT #{start},#{count}
|
</select>
|
|
<select id="countGiveList" resultType="Long">
|
SELECT IFNULL(COUNT(rpgr_id),0) FROM yeshi_ec_red_pack_give_record
|
WHERE rpgr_give_uid = #{uid}
|
</select>
|
</mapper>
|