GiftMapper.xml 2.27 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.GiftMapper">
  <resultMap id="BaseResultMap" type="com.yoho.lottery.dal.model.Gift">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="prize_type" jdbcType="VARCHAR" property="prizeType" />
    <result column="prize_value" jdbcType="VARCHAR" property="prizeValue" />
    <result column="total" jdbcType="INTEGER" property="total" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="image_url" jdbcType="VARCHAR" property="imageUrl" />
    <result column="create_time" jdbcType="INTEGER" property="createTime" />
  </resultMap>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from gift
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.yoho.lottery.dal.model.Gift">
    insert into gift (id, name, prize_type, 
      prize_value, total, remark, 
      image_url, create_time)
    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{prizeType,jdbcType=VARCHAR}, 
      #{prizeValue,jdbcType=VARCHAR}, #{total,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, 
      #{imageUrl,jdbcType=VARCHAR}, #{createTime,jdbcType=INTEGER})
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yoho.lottery.dal.model.Gift">
    update gift
    set name = #{name,jdbcType=VARCHAR},
      prize_type = #{prizeType,jdbcType=VARCHAR},
      prize_value = #{prizeValue,jdbcType=VARCHAR},
      total = #{total,jdbcType=INTEGER},
      remark = #{remark,jdbcType=VARCHAR},
      image_url = #{imageUrl,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select id, name, prize_type, prize_value, total, remark, image_url, create_time
    from gift
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectAll" resultMap="BaseResultMap">
    select id, name, prize_type, prize_value, total, remark, image_url, create_time
    from gift
  </select>
</mapper>