123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <?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.keao.edu.cms.dal.dao.HelpCenterContentDao">
- <resultMap id="HelpCenterContent" type="com.keao.edu.cms.dal.entity.HelpCenterContent">
- <id column="id_" property="id" jdbcType="INTEGER" />
- <result column="title_" property="title" jdbcType="VARCHAR" />
- <result column="create_on_" property="createOn" jdbcType="TIMESTAMP" />
- <result column="modify_on_" property="modifyOn" jdbcType="TIMESTAMP" />
- <result column="status_" property="status" jdbcType="INTEGER" />
- <result column="order_" property="order" jdbcType="INTEGER" />
- <result column="catalog_id_" property="catalogId" jdbcType="INTEGER" />
- <association property="catalog"
- javaType="com.keao.edu.cms.dal.entity.HelpCenterCatalog">
- <result column="catalog_id_" property="id" />
- <result column="name_" property="text" />
- <result column="parent_id_" property="parentId" />
- </association>
- </resultMap>
- <resultMap id="HelpCenterContentBlobs" type="com.keao.edu.cms.dal.entity.HelpCenterContent"
- extends="HelpCenterContent">
- <result column="content_" property="content" jdbcType="LONGVARCHAR" />
- </resultMap>
- <!-- 查询条件 -->
- <sql id="queryConditionUnion">
- <where>
- <if test="catalogIds != null">
- and content.catalog_id_ in (${catalogIds})
- </if>
- <if test="title!= null and title != ''">
- and content.title_ like '%' #{title} '%'
- </if>
- <if test="status!= null">
- and content.status_ = #{status}
- </if>
- </where>
- </sql>
-
- <sql id="Base_Column_List">
- id_, title_, catalog_id_, create_on_, modify_on_,status_,order_
- </sql>
- <sql id="Base_Column_List_union">
- content.id_, content.title_, content.catalog_id_,
- content.create_on_,
- content.modify_on_,content.status_,content.content_,content.order_,
- catalog.id_,
- catalog.name_, catalog.parent_id_
- </sql>
- <sql id="Blob_Column_List">
- content_
- </sql>
- <select id="get" resultMap="HelpCenterContentBlobs" parameterType="java.lang.Integer">
- select
- <include refid="Base_Column_List_union" />
- from help_center_content content left join help_center_catalog catalog on
- content.catalog_id_=catalog.id_
- where content.id_ =
- #{id,jdbcType=INTEGER}
- </select>
- <select id="queryPage" parameterType="map" resultMap="HelpCenterContentBlobs">
- select
- <include refid="Base_Column_List_union" />
- from help_center_content content left join help_center_catalog catalog on
- content.catalog_id_=catalog.id_
- <include refid="queryConditionUnion" />
- order by order_ asc
- <include refid="global.limit" />
- </select>
- <select id="queryCount" parameterType="map" resultType="int">
- select count(*) from help_center_content content left join help_center_catalog catalog on
- content.catalog_id_=catalog.id_
- <include refid="queryConditionUnion" />
- </select>
- <delete id="delete" parameterType="java.lang.Integer">
- delete from help_center_content
- where id_ = #{id,jdbcType=INTEGER}
- </delete>
-
- <delete id="deleteContentByCatalog" parameterType="java.lang.Integer">
- delete from help_center_content
- where catalog_id_ = #{catalogId,jdbcType=INTEGER}
- </delete>
- <insert id="insert" parameterType="com.keao.edu.cms.dal.entity.HelpCenterContent">
- insert into help_center_content
- (id_, title_, catalog_id_,
- create_on_, modify_on_, content_,status_,order_
- )
- values
- (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR},
- #{catalogId,jdbcType=INTEGER},
- #{createOn,jdbcType=TIMESTAMP},
- #{modifyOn,jdbcType=TIMESTAMP}, #{content,jdbcType=LONGVARCHAR},#{status,jdbcType=INTEGER},#{order,jdbcType=INTEGER}
- )
- </insert>
- <update id="update" parameterType="com.keao.edu.cms.dal.entity.HelpCenterContent">
- update help_center_content
- <set>
- <if test="title != null">
- title_ = #{title,jdbcType=VARCHAR},
- </if>
- <if test="catalogId != null">
- catalog_id_ = #{catalogId,jdbcType=INTEGER},
- </if>
- <if test="createOn != null">
- create_on_ = #{createOn,jdbcType=TIMESTAMP},
- </if>
- <if test="modifyOn != null">
- modify_on_ = #{modifyOn,jdbcType=TIMESTAMP},
- </if>
- <if test="content != null">
- content_ = #{content,jdbcType=LONGVARCHAR},
- </if>
- <if test="status != null">
- status_ = #{status,jdbcType=INTEGER},
- </if>
- <if test="order != null">
- order_ = #{order,jdbcType=INTEGER},
- </if>
- </set>
- where id_ = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateBlobs" parameterType="com.keao.edu.cms.dal.entity.HelpCenterContent">
- update help_center_content
- set title_ = #{title,jdbcType=VARCHAR},
- catalog_id_ =
- #{catalogId,jdbcType=INTEGER},
- create_on_ =
- #{createOn,jdbcType=TIMESTAMP},
- modify_on_ =
- #{modifyOn,jdbcType=TIMESTAMP},
- content_ =
- #{content,jdbcType=LONGVARCHAR},
- status_= #{status,jdbcType=INTEGER},
- order_= #{order,jdbcType=INTEGER}
- where id_ = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByKey" parameterType="com.keao.edu.cms.dal.entity.HelpCenterContent">
- update help_center_content
- set title_ = #{title,jdbcType=VARCHAR},
- catalog_id_ =
- #{catalogId,jdbcType=INTEGER},
- create_on_ =
- #{createOn,jdbcType=TIMESTAMP},
- modify_on_ =
- #{modifyOn,jdbcType=TIMESTAMP},
- status_ = #{status,jdbcType=INTEGER},
- order_ = #{order,jdbcType=INTEGER},
- where id_ = #{id,jdbcType=INTEGER}
- </update>
-
- <update id="updateContentByCatalog" parameterType="map">
- update help_center_content set status_=#{status} where catalog_id_=#{catalogId}
- </update>
- </mapper>
|