TOlapColumnMapper.xml 8.7 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.tianbo.mapper.TOlapColumnMapper" >
  <resultMap id="BaseResultMap" type="com.tianbo.model.TOlapColumn" >
    <id column="COLUMNID" property="columnid" jdbcType="DECIMAL" />
    <result column="COLUMNNAME" property="columnname" jdbcType="VARCHAR" />
    <result column="DATAFIELD" property="datafield" jdbcType="VARCHAR" />
    <result column="NODENAME" property="nodename" jdbcType="VARCHAR" />
    <result column="DATASETID" property="datasetid" jdbcType="DECIMAL" />
    <result column="ACTIVE" property="active" jdbcType="CHAR" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause" >
    <where >
      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    COLUMNID, COLUMNNAME, DATAFIELD, NODENAME, DATASETID, ACTIVE
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.tianbo.model.TOlapColumnExample" >
    <include refid="OracleDialectPrefix" />
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from T_OLAP_COLUMN
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
    <include refid="OracleDialectSuffix" />
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.math.BigDecimal" >
    select 
    <include refid="Base_Column_List" />
    from T_OLAP_COLUMN
    where COLUMNID = #{columnid,jdbcType=DECIMAL}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal" >
    delete from T_OLAP_COLUMN
    where COLUMNID = #{columnid,jdbcType=DECIMAL}
  </delete>
  <delete id="deleteByExample" parameterType="com.tianbo.model.TOlapColumnExample" >
    delete from T_OLAP_COLUMN
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.tianbo.model.TOlapColumn" >
    insert into T_OLAP_COLUMN (COLUMNID, COLUMNNAME, DATAFIELD, 
      NODENAME, DATASETID, ACTIVE
      )
    values (#{columnid,jdbcType=DECIMAL}, #{columnname,jdbcType=VARCHAR}, #{datafield,jdbcType=VARCHAR}, 
      #{nodename,jdbcType=VARCHAR}, #{datasetid,jdbcType=DECIMAL}, #{active,jdbcType=CHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.tianbo.model.TOlapColumn" >
    insert into T_OLAP_COLUMN
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="columnid != null" >
        COLUMNID,
      </if>
      <if test="columnname != null" >
        COLUMNNAME,
      </if>
      <if test="datafield != null" >
        DATAFIELD,
      </if>
      <if test="nodename != null" >
        NODENAME,
      </if>
      <if test="datasetid != null" >
        DATASETID,
      </if>
      <if test="active != null" >
        ACTIVE,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="columnid != null" >
        #{columnid,jdbcType=DECIMAL},
      </if>
      <if test="columnname != null" >
        #{columnname,jdbcType=VARCHAR},
      </if>
      <if test="datafield != null" >
        #{datafield,jdbcType=VARCHAR},
      </if>
      <if test="nodename != null" >
        #{nodename,jdbcType=VARCHAR},
      </if>
      <if test="datasetid != null" >
        #{datasetid,jdbcType=DECIMAL},
      </if>
      <if test="active != null" >
        #{active,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.tianbo.model.TOlapColumnExample" resultType="java.lang.Integer" >
    select count(*) from T_OLAP_COLUMN
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update T_OLAP_COLUMN
    <set >
      <if test="record.columnid != null" >
        COLUMNID = #{record.columnid,jdbcType=DECIMAL},
      </if>
      <if test="record.columnname != null" >
        COLUMNNAME = #{record.columnname,jdbcType=VARCHAR},
      </if>
      <if test="record.datafield != null" >
        DATAFIELD = #{record.datafield,jdbcType=VARCHAR},
      </if>
      <if test="record.nodename != null" >
        NODENAME = #{record.nodename,jdbcType=VARCHAR},
      </if>
      <if test="record.datasetid != null" >
        DATASETID = #{record.datasetid,jdbcType=DECIMAL},
      </if>
      <if test="record.active != null" >
        ACTIVE = #{record.active,jdbcType=CHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update T_OLAP_COLUMN
    set COLUMNID = #{record.columnid,jdbcType=DECIMAL},
      COLUMNNAME = #{record.columnname,jdbcType=VARCHAR},
      DATAFIELD = #{record.datafield,jdbcType=VARCHAR},
      NODENAME = #{record.nodename,jdbcType=VARCHAR},
      DATASETID = #{record.datasetid,jdbcType=DECIMAL},
      ACTIVE = #{record.active,jdbcType=CHAR}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.model.TOlapColumn" >
    update T_OLAP_COLUMN
    <set >
      <if test="columnname != null" >
        COLUMNNAME = #{columnname,jdbcType=VARCHAR},
      </if>
      <if test="datafield != null" >
        DATAFIELD = #{datafield,jdbcType=VARCHAR},
      </if>
      <if test="nodename != null" >
        NODENAME = #{nodename,jdbcType=VARCHAR},
      </if>
      <if test="datasetid != null" >
        DATASETID = #{datasetid,jdbcType=DECIMAL},
      </if>
      <if test="active != null" >
        ACTIVE = #{active,jdbcType=CHAR},
      </if>
    </set>
    where COLUMNID = #{columnid,jdbcType=DECIMAL}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tianbo.model.TOlapColumn" >
    update T_OLAP_COLUMN
    set COLUMNNAME = #{columnname,jdbcType=VARCHAR},
      DATAFIELD = #{datafield,jdbcType=VARCHAR},
      NODENAME = #{nodename,jdbcType=VARCHAR},
      DATASETID = #{datasetid,jdbcType=DECIMAL},
      ACTIVE = #{active,jdbcType=CHAR}
    where COLUMNID = #{columnid,jdbcType=DECIMAL}
  </update>
  <sql id="OracleDialectPrefix" >
    <if test="page != null" >
      select * from ( select row_.*, rownum rownum_ from ( 
    </if>
  </sql>
  <sql id="OracleDialectSuffix" >
    <if test="page != null" >
      <![CDATA[ ) row_ ) where rownum_ > #{page.begin} and rownum_ <= #{page.end} ]]>
    </if>
  </sql>
</mapper>