123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- <?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.sooka.mybatis.mapper.TCmsContentMapper">
- <resultMap id="BaseResultMap" type="com.sooka.mybatis.model.TCmsContent">
- <!--
- WARNING - @mbg.generated
- -->
- <id column="content_id" jdbcType="BIGINT" property="contentId" />
- <result column="site_id" jdbcType="INTEGER" property="siteId" />
- <result column="user_id" jdbcType="INTEGER" property="userId" />
- <result column="category_id" jdbcType="BIGINT" property="categoryId" />
- <result column="model_id" jdbcType="INTEGER" property="modelId" />
- <result column="title" jdbcType="VARCHAR" property="title" />
- <result column="keywords" jdbcType="CHAR" property="keywords" />
- <result column="top" jdbcType="BIT" property="top" />
- <result column="recommend" jdbcType="BIT" property="recommend" />
- <result column="thumb" jdbcType="VARCHAR" property="thumb" />
- <result column="status" jdbcType="INTEGER" property="status" />
- <result column="inputdate" jdbcType="TIMESTAMP" property="inputdate" />
- <result column="updatedate" jdbcType="TIMESTAMP" property="updatedate" />
- <result column="url" jdbcType="CHAR" property="url" />
- <result column="author" jdbcType="CHAR" property="author" />
- <result column="view_num" jdbcType="INTEGER" property="viewNum" />
- <result column="description" jdbcType="LONGVARCHAR" property="description" />
- <result column="sorts" jdbcType="INTEGER" property="sorts" />
- </resultMap>
- <resultMap id="BaseResultMaps" type="com.sooka.module.web.cms.vo.CxcVo">
- <id column="content_id" jdbcType="BIGINT" property="contentId" />
- <result column="site_id" jdbcType="INTEGER" property="siteId" />
- <result column="user_id" jdbcType="INTEGER" property="userId" />
- <result column="category_id" jdbcType="BIGINT" property="categoryId" />
- <result column="model_id" jdbcType="INTEGER" property="modelId" />
- <result column="title" jdbcType="VARCHAR" property="title" />
- <result column="keywords" jdbcType="CHAR" property="keywords" />
- <result column="top" jdbcType="BIT" property="top" />
- <result column="recommend" jdbcType="BIT" property="recommend" />
- <result column="thumb" jdbcType="VARCHAR" property="thumb" />
- <result column="status" jdbcType="INTEGER" property="status" />
- <result column="inputdate" jdbcType="TIMESTAMP" property="inputdate" />
- <result column="updatedate" jdbcType="TIMESTAMP" property="updatedate" />
- <result column="url" jdbcType="CHAR" property="url" />
- <result column="author" jdbcType="CHAR" property="author" />
- <result column="view_num" jdbcType="INTEGER" property="viewNum" />
- <result column="description" jdbcType="LONGVARCHAR" property="description" />
- <result column="sorts" jdbcType="INTEGER" property="sorts" />
- <result column="content" jdbcType="VARCHAR" property="content" />
- </resultMap>
- <select id="selectByContentIdAndTableName" resultType="java.util.Map">
- SELECT
- c.content_id contentId,
- c.site_id siteId,
- c.user_id userId,
- c.category_id categoryId,
- c.model_id modelId,
- c.title,
- c.keywords,
- c.description,
- c.top,
- c.recommend,
- c.thumb,
- c.updatedate,
- c.inputdate,
- c.status,
- c.url,
- c.author,
- c.sorts,
- c.view_num viewNum,
- m.*
- FROM
- t_cms_content c LEFT JOIN t_cms_content_${tableName} m
- ON
- c.content_id = m.content_id
- WHERE
- c.content_id =#{contentId}
- </select>
- <select id="selectByTableNameAndMap" resultMap="BaseResultMap">
- SELECT
- c.*,
- m.*
- FROM
- t_cms_content c LEFT JOIN t_cms_content_${tableName} m
- ON
- c.content_id = m.content_id
- <trim prefix="WHERE (" suffix=")" prefixOverrides="AND|OR">
- category_id = #{categoryId}
- <foreach item="value" index="key" collection="param.entrySet()" >
- and ${key} = #{value}
- </foreach>
- </trim>
- </select>
- <select id="selectByCondition" parameterType="com.sooka.mybatis.model.TCmsContent" resultMap="BaseResultMap">
- SELECT
- *
- FROM
- t_cms_content
- <trim prefix="WHERE (" suffix=")" prefixOverrides="AND|OR">
- <if test="title!=null and title!=''">
- title like CONCAT('%',#{title,jdbcType=VARCHAR},'%')
- </if>
- <if test="siteId!=null">
- and site_id = #{siteId,jdbcType=INTEGER}
- </if>
- <if test="categoryId!=null">
- and category_id = #{categoryId,jdbcType=BIGINT}
- </if>
- <if test="status!=null">
- and status = #{status,jdbcType=INTEGER}
- </if>
- <if test="status==null">
- and status in(0,1)
- </if>
- </trim>
- <choose>
- <when test="orderField!=null and orderField!='' and orderDirection!=null and orderDirection!='' ">
- order by ${orderField} ${orderDirection}
- </when>
- <otherwise>
- order by inputdate DESC
- </otherwise>
- </choose>
- </select>
- <!-- 岔信村列表 -->
- <select id="selectByConditions" parameterType="com.sooka.module.web.cms.vo.CxcVo" resultMap="BaseResultMaps">
- SELECT
- c.content_id contentId,
- c.site_id siteId,
- c.user_id userId,
- c.category_id categoryId,
- c.model_id modelId,
- c.title,
- c.keywords,
- c.description,
- c.top,
- c.recommend,
- c.thumb,
- c.updatedate,
- c.inputdate,
- c.status,
- c.url,
- c.author,
- c.sorts,
- c.view_num viewNum,
- m.content
- FROM
- t_cms_content c LEFT JOIN t_cms_content_news m
- ON
- c.content_id = m.content_id
- <trim prefix="WHERE (" suffix=")" prefixOverrides="AND|OR">
- <if test="title!=null and title!=''">
- title like CONCAT('%',#{title,jdbcType=VARCHAR},'%')
- </if>
- <if test="siteId!=null">
- and c.site_id = #{siteId,jdbcType=INTEGER}
- </if>
- <if test="categoryId!=null">
- and c.category_id = #{categoryId,jdbcType=BIGINT}
- </if>
- <if test="status!=null">
- and status = #{status,jdbcType=INTEGER}
- </if>
- <if test="status==null">
- and status in(0,1)
- </if>
- </trim>
- <choose>
- <when test="orderField!=null and orderField!='' and orderDirection!=null and orderDirection!='' ">
- order by ${orderField} ${orderDirection}
- </when>
- <otherwise>
- order by c.content_id DESC
- </otherwise>
- </choose>
- </select>
- <select id="selectByContentListBySiteIdAndCategoryIds" resultType="java.util.Map">
- SELECT
- c.content_id contentId,
- c.site_id siteId,
- c.user_id userId,
- c.category_id categoryId,
- c.model_id modelId,
- c.title,
- c.keywords,
- c.description,
- c.top,
- c.recommend,
- c.thumb,
- c.updatedate,
- c.inputdate,
- c.status,
- c.url,
- c.author,
- c.sorts,
- c.view_num viewNum,
- m.*
- FROM
- t_cms_content c LEFT JOIN t_cms_content_${tableName} m
- ON
- c.content_id = m.content_id
- <trim prefix="WHERE (" suffix=")" prefixOverrides="AND|OR">
- c.status=1
- <if test="siteId!=null">
- AND c.site_id = #{siteId}
- </if>
- <if test="categoryIds!=null">
- AND
- c.category_id in
- <foreach item="item" index="index" collection="categoryIds" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test='isRecommend!=null and isRecommend==1'>
- AND
- c.recommend = 1
- </if>
- <if test='isPic!=null and isPic==1'>
- AND
- c.thumb!=''
- </if>
- <if test='isPic!=null and isPic==0'>
- AND
- c.thumb=''
- </if>
- <if test='orderBy==6'>
- AND
- c.thumb!=''
- </if>
- </trim>
- <choose>
- <when test="orderBy==1">
- order by c.content_id
- </when>
- <when test="orderBy==2">
- order by c.sorts,inputdate DESC
- </when>
- <when test="orderBy==3">
- order by c.inputdate
- </when>
- <when test="orderBy==4">
- order by c.updatedate DESC
- </when>
- <when test="orderBy==5">
- order by c.updatedate
- </when>
- <when test="orderBy==6">
- order by c.sorts,c.updatedate DESC
- </when>
- <when test="isHot==1">
- order by c.view_num DESC
- </when>
- <otherwise>
- order by c.content_id DESC
- </otherwise>
- </choose>
- </select>
- <select id="selectByTopicContentListBySiteIdAndCategoryIds" resultType="java.util.Map">
- SELECT
- *
- FROM
- t_cms_content
- <trim prefix="WHERE (" suffix=")" prefixOverrides="AND|OR">
- status=1
- <if test="siteId!=null">
- AND site_id = #{siteId}
- </if>
- <if test="categoryIds!=null">
- AND
- category_id in
- <foreach item="item" index="index" collection="categoryIds" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test='isRecommend!=null and isRecommend==1'>
- AND
- recommend = 1
- </if>
- <if test='isPic!=null and isPic==1'>
- AND
- thumb!=''
- </if>
- <if test='isPic!=null and isPic==0'>
- AND
- thumb=''
- </if>
- </trim>
- <choose>
- <when test="orderBy==1">
- order by content_id
- </when>
- <when test="orderBy==2">
- order by inputdate DESC
- </when>
- <when test="orderBy==3">
- order by inputdate
- </when>
- <when test="orderBy==4">
- order by updatedate DESC
- </when>
- <when test="orderBy==5">
- order by updatedate
- </when>
- <when test="isHot==1">
- order by view_num DESC
- </when>
- <otherwise>
- order by content_id DESC
- </otherwise>
- </choose>
- </select>
- </mapper>
|