123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- <?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.MomentsCommentMapper">
- <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.circle.MomentsComment" >
- <id column="id" property="id" jdbcType="INTEGER" />
- <result column="pid" property="pid" jdbcType="INTEGER" />
- <result column="moments_id" property="momentsId" jdbcType="INTEGER" />
- <result column="type" property="type" jdbcType="INTEGER" />
- <result column="uid" property="uid" jdbcType="BIGINT" />
- <result column="no" property="no" jdbcType="BIGINT" />
- <result column="nick" property="nick" jdbcType="VARCHAR" />
- <result column="state" property="state" jdbcType="INTEGER" />
- <result column="content" property="content" jdbcType="VARCHAR" />
- <result column="like_num" property="likeNum" jdbcType="INTEGER" />
- <result column="admin_id" property="adminId" jdbcType="INTEGER" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, pid, moments_id, uid, no, nick, type,
- state, content, like_num, admin_id, create_time
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
- select
- <include refid="Base_Column_List" />
- from moments_comment
- where id = #{id,jdbcType=INTEGER}
- </select>
- <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.circle.MomentsComment" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
- <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into moments_comment (pid, moments_id, uid,
- no, nick, type,
- state, content, like_num,
- admin_id, create_time)
- values (#{pid,jdbcType=INTEGER}, #{momentsId,jdbcType=INTEGER}, #{uid,jdbcType=BIGINT},
- #{no,jdbcType=BIGINT}, #{nick,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
- #{state,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR}, #{likeNum,jdbcType=INTEGER},
- #{adminId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})
- </insert>
- <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.circle.MomentsComment" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
- <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into moments_comment
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="pid != null" >
- pid,
- </if>
- <if test="momentsId != null" >
- moments_id,
- </if>
- <if test="uid != null" >
- uid,
- </if>
- <if test="no != null" >
- no,
- </if>
- <if test="nick != null and nick != ''" >
- nick,
- </if>
- <if test="type != null" >
- type,
- </if>
- <if test="state != null" >
- state,
- </if>
- <if test="content != null" >
- content,
- </if>
- <if test="likeNum != null" >
- like_num,
- </if>
- <if test="adminId != null" >
- admin_id,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="pid != null" >
- #{pid,jdbcType=INTEGER},
- </if>
- <if test="momentsId != null" >
- #{momentsId,jdbcType=INTEGER},
- </if>
- <if test="uid != null" >
- #{uid,jdbcType=BIGINT},
- </if>
- <if test="no != null" >
- #{no,jdbcType=BIGINT},
- </if>
- <if test="nick != null" >
- #{nick,jdbcType=VARCHAR},
- </if>
- <if test="type != null" >
- #{type,jdbcType=INTEGER},
- </if>
- <if test="state != null" >
- #{state,jdbcType=INTEGER},
- </if>
- <if test="content != null" >
- #{content,jdbcType=VARCHAR},
- </if>
- <if test="likeNum != null" >
- #{likeNum,jdbcType=INTEGER},
- </if>
- <if test="adminId != null" >
- #{adminId,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.circle.MomentsComment" >
- update moments_comment
- <set >
- <if test="pid != null" >
- pid = #{pid,jdbcType=INTEGER},
- </if>
- <if test="momentsId != null" >
- moments_id = #{momentsId,jdbcType=INTEGER},
- </if>
- <if test="uid != null" >
- uid = #{uid,jdbcType=BIGINT},
- </if>
- <if test="no != null" >
- no = #{no,jdbcType=BIGINT},
- </if>
- <if test="nick != null" >
- nick = #{nick,jdbcType=VARCHAR},
- </if>
- <if test="type != null" >
- type = #{type,jdbcType=INTEGER},
- </if>
- <if test="state != null" >
- state = #{state,jdbcType=INTEGER},
- </if>
- <if test="content != null" >
- content = #{content,jdbcType=VARCHAR},
- </if>
- <if test="likeNum != null" >
- like_num = #{likeNum,jdbcType=INTEGER},
- </if>
- <if test="adminId != null" >
- admin_id = #{adminId,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </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.MomentsComment" >
- update moments_comment
- set pid = #{pid,jdbcType=INTEGER},
- moments_id = #{momentsId,jdbcType=INTEGER},
- uid = #{uid,jdbcType=BIGINT},
- no = #{no,jdbcType=BIGINT},
- nick = #{nick,jdbcType=VARCHAR},
- type = #{type,jdbcType=INTEGER},
- state = #{state,jdbcType=INTEGER},
- content = #{content,jdbcType=VARCHAR},
- like_num = #{likeNum,jdbcType=INTEGER},
- admin_id = #{adminId,jdbcType=INTEGER},
- create_time = #{createTime,jdbcType=TIMESTAMP}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
- delete from moments_comment
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <select id="countComments" resultType="java.lang.Integer">
- select count(*) from moments_comment where moments_id = #{momentsId}
- </select>
- <update id="updateByState">
- update moments_comment set state = #{state},admin_id = #{adminId} where moments_id = #{momentsId}
- </update>
- <select id="selectMomentsCommentByPage" resultType="com.juxiao.xchat.module.xbd.vo.MomentsCommentVO">
- select mc.id,mc.moments_id as momentsId,mc.no as fromErBanNo,mc.nick as fromNick,mc.state,mc.content,mc.create_time as createTime,mc.update_time as updateTime,su.user_name as adminName
- from moments_comment mc
- left join sys_user su on mc.admin_id = su.user_id
- where mc.type = 1
- <if test="keyWord != null and keyWord != ''">
- and mc.from_no = #{keyWord}
- </if>
- <if test="adminName != null and adminName != ''">
- and su.user_name = #{adminName}
- </if>
- <if test="state != null">
- and mc.state = #{state}
- </if>
- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
- and mc.create_time between #{startTime} and #{endTime}
- </if>
- order by mc.state asc ,mc.create_time desc
- </select>
- <select id="selectReplyByList" resultMap="BaseResultMap">
- select mc.id, mc.pid, mc.moments_id, mc.nick, mc.no, mc.uid, mc.state, mc.content, mc.admin_id, mc.create_time, mc.update_time
- from moments_comment mc
- where mc.type = 2 and mc.pid = #{commentId}
- </select>
- <delete id="deleteByMomentsId">
- delete from moments_comment where moments_id = #{momentsId}
- </delete>
- </mapper>
|