GiftListMapper.xml 5.93 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.GiftList">
  <resultMap id="BaseResultMap" type="com.bjivt.entity.showtime.GiftList">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="exp" jdbcType="INTEGER" property="exp" />
    <result column="support_degree" jdbcType="INTEGER" property="supportDegree" />
    <result column="price" jdbcType="INTEGER" property="price" />
    <result column="gif" jdbcType="VARCHAR" property="gif" />
    <result column="type" jdbcType="INTEGER" property="type" />
    <result column="icon" jdbcType="VARCHAR" property="icon" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="active" jdbcType="CHAR" property="active" />
  </resultMap>
  <sql id="Base_Column_List">
    id, name, exp, support_degree, price, gif, type, icon, create_time, active
  </sql>
  <select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from tbl_gift_list
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteById" parameterType="java.lang.Integer">
    delete from tbl_gift_list
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.bjivt.entity.showtime.GiftList">
    insert into tbl_gift_list (id, name, exp, 
      support_degree, price, gif, 
      type, icon, create_time, 
      active)
    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{exp,jdbcType=INTEGER}, 
      #{supportDegree,jdbcType=INTEGER}, #{price,jdbcType=INTEGER}, #{gif,jdbcType=VARCHAR}, 
      #{type,jdbcType=INTEGER}, #{icon,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
      #{active,jdbcType=CHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.bjivt.entity.showtime.GiftList">
    insert into tbl_gift_list
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="exp != null">
        exp,
      </if>
      <if test="supportDegree != null">
        support_degree,
      </if>
      <if test="price != null">
        price,
      </if>
      <if test="gif != null">
        gif,
      </if>
      <if test="type != null">
        type,
      </if>
      <if test="icon != null">
        icon,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="active != null">
        active,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="exp != null">
        #{exp,jdbcType=INTEGER},
      </if>
      <if test="supportDegree != null">
        #{supportDegree,jdbcType=INTEGER},
      </if>
      <if test="price != null">
        #{price,jdbcType=INTEGER},
      </if>
      <if test="gif != null">
        #{gif,jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        #{type,jdbcType=INTEGER},
      </if>
      <if test="icon != null">
        #{icon,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="active != null">
        #{active,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByIdSelective" parameterType="com.bjivt.entity.showtime.GiftList">
    update tbl_gift_list
    <set>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="exp != null">
        exp = #{exp,jdbcType=INTEGER},
      </if>
      <if test="supportDegree != null">
        support_degree = #{supportDegree,jdbcType=INTEGER},
      </if>
      <if test="price != null">
        price = #{price,jdbcType=INTEGER},
      </if>
      <if test="gif != null">
        gif = #{gif,jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        type = #{type,jdbcType=INTEGER},
      </if>
      <if test="icon != null">
        icon = #{icon,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="active != null">
        active = #{active,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateById" parameterType="com.bjivt.entity.showtime.GiftList">
    update tbl_gift_list
    set name = #{name,jdbcType=VARCHAR},
      exp = #{exp,jdbcType=INTEGER},
      support_degree = #{supportDegree,jdbcType=INTEGER},
      price = #{price,jdbcType=INTEGER},
      gif = #{gif,jdbcType=VARCHAR},
      type = #{type,jdbcType=INTEGER},
      icon = #{icon,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      active = #{active,jdbcType=CHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  
   <select id="getCountBy" resultType="java.lang.Integer" parameterType="com.bjivt.entity.showtime.GiftList">
    SELECT
				count(1)
			FROM
				tbl_gift_list
    <trim prefix="where" prefixOverrides="and|or">
      <if test="name != null and name != ''" >
		        	 and   tbl_gift_list.name = #{liveId}
		    	  </if>
      </trim>
  </select>
  
     <select id="findListByMap" resultMap="BaseResultMap" parameterType="java.util.Map">
     	SELECT
				<include refid="Base_Column_List"/>
			FROM
				tbl_gift_list
  	  	<trim prefix="where" prefixOverrides="and|or">
		  	  	 <if test="GiftList.name!= null and GiftList.name!= ''" >
		        	 and   tbl_gift_list.name = #{GiftList.name}
		    	  </if>
  	  	</trim>
  	  	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>