123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- <?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.juxiao.xchat.module.xbd.mapper.circle.MomentsMapper">
- <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.circle.Moments" >
- <id column="id" property="id" jdbcType="INTEGER" />
- <result column="topic_id" property="topicId" jdbcType="INTEGER" />
- <result column="uid" property="uid" jdbcType="BIGINT" />
- <result column="tape" property="tape" jdbcType="VARCHAR" />
- <result column="type" property="type" jdbcType="INTEGER" />
- <result column="location" property="location" jdbcType="VARCHAR" />
- <result column="privacy_type" property="privacyType" jdbcType="INTEGER" />
- <result column="likes" property="likes" jdbcType="INTEGER" />
- <result column="comments" property="comments" jdbcType="INTEGER" />
- <result column="admin_id" property="adminId" jdbcType="INTEGER" />
- <result column="state" property="state" jdbcType="INTEGER" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="content" property="content" jdbcType="VARCHAR" />
- <result column="tape_duration" property="tapeDuration" jdbcType="INTEGER" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, topic_id, uid, tape, type, location, privacy_type, likes, comments, admin_id,
- state, create_time,content,tape_duration
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
- select
- <include refid="Base_Column_List" />
- from moments
- where id = #{id,jdbcType=INTEGER}
- </select>
- <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.circle.Moments" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
- <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into moments (topic_id, uid, tape,
- type, location, privacy_type,
- likes, comments, admin_id,
- state, create_time, content
- )
- values (#{topicId,jdbcType=INTEGER}, #{uid,jdbcType=BIGINT}, #{tape,jdbcType=VARCHAR},
- #{type,jdbcType=INTEGER}, #{location,jdbcType=VARCHAR}, #{privacyType,jdbcType=INTEGER},
- #{likes,jdbcType=INTEGER}, #{comments,jdbcType=INTEGER}, #{adminId,jdbcType=INTEGER},
- #{state,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{content,jdbcType=LONGVARCHAR}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.circle.Moments" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
- <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into moments
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="topicId != null" >
- topic_id,
- </if>
- <if test="uid != null" >
- uid,
- </if>
- <if test="tape != null" >
- tape,
- </if>
- <if test="type != null" >
- type,
- </if>
- <if test="location != null" >
- location,
- </if>
- <if test="privacyType != null" >
- privacy_type,
- </if>
- <if test="likes != null" >
- likes,
- </if>
- <if test="comments != null" >
- comments,
- </if>
- <if test="adminId != null" >
- admin_id,
- </if>
- <if test="state != null" >
- state,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- <if test="content != null" >
- content,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="topicId != null" >
- #{topicId,jdbcType=INTEGER},
- </if>
- <if test="uid != null" >
- #{uid,jdbcType=BIGINT},
- </if>
- <if test="tape != null" >
- #{tape,jdbcType=VARCHAR},
- </if>
- <if test="type != null" >
- #{type,jdbcType=INTEGER},
- </if>
- <if test="location != null" >
- #{location,jdbcType=VARCHAR},
- </if>
- <if test="privacyType != null" >
- #{privacyType,jdbcType=INTEGER},
- </if>
- <if test="likes != null" >
- #{likes,jdbcType=INTEGER},
- </if>
- <if test="comments != null" >
- #{comments,jdbcType=INTEGER},
- </if>
- <if test="adminId != null" >
- #{adminId,jdbcType=INTEGER},
- </if>
- <if test="state != null" >
- #{state,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="content != null" >
- #{content,jdbcType=LONGVARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.circle.Moments" >
- update moments
- <set >
- <if test="topicId != null" >
- topic_id = #{topicId,jdbcType=INTEGER},
- </if>
- <if test="uid != null" >
- uid = #{uid,jdbcType=BIGINT},
- </if>
- <if test="tape != null" >
- tape = #{tape,jdbcType=VARCHAR},
- </if>
- <if test="type != null" >
- type = #{type,jdbcType=INTEGER},
- </if>
- <if test="location != null" >
- location = #{location,jdbcType=VARCHAR},
- </if>
- <if test="privacyType != null" >
- privacy_type = #{privacyType,jdbcType=INTEGER},
- </if>
- <if test="likes != null" >
- likes = #{likes,jdbcType=INTEGER},
- </if>
- <if test="comments != null" >
- comments = #{comments,jdbcType=INTEGER},
- </if>
- <if test="adminId != null" >
- admin_id = #{adminId,jdbcType=INTEGER},
- </if>
- <if test="state != null" >
- state = #{state,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="content != null" >
- content = #{content,jdbcType=LONGVARCHAR},
- </if>
- <if test="updateTime != null" >
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.circle.Moments" >
- update moments
- set topic_id = #{topicId,jdbcType=INTEGER},
- uid = #{uid,jdbcType=BIGINT},
- tape = #{tape,jdbcType=VARCHAR},
- type = #{type,jdbcType=INTEGER},
- location = #{location,jdbcType=VARCHAR},
- privacy_type = #{privacyType,jdbcType=INTEGER},
- likes = #{likes,jdbcType=INTEGER},
- comments = #{comments,jdbcType=INTEGER},
- admin_id = #{adminId,jdbcType=INTEGER},
- state = #{state,jdbcType=INTEGER},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- content = #{content,jdbcType=LONGVARCHAR}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
- delete from moments
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <select id="selectByMomentsByPage" resultType="com.juxiao.xchat.module.xbd.vo.MomentsVO">
- select m.id,u.erban_no as erBanNo,u.nick,m.uid,m.content,m.tape,t.id as topicId, t.title as topicTitle,m.state,su.user_name as adminName,m.admin_id as adminId,m.create_time as createTime,m.update_time as updateTime
- from moments m
- left join topic t on m.topic_id = t.id
- left join users u on u.uid = m.uid
- left join sys_user su on m.admin_id = su.user_id
- where 1 = 1
- <if test="keyWord != null and keyWord != ''">
- and u.erban_no = #{keyWord}
- </if>
- <if test="adminName != null and adminName != ''">
- and su.user_name = #{adminName}
- </if>
- <if test="state != null">
- and m.state = #{state}
- </if>
- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
- and m.create_time between #{startTime} and #{endTime}
- </if>
- <if test="momentsId != null">
- and m.id = #{momentsId}
- </if>
- order by m.state asc, m.create_time desc
- </select>
- <select id="selectById" resultType="com.juxiao.xchat.module.xbd.vo.MomentsVO">
- SELECT m.id, m.topic_id as topicId, m.uid, m.tape, m.type, m.location, m.privacy_type, m.likes, m.comments, m.admin_id as adminId,
- m.state, m.create_time as createTime,m.content,t.title as topicTitle,u.erban_no as erBanNo
- from moments m
- left join users u on u.uid = m.uid
- left join topic t on m.topic_id = t.id
- where m.id = #{id}
- </select>
- <update id="updateByState" parameterType="com.juxiao.xchat.module.xbd.domain.circle.Moments" >
- update moments
- <set >
- <if test="adminId != null" >
- admin_id = #{adminId,jdbcType=INTEGER},
- </if>
- <if test="state != null" >
- state = #{state,jdbcType=INTEGER},
- </if>
- <if test="updateTime != null" >
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- </mapper>
|