UserRechargeLogMapper.xml 6.9 KB
<?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.bjivt.entity.showtime.UserRechargeLog" >
  <resultMap id="BaseResultMap" type="com.bjivt.entity.showtime.UserRechargeLog" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="order_num" property="orderNum" jdbcType="VARCHAR" />
    <result column="pay_type" property="payType" jdbcType="INTEGER" />
    <result column="pay_time" property="payTime" jdbcType="VARCHAR" />
    <result column="user_id" property="userId" jdbcType="INTEGER" />
    <result column="money" property="money" jdbcType="INTEGER" />
    <result column="error_code" property="errorCode" jdbcType="VARCHAR" />
    <result column="error_msg" property="errorMsg" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="me_coin_balance" property="meCoinBalance" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, order_num, pay_type, pay_time, user_id, money, error_code, error_msg, create_time
  </sql>
  <select id="findById" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from tbl_user_recharge_log
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select
    <include refid="Base_Column_List" />
    from tbl_user_recharge_log
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteById" parameterType="java.lang.Integer" >
    delete from tbl_user_recharge_log
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="save" parameterType="com.bjivt.entity.showtime.UserRechargeLog" >
    insert into tbl_user_recharge_log (id, order_num, pay_type, 
      pay_time, user_id, money, 
      error_code, error_msg, create_time
      )
    values (#{id,jdbcType=INTEGER}, #{orderNum,jdbcType=VARCHAR}, #{payType,jdbcType=INTEGER}, 
      #{payTime,jdbcType=VARCHAR}, #{userId,jdbcType=INTEGER}, #{money,jdbcType=INTEGER}, 
      #{errorCode,jdbcType=VARCHAR}, #{errorMsg,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.bjivt.entity.showtime.UserRechargeLog" >
    insert into tbl_user_recharge_log
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="orderNum != null" >
        order_num,
      </if>
      <if test="payType != null" >
        pay_type,
      </if>
      <if test="payTime != null" >
        pay_time,
      </if>
      <if test="userId != null" >
        user_id,
      </if>
      <if test="money != null" >
        money,
      </if>
      <if test="errorCode != null" >
        error_code,
      </if>
      <if test="errorMsg != null" >
        error_msg,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="orderNum != null" >
        #{orderNum,jdbcType=VARCHAR},
      </if>
      <if test="payType != null" >
        #{payType,jdbcType=INTEGER},
      </if>
      <if test="payTime != null" >
        #{payTime,jdbcType=VARCHAR},
      </if>
      <if test="userId != null" >
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="money != null" >
        #{money,jdbcType=INTEGER},
      </if>
      <if test="errorCode != null" >
        #{errorCode,jdbcType=VARCHAR},
      </if>
      <if test="errorMsg != null" >
        #{errorMsg,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByIdSelective" parameterType="com.bjivt.entity.showtime.UserRechargeLog" >
    update tbl_user_recharge_log
    <set >
      <if test="orderNum != null" >
        order_num = #{orderNum,jdbcType=VARCHAR},
      </if>
      <if test="payType != null" >
        pay_type = #{payType,jdbcType=INTEGER},
      </if>
      <if test="payTime != null" >
        pay_time = #{payTime,jdbcType=VARCHAR},
      </if>
      <if test="userId != null" >
        user_id = #{userId,jdbcType=INTEGER},
      </if>
      <if test="money != null" >
        money = #{money,jdbcType=INTEGER},
      </if>
      <if test="errorCode != null" >
        error_code = #{errorCode,jdbcType=VARCHAR},
      </if>
      <if test="errorMsg != null" >
        error_msg = #{errorMsg,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjivt.entity.showtime.UserRechargeLog" >
    update tbl_user_recharge_log
    set order_num = #{orderNum,jdbcType=VARCHAR},
      pay_type = #{payType,jdbcType=INTEGER},
      pay_time = #{payTime,jdbcType=VARCHAR},
      user_id = #{userId,jdbcType=INTEGER},
      money = #{money,jdbcType=INTEGER},
      error_code = #{errorCode,jdbcType=VARCHAR},
      error_msg = #{errorMsg,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>


  <select id="getCountBy" resultType="java.lang.Integer" parameterType="com.bjivt.entity.showtime.UserRechargeLog">
    SELECT
    count(turl.id)
    FROM
    tbl_user_recharge_log turl INNER  JOIN  tbl_user_list tul ON turl.user_id=tul.id  WHERE 1=1
    <if test="userId != null and userId !=0 ">
      and turl.user_id = #{userId}
    </if>
    <if test="startTime != null and startTime !=''  and endTime != null and endTime !=''">
      and date_format(turl.create_time,'%Y-%m-%d')  between str_to_date(#{startTime},'%Y-%m-%d') and str_to_date(#{endTime},'%Y-%m-%d')
    </if>
  </select>

  <select id="findListByMap" resultMap="BaseResultMap" parameterType="java.util.Map">
    SELECT
    turl.id, turl.order_num, turl.pay_type, turl.pay_time, turl.user_id, turl.money, turl.error_code, turl.error_msg, turl.create_time,tul.me_coin_balance
    FROM
    tbl_user_recharge_log turl INNER  JOIN  tbl_user_list tul ON turl.user_id=tul.id  WHERE 1=1
    <if test="UserRechargeLog.userId != null and UserRechargeLog.userId !=0 ">
      and turl.user_id = #{UserRechargeLog.userId}
    </if>
    <if test="UserRechargeLog.startTime != null and UserRechargeLog.startTime !=''  and UserRechargeLog.endTime != null and UserRechargeLog.endTime !=''">
      and date_format(turl.create_time,'%Y-%m-%d')  between str_to_date(#{UserRechargeLog.startTime},'%Y-%m-%d') and str_to_date(#{UserRechargeLog.endTime},'%Y-%m-%d')
    </if>
    order by create_time
    <if test="page != null and page !=''">
      <if test="page.from != null and page.size != null">
        limit #{page.from},#{page.size}
      </if>
    </if>
  </select>
</mapper>