LogMapper.xml 8.58 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.viontech.fanxing.ops.mapper.LogMapper" >
  <resultMap id="BaseResultMapRoot" type="com.viontech.fanxing.commons.model.Log" >
    <id column="log_id" property="id" />
    <result column="log_date_time" property="dateTime" />
    <result column="log_username" property="username" />
    <result column="log_log_type" property="logType" />
    <result column="log_content" property="content" />
  </resultMap>
  <resultMap id="BaseResultMap" type="com.viontech.fanxing.commons.model.Log" extends="BaseResultMapRoot" />
  <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_Root" >
    `log`.id as log_id, `log`.date_time as log_date_time, `log`.username as log_username, 
    `log`.log_type as log_log_type, `log`.content as log_content
  </sql>
  <sql id="Base_Column_List" >
    <if test="!(_parameter.getClass().getSimpleName() == 'LogExample')" >
      <include refid="com.viontech.fanxing.ops.mapper.LogMapper.Base_Column_List_Root" />
    </if>
    <if test="_parameter.getClass().getSimpleName() == 'LogExample'" >
      <foreach collection="columnContainerSet" item="columns" separator="," >
        <choose >
          <when test="columns.tableName == 's_log'.toString()" >
            <if test="columns.valid" >
              ${columns.columnContainerStr}
            </if>
            <if test="!columns.valid" >
              <include refid="com.viontech.fanxing.ops.mapper.LogMapper.Base_Column_List_Root" />
            </if>
          </when>
        </choose>
      </foreach>
    </if>
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.viontech.fanxing.commons.model.LogExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from `s_log` `log`
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="groupByClause != null" >
      group by ${groupByClause}
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select 
    <include refid="Base_Column_List" />
    from `s_log` `log`
    where `log`.id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete  from `s_log` `log`
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.viontech.fanxing.commons.model.LogExample" >
    delete  from `s_log` `log`
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.viontech.fanxing.commons.model.Log" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
    insert into `s_log` (date_time, username, log_type, 
      content)
    values (#{dateTime,jdbcType=TIMESTAMP}, #{username,jdbcType=VARCHAR}, #{logType,jdbcType=INTEGER}, 
      #{content,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.Log" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
    insert into `s_log`
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="dateTime != null" >
        date_time,
      </if>
      <if test="username != null" >
        username,
      </if>
      <if test="logType != null" >
        log_type,
      </if>
      <if test="content != null" >
        content,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="dateTime != null" >
        #{dateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="username != null" >
        #{username,jdbcType=VARCHAR},
      </if>
      <if test="logType != null" >
        #{logType,jdbcType=INTEGER},
      </if>
      <if test="content != null" >
        #{content,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.viontech.fanxing.commons.model.LogExample" resultType="java.lang.Integer" >
    select count(*) from `s_log` `log`
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update `s_log` `log`
    <set >
      <if test="record.id != null" >
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.dateTime != null" >
        date_time = #{record.dateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.username != null" >
        username = #{record.username,jdbcType=VARCHAR},
      </if>
      <if test="record.logType != null" >
        log_type = #{record.logType,jdbcType=INTEGER},
      </if>
      <if test="record.content != null" >
        content = #{record.content,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update `s_log` `log`
    set id = #{record.id,jdbcType=BIGINT},
      date_time = #{record.dateTime,jdbcType=TIMESTAMP},
      username = #{record.username,jdbcType=VARCHAR},
      log_type = #{record.logType,jdbcType=INTEGER},
      content = #{record.content,jdbcType=VARCHAR}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.viontech.fanxing.commons.model.Log" >
    update `s_log`
    <set >
      <if test="dateTime != null" >
        date_time = #{dateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="username != null" >
        username = #{username,jdbcType=VARCHAR},
      </if>
      <if test="logType != null" >
        log_type = #{logType,jdbcType=INTEGER},
      </if>
      <if test="content != null" >
        content = #{content,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.viontech.fanxing.commons.model.Log" >
    update `s_log`
    set date_time = #{dateTime,jdbcType=TIMESTAMP},
      username = #{username,jdbcType=VARCHAR},
      log_type = #{logType,jdbcType=INTEGER},
      content = #{content,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>