ResourcesContentDataMapper.xml 4.41 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.ufo.dal.ResourcesContentDataMapper">
    <resultMap id="BaseResultMap" type="com.yoho.ufo.model.resource.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" />
        <result column="content_data" property="contentData" jdbcType="VARCHAR" />
        <result column="type" property="type" jdbcType="TINYINT" />
    </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,content_data,type
    </sql>
    <insert id="insertOrUpdate">
      INSERT INTO resources_content_data (id,
        platform_id,
        sort_id,
        resource_content_id,
        template_key,
        content_data,
        create_time,
        publish_time,
        pre_content_id,
        status,
        type
      ) VALUES (
      #{param.id},
      #{param.platformId},
      #{param.sortId},
      #{param.resourceContentId},
      #{param.templateKey},
      #{param.contentData},
      #{param.createTime},
      #{param.publishTime},
      #{param.preContentId},
      #{param.status},
      #{param.type}) ON DUPLICATE KEY UPDATE
        <if test="null != param.contentData">
            content_data=#{param.contentData},
        </if>
        <if test="null != param.platformId">
            platform_id=#{param.platformId},
        </if>
        <if test="null != param.sortId">
            sort_id=#{param.sortId},
        </if>
        <if test="null != param.resourceContentId">
            resource_content_id=#{param.resourceContentId},
        </if>
        <if test="null != param.templateKey">
            template_key=#{param.templateKey},
        </if>
        <if test="null != param.publishTime">
            publish_time=#{param.publishTime},
        </if>
        <if test="null != param.preContentId">
            pre_content_id=#{param.preContentId},
        </if>
        <if test="null != param.status">
            status=#{param.status},
        </if>
        <if test="null != param.type">
            type=#{param.type},
        </if>
        update_time=#{param.updateTime}
    </insert>
    <update id="updateByResContentBo">
        update resources_content_data set
        <if test="null != param.contentData">
            content_data=#{param.contentData},
        </if>
        <if test="null != param.platformId">
            platform_id=#{param.platformId},
        </if>
        <if test="null != param.sortId">
            sort_id=#{param.sortId},
        </if>
        <if test="null != param.resourceContentId">
            resource_content_id=#{param.resourceContentId},
        </if>
        <if test="null != param.templateKey">
            template_key=#{param.templateKey},
        </if>
        <if test="null != param.publishTime">
            publish_time=#{param.publishTime},
        </if>
        <if test="null != param.preContentId">
            pre_content_id=#{param.preContentId},
        </if>
        <if test="null != param.status">
            status=#{param.status},
        </if>
        <if test="null != param.type">
            type=#{param.type},
        </if>
        update_time=#{param.updateTime}
        where id=#{param.id}
    </update>
    <select id="selectByContentIds" resultType="com.yoho.ufo.model.resource.ResourcesContentData">
        select <include refid="Base_Column_List" /> from resources_content_data
        where resource_content_id in
        <foreach collection="list" open="(" close=")" item="id" separator=",">
            #{id}
        </foreach>
    </select>
</mapper>