EntranceManagementMapper.xml 7.04 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.yohobuy.platform.dal.cms.IEntranceManagementDao" >
  <resultMap id="BaseResultMap" type="com.yohobuy.platform.dal.cms.model.EntranceManagement" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="entry_name" property="entryName" jdbcType="VARCHAR" />
    <result column="click_before_img" property="clickBeforeImg" jdbcType="VARCHAR" />
    <result column="click_after_img" property="clickAfterImg" jdbcType="VARCHAR" />
    <result column="url" property="url" jdbcType="VARCHAR" />
    <result column="platform" property="platform" jdbcType="CHAR" />
    <result column="order_by" property="orderBy" jdbcType="INTEGER" />
    <result column="status" property="status" jdbcType="TINYINT" />
    <result column="zip_url" property="zipUrl" jdbcType="VARCHAR" />
    <result column="channel_id" property="channelId" jdbcType="SMALLINT" />
    <result column="gender" property="gender" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, entry_name, click_before_img, click_after_img, url, platform, order_by, status, 
    zip_url, channel_id, gender, create_time
  </sql>

  <sql id="page_condition">
    <trim prefix="where" prefixOverrides="and | or">
      <if test="status != null" >
        and status = ${status}
      </if>
      <if test="platform != null" >
        and platform = ${platform}
      </if>
    </trim>
  </sql>

  <select id="selectEntranceList" resultMap="BaseResultMap" parameterType="java.util.HashMap" >
    select 
    <include refid="Base_Column_List" />
    from entrance_management
    <include refid="page_condition"/>
    order by create_time desc
    limit ${start}, ${size}
  </select>

  <select id="selectCountEntranceList" resultType="java.lang.Integer">
    select
    count(*)
    from entrance_management
    <include refid="page_condition"/>
  </select>

  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select
    <include refid="Base_Column_List" />
    from entrance_management
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from entrance_management
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.yohobuy.platform.dal.cms.model.EntranceManagement" >
    insert into entrance_management (id, entry_name, click_before_img,
    click_after_img, url, platform,
    order_by, status, zip_url,
    channel_id, gender, create_time
    )
    values (#{id,jdbcType=INTEGER}, #{entryName,jdbcType=VARCHAR}, #{clickBeforeImg,jdbcType=VARCHAR},
    #{clickAfterImg,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{platform,jdbcType=CHAR},
    #{orderBy,jdbcType=INTEGER}, #{status,jdbcType=TINYINT}, #{zipUrl,jdbcType=VARCHAR},
    #{channelId,jdbcType=SMALLINT}, #{gender,jdbcType=VARCHAR}, UNIX_TIMESTAMP()
    )
  </insert>
  <insert id="insertSelective" parameterType="com.yohobuy.platform.dal.cms.model.EntranceManagement" >
    insert into entrance_management
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="entryName != null" >
        entry_name,
      </if>
      <if test="clickBeforeImg != null" >
        click_before_img,
      </if>
      <if test="clickAfterImg != null" >
        click_after_img,
      </if>
      <if test="url != null" >
        url,
      </if>
      <if test="platform != null" >
        platform,
      </if>
      <if test="orderBy != null" >
        order_by,
      </if>
      <if test="status != null" >
        status,
      </if>
      <if test="zipUrl != null" >
        zip_url,
      </if>
      <if test="channelId != null" >
        channel_id,
      </if>
      <if test="gender != null" >
        gender,
      </if>
        create_time,
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="entryName != null" >
        #{entryName,jdbcType=VARCHAR},
      </if>
      <if test="clickBeforeImg != null" >
        #{clickBeforeImg,jdbcType=VARCHAR},
      </if>
      <if test="clickAfterImg != null" >
        #{clickAfterImg,jdbcType=VARCHAR},
      </if>
      <if test="url != null" >
        #{url,jdbcType=VARCHAR},
      </if>
      <if test="platform != null" >
        #{platform,jdbcType=CHAR},
      </if>
      <if test="orderBy != null" >
        #{orderBy,jdbcType=INTEGER},
      </if>
      <if test="status != null" >
        #{status,jdbcType=TINYINT},
      </if>
      <if test="zipUrl != null" >
        #{zipUrl,jdbcType=VARCHAR},
      </if>
      <if test="channelId != null" >
        #{channelId,jdbcType=SMALLINT},
      </if>
      <if test="gender != null" >
        #{gender,jdbcType=VARCHAR},
      </if>
      UNIX_TIMESTAMP()
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yohobuy.platform.dal.cms.model.EntranceManagement" >
    update entrance_management
    <set >
      <if test="entryName != null" >
        entry_name = #{entryName,jdbcType=VARCHAR},
      </if>
      <if test="clickBeforeImg != null" >
        click_before_img = #{clickBeforeImg,jdbcType=VARCHAR},
      </if>
      <if test="clickAfterImg != null" >
        click_after_img = #{clickAfterImg,jdbcType=VARCHAR},
      </if>
      <if test="url != null" >
        url = #{url,jdbcType=VARCHAR},
      </if>
      <if test="platform != null" >
        platform = #{platform,jdbcType=CHAR},
      </if>
      <if test="orderBy != null" >
        order_by = #{orderBy,jdbcType=INTEGER},
      </if>
      <if test="status != null" >
        status = #{status,jdbcType=TINYINT},
      </if>
      <if test="zipUrl != null" >
        zip_url = #{zipUrl,jdbcType=VARCHAR},
      </if>
      <if test="channelId != null" >
        channel_id = #{channelId,jdbcType=SMALLINT},
      </if>
      <if test="gender != null" >
        gender = #{gender,jdbcType=VARCHAR},
      </if>

    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yohobuy.platform.dal.cms.model.EntranceManagement" >
    update entrance_management
    set entry_name = #{entryName,jdbcType=VARCHAR},
    click_before_img = #{clickBeforeImg,jdbcType=VARCHAR},
    click_after_img = #{clickAfterImg,jdbcType=VARCHAR},
    url = #{url,jdbcType=VARCHAR},
    platform = #{platform,jdbcType=CHAR},
    order_by = #{orderBy,jdbcType=INTEGER},
    status = #{status,jdbcType=TINYINT},
    zip_url = #{zipUrl,jdbcType=VARCHAR},
    channel_id = #{channelId,jdbcType=SMALLINT},
    gender = #{gender,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>

  <update id="updateStatusById" parameterType="com.yohobuy.platform.dal.cms.model.EntranceManagement" >
    update entrance_management set status = #{status,jdbcType=TINYINT}
    where id = #{id,jdbcType=INTEGER}

  </update>
</mapper>