ResourcesContentDataMapper.xml 7.36 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.yohoufo.dal.resource.ResourcesContentDataMapper" >
  <resultMap id="BaseResultMap" type="com.yohoufo.dal.resource.model.ResourcesContentData" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="platform_id" property="platformId" jdbcType="INTEGER" />
    <result column="sort_id" property="sortId" jdbcType="INTEGER" />
    <result column="resource_content_id" property="resourceContentId" jdbcType="INTEGER" />
    <result column="template_key" property="templateKey" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
    <result column="publish_time" property="publishTime" jdbcType="INTEGER" />
    <result column="update_time" property="updateTime" jdbcType="INTEGER" />
    <result column="pre_content_id" property="preContentId" jdbcType="INTEGER" />
    <result column="status" property="status" jdbcType="TINYINT" />
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" type="com.yohoufo.dal.resource.model.ResourcesContentData" extends="BaseResultMap" >
    <result column="content_data" property="contentData" jdbcType="LONGVARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, platform_id, sort_id, resource_content_id, template_key, create_time, publish_time, 
    update_time, pre_content_id,status
  </sql>
  <sql id="Blob_Column_List" >
    content_data
  </sql>
  <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
    select
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from resources_content_data
    where id = #{id,jdbcType=INTEGER} and status=1
  </select>
  <select id="selectByResourceContentId" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
    select
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from resources_content_data
    where resource_content_id = #{resourceContentId,jdbcType=INTEGER} and status=1
  </select>

  <select id="selectByResourceContentIds"  resultMap="ResultMapWithBLOBs" >
    select
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from resources_content_data
    where resource_content_id in
    <foreach item="resourceContentId" collection="resourceContentIds" index="index" separator="," open="(" close=")">
      #{resourceContentId}
    </foreach>
    and status=1
  </select>


  <select id="selectByResourcesId" resultMap="BaseResultMap" >
    select
    <include refid="Base_Column_List" />
    from resources_content
    where resources_id = #{resourcesId,jdbcType=INTEGER} and status=1
    limit  #{start,jdbcType=INTEGER},#{limit,jdbcType=INTEGER}
  </select>



  <insert id="insert" parameterType="com.yohoufo.dal.resource.model.ResourcesContentData" >
    insert into resources_content_data (id, platform_id, sort_id, 
      resource_content_id, template_key, create_time, 
      publish_time, update_time, content_data,status
      )
    values (#{id,jdbcType=INTEGER}, #{platformId,jdbcType=INTEGER}, #{sortId,jdbcType=INTEGER}, 
      #{resourceContentId,jdbcType=INTEGER}, #{templateKey,jdbcType=VARCHAR}, #{createTime,jdbcType=INTEGER}, 
      #{publishTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER}, #{contentData,jdbcType=LONGVARCHAR},1
      )
  </insert>
  <insert id="insertSelective" parameterType="com.yohoufo.dal.resource.model.ResourcesContentData" >
    insert into resources_content_data
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="platformId != null" >
        platform_id,
      </if>
      <if test="sortId != null" >
        sort_id,
      </if>
      <if test="resourceContentId != null" >
        resource_content_id,
      </if>
      <if test="templateKey != null" >
        template_key,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="publishTime != null" >
        publish_time,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
      <if test="contentData != null" >
        content_data,
      </if>
      status,
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="platformId != null" >
        #{platformId,jdbcType=INTEGER},
      </if>
      <if test="sortId != null" >
        #{sortId,jdbcType=INTEGER},
      </if>
      <if test="resourceContentId != null" >
        #{resourceContentId,jdbcType=INTEGER},
      </if>
      <if test="templateKey != null" >
        #{templateKey,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=INTEGER},
      </if>
      <if test="publishTime != null" >
        #{publishTime,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=INTEGER},
      </if>
      <if test="contentData != null" >
        #{contentData,jdbcType=LONGVARCHAR},
      </if>
      1
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.resource.model.ResourcesContentData" >
    update resources_content_data
    <set >
      <if test="platformId != null" >
        platform_id = #{platformId,jdbcType=INTEGER},
      </if>
      <if test="sortId != null" >
        sort_id = #{sortId,jdbcType=INTEGER},
      </if>
      <if test="resourceContentId != null" >
        resource_content_id = #{resourceContentId,jdbcType=INTEGER},
      </if>
      <if test="templateKey != null" >
        template_key = #{templateKey,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=INTEGER},
      </if>
      <if test="publishTime != null" >
        publish_time = #{publishTime,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null" >
        update_time = #{updateTime,jdbcType=INTEGER},
      </if>
      <if test="contentData != null" >
        content_data = #{contentData,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.yohoufo.dal.resource.model.ResourcesContentData" >
    update resources_content_data
    set platform_id = #{platformId,jdbcType=INTEGER},
      sort_id = #{sortId,jdbcType=INTEGER},
      resource_content_id = #{resourceContentId,jdbcType=INTEGER},
      template_key = #{templateKey,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=INTEGER},
      publish_time = #{publishTime,jdbcType=INTEGER},
      update_time = #{updateTime,jdbcType=INTEGER},
      content_data = #{contentData,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.resource.model.ResourcesContentData" >
    update resources_content_data
    set platform_id = #{platformId,jdbcType=INTEGER},
      sort_id = #{sortId,jdbcType=INTEGER},
      resource_content_id = #{resourceContentId,jdbcType=INTEGER},
      template_key = #{templateKey,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=INTEGER},
      publish_time = #{publishTime,jdbcType=INTEGER},
      update_time = #{updateTime,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>

</mapper>