IconSettingMapper.xml 4.89 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.IIconSettingDao" >
  <resultMap id="BaseResultMap" type="com.yohobuy.platform.dal.cms.model.IconSetting" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="ico_name" property="icoName" jdbcType="VARCHAR" />
    <result column="default_ico" property="defaultIco" jdbcType="VARCHAR" />
    <result column="ico" property="ico" jdbcType="VARCHAR" />
    <result column="type" property="type" jdbcType="TINYINT" />
    <result column="ico_key" property="icoKey" jdbcType="VARCHAR" />
    <result column="status" property="status" jdbcType="TINYINT" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
    <result column="update_time" property="updateTime" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, ico_name, default_ico, ico, type, ico_key, status, create_time, update_time
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from icon_setting
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from icon_setting
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.yohobuy.platform.dal.cms.model.IconSetting" useGeneratedKeys="true" keyProperty="id" >
    insert into icon_setting (id, ico_name, default_ico, ico, type, ico_key, status, create_time)
    values (#{id,jdbcType=INTEGER}, #{icoName,jdbcType=VARCHAR}, #{defaultIco,jdbcType=VARCHAR},
      #{ico,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, #{icoKey,jdbcType=VARCHAR}, 
      #{status,jdbcType=TINYINT}, UNIX_TIMESTAMP()
      )
  </insert>
  <insert id="insertSelective" parameterType="com.yohobuy.platform.dal.cms.model.IconSetting"  useGeneratedKeys="true" keyProperty="id" >
    insert into icon_setting
    <trim prefix="(" suffix=")" suffixOverrides="," >
      id,
      <if test="icoName != null" >
        ico_name,
      </if>
      <if test="defaultIco != null" >
        default_ico,
      </if>
      <if test="ico != null" >
        ico,
      </if>
      <if test="type != null" >
        type,
      </if>
      <if test="icoKey != null" >
        ico_key,
      </if>
      <if test="status != null" >
        status,
      </if>
        create_time
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      #{id,jdbcType=INTEGER},
      <if test="icoName != null" >
        #{icoName,jdbcType=VARCHAR},
      </if>
      <if test="defaultIco != null" >
        #{defaultIco,jdbcType=VARCHAR},
      </if>
      <if test="ico != null" >
        #{ico,jdbcType=VARCHAR},
      </if>
      <if test="type != null" >
        #{type,jdbcType=TINYINT},
      </if>
      <if test="icoKey != null" >
        #{icoKey,jdbcType=VARCHAR},
      </if>
      <if test="status != null" >
        #{status,jdbcType=TINYINT},
      </if>
      UNIX_TIMESTAMP()
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yohobuy.platform.dal.cms.model.IconSetting" >
    update icon_setting
    <set >
      <if test="icoName != null" >
        ico_name = #{icoName,jdbcType=VARCHAR},
      </if>
      <if test="defaultIco != null" >
        default_ico = #{defaultIco,jdbcType=VARCHAR},
      </if>
      <if test="ico != null" >
        ico = #{ico,jdbcType=VARCHAR},
      </if>
      <if test="type != null" >
        type = #{type,jdbcType=TINYINT},
      </if>
      <if test="icoKey != null" >
        ico_key = #{icoKey,jdbcType=VARCHAR},
      </if>
      <if test="status != null" >
        status = #{status,jdbcType=TINYINT},
      </if>
        update_time = UNIX_TIMESTAMP()
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yohobuy.platform.dal.cms.model.IconSetting" >
    update icon_setting
    set ico_name = #{icoName,jdbcType=VARCHAR},
      default_ico = #{defaultIco,jdbcType=VARCHAR},
      ico = #{ico,jdbcType=VARCHAR},
      type = #{type,jdbcType=TINYINT},
      ico_key = #{icoKey,jdbcType=VARCHAR},
      status = #{status,jdbcType=TINYINT},
      update_time = UNIX_TIMESTAMP()
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectSelective" resultMap="BaseResultMap" parameterType="com.yohobuy.platform.dal.cms.model.IconSetting" >
    select
    <include refid="Base_Column_List" />
    from icon_setting
    <trim prefix="where" prefixOverrides="and | or">
      <if test="type != null" >
        and type = #{type}
      </if>
      <if test="status != null and (status == 1 || status == 0)" >
        and status = #{status}
      </if>
      <if test="icoName != null" >
        and ico_name like CONCAT('%',#{icoName},'%')
      </if>
    </trim>
  </select>
</mapper>