AppActiveMapper.xml 3.81 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.unions.dal.IAppActiveDAO" >
  <resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.AppActive" >
    <id column="ID" property="id" jdbcType="INTEGER" />
    <result column="DATE_ID" property="dateId" jdbcType="INTEGER" />
    <result column="APP_ACTIVE" property="appActive" jdbcType="INTEGER" />
    <result column="app_key" property="appKey" jdbcType="VARCHAR" />
    <result column="NEW_UDID" property="newUdid" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    ID, DATE_ID, APP_ACTIVE, app_key, NEW_UDID
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from APP_ACTIVE
    where ID = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from APP_ACTIVE
    where ID = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.yoho.unions.dal.model.AppActive" >
    insert into APP_ACTIVE (ID, DATE_ID, APP_ACTIVE, 
      app_key, NEW_UDID)
    values (#{id,jdbcType=INTEGER}, #{dateId,jdbcType=INTEGER}, #{appActive,jdbcType=INTEGER}, 
      #{appKey,jdbcType=VARCHAR}, #{newUdid,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.yoho.unions.dal.model.AppActive" >
    insert into APP_ACTIVE
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        ID,
      </if>
      <if test="dateId != null" >
        DATE_ID,
      </if>
      <if test="appActive != null" >
        APP_ACTIVE,
      </if>
      <if test="appKey != null" >
        app_key,
      </if>
      <if test="newUdid != null" >
        NEW_UDID,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="dateId != null" >
        #{dateId,jdbcType=INTEGER},
      </if>
      <if test="appActive != null" >
        #{appActive,jdbcType=INTEGER},
      </if>
      <if test="appKey != null" >
        #{appKey,jdbcType=VARCHAR},
      </if>
      <if test="newUdid != null" >
        #{newUdid,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.AppActive" >
    update APP_ACTIVE
    <set >
      <if test="dateId != null" >
        DATE_ID = #{dateId,jdbcType=INTEGER},
      </if>
      <if test="appActive != null" >
        APP_ACTIVE = #{appActive,jdbcType=INTEGER},
      </if>
      <if test="appKey != null" >
        app_key = #{appKey,jdbcType=VARCHAR},
      </if>
      <if test="newUdid != null" >
        NEW_UDID = #{newUdid,jdbcType=INTEGER},
      </if>
    </set>
    where ID = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.AppActive" >
    update APP_ACTIVE
    set DATE_ID = #{dateId,jdbcType=INTEGER},
      APP_ACTIVE = #{appActive,jdbcType=INTEGER},
      app_key = #{appKey,jdbcType=VARCHAR},
      NEW_UDID = #{newUdid,jdbcType=INTEGER}
    where ID = #{id,jdbcType=INTEGER}
  </update>

  <select id="selectActivationAndActualCostByDateId" parameterType="java.util.Map" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from APP_ACTIVE
    <include refid="WHERE_CONDITION"/>
  </select>

  <sql id="WHERE_CONDITION">
    <trim prefix="where" prefixOverrides="and | or">
      <if test="params.beginTime != null and params.beginTime != ''"><![CDATA[ and DATE_ID>=#{params.beginTime}]]></if>
      <if test="params.endTime != null and params.endTime != ''"><![CDATA[ and DATE_ID<=#{params.endTime}]]></if>
    </trim>
  </sql>
</mapper>