| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- <?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.goafanti.common.dao.LectureMapper" >
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.Lecture" >
- <id column="id" property="id" jdbcType="VARCHAR" />
- <result column="uid" property="uid" jdbcType="VARCHAR" />
- <result column="lecture_time" property="lectureTime" jdbcType="TIMESTAMP" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="last_update_time" property="lastUpdateTime" jdbcType="TIMESTAMP" />
- <result column="name" property="name" jdbcType="VARCHAR" />
- <result column="summary" property="summary" jdbcType="VARCHAR" />
- <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
- <result column="lecture_url" property="lectureUrl" jdbcType="VARCHAR" />
- <result column="hot" property="hot" jdbcType="INTEGER" />
- <result column="dynamic" property="dynamic" jdbcType="INTEGER" />
- <result column="end_time" property="endTime" jdbcType="TIMESTAMP" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, uid, lecture_time, create_time, last_update_time, name, summary, deleted_sign, lecture_url,
- hot, dynamic, end_time
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
- select
- <include refid="Base_Column_List" />
- from lecture
- where id = #{id,jdbcType=VARCHAR}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
- delete from lecture
- where id = #{id,jdbcType=VARCHAR}
- </delete>
- <insert id="insert" parameterType="com.goafanti.common.model.Lecture" >
- insert into lecture (id, uid, lecture_time,
- create_time, last_update_time, name,
- summary, deleted_sign, lecture_url, hot, dynamic, end_time)
- values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{lectureTime,jdbcType=TIMESTAMP},
- #{createTime,jdbcType=TIMESTAMP}, #{lastUpdateTime,jdbcType=TIMESTAMP}, #{name,jdbcType=VARCHAR},
- #{summary,jdbcType=VARCHAR}, #{deletedSign,jdbcType=INTEGER}, #{lectureUrl,jdbcType=VARCHAR},
- #{hot,jdbcType=INTEGER}, #{dynamic,jdbcType=INTEGER}, #{endTime,jdbcType=TIMESTAMP})
- </insert>
- <insert id="insertSelective" parameterType="com.goafanti.common.model.Lecture" >
- insert into lecture
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- id,
- </if>
- <if test="uid != null" >
- uid,
- </if>
- <if test="lectureTime != null" >
- lecture_time,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- <if test="lastUpdateTime != null" >
- last_update_time,
- </if>
- <if test="name != null" >
- name,
- </if>
- <if test="summary != null" >
- summary,
- </if>
- <if test="deletedSign != null" >
- deleted_sign,
- </if>
- <if test="lectureUrl != null" >
- lecture_url,
- </if>
- <if test="hot != null" >
- hot,
- </if>
- <if test="dynamic != null" >
- dynamic,
- </if>
- <if test="endTime != null" >
- end_time,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- #{id,jdbcType=VARCHAR},
- </if>
- <if test="uid != null" >
- #{uid,jdbcType=VARCHAR},
- </if>
- <if test="lectureTime != null" >
- #{lectureTime,jdbcType=TIMESTAMP},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="lastUpdateTime != null" >
- #{lastUpdateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="name != null" >
- #{name,jdbcType=VARCHAR},
- </if>
- <if test="summary != null" >
- #{summary,jdbcType=VARCHAR},
- </if>
- <if test="deletedSign != null" >
- #{deletedSign,jdbcType=INTEGER},
- </if>
- <if test="lectureUrl != null" >
- #{lectureUrl,jdbcType=VARCHAR},
- </if>
- <if test="hot != null" >
- #{hot,jdbcType=INTEGER},
- </if>
- <if test="dynamic != null" >
- #{dynamic,jdbcType=INTEGER},
- </if>
- <if test="endTime != null" >
- #{endTime,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Lecture" >
- update lecture
- <set >
- <if test="uid != null" >
- uid = #{uid,jdbcType=VARCHAR},
- </if>
- <if test="lectureTime != null" >
- lecture_time = #{lectureTime,jdbcType=TIMESTAMP},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="lastUpdateTime != null" >
- last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="name != null" >
- name = #{name,jdbcType=VARCHAR},
- </if>
- <if test="summary != null" >
- summary = #{summary,jdbcType=VARCHAR},
- </if>
- <if test="deletedSign != null" >
- deleted_sign = #{deletedSign,jdbcType=INTEGER},
- </if>
- <if test="lectureUrl != null" >
- lecture_url = #{lectureUrl,jdbcType=VARCHAR},
- </if>
- <if test="hot != null" >
- hot = #{hot,jdbcType=INTEGER},
- </if>
- <if test="dynamic != null" >
- dynamic = #{dynamic,jdbcType=INTEGER},
- </if>
- <if test="endTime != null" >
- end_time = #{endTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Lecture" >
- update lecture
- set uid = #{uid,jdbcType=VARCHAR},
- lecture_time = #{lectureTime,jdbcType=TIMESTAMP},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
- name = #{name,jdbcType=VARCHAR},
- summary = #{summary,jdbcType=VARCHAR},
- deleted_sign = #{deletedSign,jdbcType=INTEGER},
- lecture_url = #{lectureUrl,jdbcType=VARCHAR},
- hot = #{hot,jdbcType=INTEGER},
- dynamic = #{dynamic,jdbcType=INTEGER},
- end_time = #{endTime,jdbcType=TIMESTAMP}
- where id = #{id,jdbcType=VARCHAR}
- </update>
-
- <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
- update lecture set deleted_sign = 1
- where id in
- <foreach item="item" index="index" collection="list" open="("
- separator="," close=")">
- #{item}
- </foreach>
- </update>
-
- <select id="findLectureListByPage" parameterType="String" resultType="com.goafanti.lecture.bo.LectureListBo">
- select
- l.id,
- l.uid,
- l.name,
- l.lecture_time as lectureTime,
- l.summary,
- l.lecture_url as lectureUrl,
- ui.username,
- l.hot,
- l.dynamic,
- l.end_time as endTime
- from lecture l
- left join user_identity ui on ui.uid = l.uid
- where
- l.deleted_sign = 0
- <if test="uid != null">
- and l.uid = #{uid,jdbcType=VARCHAR}
- </if>
- <if test="name != null">
- and l.name like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
- </if>
- <if test="username != null">
- and ui.username like CONCAT('%', #{username,jdbcType=VARCHAR}, '%')
- </if>
- <if test="startL != null">
- and l.lecture_time <![CDATA[ >= ]]> #{startL,jdbcType=TIMESTAPM}
- </if>
- <if test="endL != null">
- and l.lecture_time <![CDATA[ < ]]> #{endL,jdbcType=TIMESTAPM}
- </if>
- order by l.lecture_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
-
- <select id="findLectureCount" parameterType="String" resultType="java.lang.Integer">
- select
- count(1)
- from lecture l
- left join user_identity ui on ui.uid = l.uid
- where
- l.deleted_sign = 0
- <if test="uid != null">
- and l.uid = #{uid,jdbcType=VARCHAR}
- </if>
- <if test="name != null">
- and l.name like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
- </if>
- <if test="username != null">
- and ui.username like CONCAT('%', #{username,jdbcType=VARCHAR}, '%')
- </if>
- <if test="startL != null">
- and l.lecture_time <![CDATA[ >= ]]> #{startL,jdbcType=TIMESTAMP}
- </if>
- <if test="endL != null">
- and l.lecture_time <![CDATA[ < ]]> #{endL,jdbcType=TIMESTAMP}
- </if>
- </select>
-
- <select id="countHotNum" resultType="java.lang.Integer">
- select
- count(1)
- from lecture
- where hot = 1
- and deleted_sign = 0
- </select>
-
- <select id="countDynamicNum" resultType="java.lang.Integer">
- select
- count(1)
- from lecture
- where dynamic = 1
- and deleted_sign = 0
- </select>
-
- <select id="listHot" resultType="com.goafanti.lecture.bo.LectureListBo">
- select
- l.id,
- l.uid,
- l.name,
- l.lecture_time as lectureTime,
- l.summary,
- l.lecture_url as lectureUrl,
- ui.username,
- l.hot,
- l.dynamic,
- l.end_time as endTime
- from lecture l
- left join user_identity ui on ui.uid = l.uid
- where
- l.deleted_sign = 0
- and l.hot = 1
- </select>
-
- <select id="listDynamic" resultType="com.goafanti.lecture.bo.LectureListBo">
- select
- l.id,
- l.uid,
- l.name,
- l.lecture_time as lectureTime,
- l.summary,
- l.lecture_url as lectureUrl,
- ui.username,
- l.hot,
- l.dynamic,
- l.end_time as endTime
- from lecture l
- left join user_identity ui on ui.uid = l.uid
- where
- l.deleted_sign = 0
- and l.dynamic = 1
- </select>
-
- <select id="listBigShotLecture" resultType="com.goafanti.lecture.bo.BigShotLectureListBo">
- select
- l.id,
- l.uid,
- l.name,
- l.lecture_time as lectureTime,
- l.summary,
- l.lecture_url as lectureUrl,
- ui.username,
- l.end_time as endTime
- from lecture l
- left join user_identity ui on ui.uid = l.uid
- where
- l.deleted_sign = 0
- and l.hot = 1
- </select>
- </mapper>
|