ArticleBlockMapper.xml 1.68 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.IArticleBlockDao" >
  <resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.ArticleBlock" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="article_id" property="articleId" jdbcType="INTEGER" />
    <result column="template_key" property="templateKey" jdbcType="VARCHAR" />
    <result column="order_by" property="orderBy" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" type="com.yoho.unions.dal.model.ArticleBlock" extends="BaseResultMap" >
    <result column="content_data" property="contentData" jdbcType="LONGVARCHAR" />
  </resultMap>

  <sql id="Base_Column_List" >
    id, article_id, template_key, order_by, create_time
  </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 article_block
    where id = #{id,jdbcType=INTEGER}
    and status = 1
  </select>
  <select id="selectListByArticleId" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from article_block
    where article_id = #{articleId,jdbcType=INTEGER}
    and status = 1 and template_key in('text','goods','singleImage')
    order by order_by ASC, id ASC
  </select>
</mapper>