LotteryPrizeMapper.xml 2.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.yoho.lottery.dal.LotteryPrizeMapper">
  <resultMap id="BaseResultMap" type="com.yoho.lottery.dal.model.LotteryPrize">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="lottery_id" jdbcType="INTEGER" property="lotteryId" />
    <result column="user_id" jdbcType="INTEGER" property="userId" />
    <result column="user_name" jdbcType="VARCHAR" property="userName" />
    <result column="prize_id" jdbcType="INTEGER" property="prizeId" />
    <result column="prize_name" jdbcType="VARCHAR" property="prizeName" />
    <result column="prize_remark" jdbcType="VARCHAR" property="prizeRemark" />
    <result column="order_code" jdbcType="VARCHAR" property="orderCode" />
    <result column="create_time" jdbcType="INTEGER" property="createTime" />
  </resultMap>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from lottery_prize
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.yoho.lottery.dal.model.LotteryPrize">
    insert into lottery_prize (id, lottery_id, user_id, 
      user_name, prize_id, prize_name, 
      prize_remark, order_code, create_time
      )
    values (#{id,jdbcType=INTEGER}, #{lotteryId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, 
      #{userName,jdbcType=VARCHAR}, #{prizeId,jdbcType=INTEGER}, #{prizeName,jdbcType=VARCHAR}, 
      #{prizeRemark,jdbcType=VARCHAR}, #{orderCode,jdbcType=VARCHAR}, #{createTime,jdbcType=INTEGER}
      )
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yoho.lottery.dal.model.LotteryPrize">
    update lottery_prize
    set lottery_id = #{lotteryId,jdbcType=INTEGER},
      user_id = #{userId,jdbcType=INTEGER},
      user_name = #{userName,jdbcType=VARCHAR},
      prize_id = #{prizeId,jdbcType=INTEGER},
      prize_name = #{prizeName,jdbcType=VARCHAR},
      prize_remark = #{prizeRemark,jdbcType=VARCHAR},
      order_code = #{orderCode,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select id, lottery_id, user_id, user_name, prize_id, prize_name, prize_remark, order_code, 
    create_time
    from lottery_prize
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectAll" resultMap="BaseResultMap">
    select id, lottery_id, user_id, user_name, prize_id, prize_name, prize_remark, order_code, 
    create_time
    from lottery_prize
  </select>
  <select id="selectPrize" resultMap="BaseResultMap">
    select user_name, prize_id, prize_name,prize_remark
    from lottery_prize where lottery_id=#{lotteryId,jdbcType=INTEGER} order by id desc limit #{startIndex,jdbcType=INTEGER}, #{length,jdbcType=INTEGER}
  </select>
  
</mapper>