123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- <?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.TopicMapper">
- <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.circle.Topic" >
- <id column="id" property="id" jdbcType="INTEGER" />
- <result column="title" property="title" jdbcType="VARCHAR" />
- <result column="pic" property="pic" jdbcType="VARCHAR" />
- <result column="sort" property="sort" jdbcType="INTEGER" />
- <result column="activation" property="activation" jdbcType="INTEGER" />
- <result column="pk" property="pk" jdbcType="INTEGER" />
- <result column="red_option" property="redOption" jdbcType="VARCHAR" />
- <result column="blue_option" property="blueOption" jdbcType="VARCHAR" />
- <result column="lead" property="lead" jdbcType="VARCHAR" />
- <result column="red_desc" property="redDesc" jdbcType="VARCHAR" />
- <result column="blue_desc" property="blueDesc" jdbcType="VARCHAR" />
- <result column="end_time" property="endTime" jdbcType="VARCHAR" />
- <result column="examine" property="examine" jdbcType="INTEGER" />
- <result column="examine_num" property="examineNum" jdbcType="INTEGER" />
- <result column="red_ticket" property="redTicket" jdbcType="INTEGER" />
- <result column="blue_ticket" property="blueTicket" jdbcType="INTEGER" />
- <result column="admin_id" property="adminId" jdbcType="INTEGER" />
- <result column="pk_vote_num" property="pkVoteNum" jdbcType="INTEGER"/>
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, title, pic, sort, activation, pk, red_option, blue_option, end_time, examine,
- examine_num, red_ticket, blue_ticket, admin_id, create_time,lead, red_desc, blue_desc,pk_vote_num
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
- select
- <include refid="Base_Column_List" />
- from topic
- where id = #{id,jdbcType=INTEGER}
- </select>
- <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.circle.Topic" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into topic (title, pic, sort,
- activation, pk, red_option,
- blue_option, end_time, examine,
- examine_num, red_ticket, blue_ticket,
- admin_id, create_time, lead,
- red_desc, blue_desc,pk_vote_num)
- values (#{title,jdbcType=VARCHAR}, #{pic,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER},
- #{activation,jdbcType=INTEGER}, #{pk,jdbcType=INTEGER}, #{redOption,jdbcType=VARCHAR},
- #{blueOption,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, #{examine,jdbcType=INTEGER},
- #{examineNum,jdbcType=INTEGER}, #{redTicket,jdbcType=INTEGER}, #{blueTicket,jdbcType=INTEGER},
- #{adminId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{lead,jdbcType=LONGVARCHAR},
- #{redDesc,jdbcType=LONGVARCHAR}, #{blueDesc,jdbcType=LONGVARCHAR},#{pkVoteNum,jdbcType=INTEGER})
- </insert>
- <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.circle.Topic" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into topic
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="title != null and title != ''" >
- title,
- </if>
- <if test="pic != null and pic != ''" >
- pic,
- </if>
- <if test="sort != null" >
- sort,
- </if>
- <if test="activation != null" >
- activation,
- </if>
- <if test="pk != null" >
- pk,
- </if>
- <if test="redOption != null" >
- red_option,
- </if>
- <if test="blueOption != null" >
- blue_option,
- </if>
- <if test="endTime != null" >
- end_time,
- </if>
- <if test="examine != null" >
- examine,
- </if>
- <if test="examineNum != null" >
- examine_num,
- </if>
- <if test="redTicket != null" >
- red_ticket,
- </if>
- <if test="blueTicket != null" >
- blue_ticket,
- </if>
- <if test="adminId != null" >
- admin_id,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- <if test="lead != null lead != ''" >
- lead,
- </if>
- <if test="redDesc != null and redDesc != ''" >
- red_desc,
- </if>
- <if test="blueDesc != null and blueDesc != ''" >
- blue_desc,
- </if>
- <if test="pkVoteNum != null">
- pk_vote_num,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="title != null and title != ''" >
- #{title,jdbcType=VARCHAR},
- </if>
- <if test="pic != null" >
- #{pic,jdbcType=VARCHAR},
- </if>
- <if test="sort != null" >
- #{sort,jdbcType=INTEGER},
- </if>
- <if test="activation != null" >
- #{activation,jdbcType=INTEGER},
- </if>
- <if test="pk != null" >
- #{pk,jdbcType=INTEGER},
- </if>
- <if test="redOption != null" >
- #{redOption,jdbcType=VARCHAR},
- </if>
- <if test="blueOption != null" >
- #{blueOption,jdbcType=VARCHAR},
- </if>
- <if test="endTime != null" >
- #{endTime,jdbcType=VARCHAR},
- </if>
- <if test="examine != null" >
- #{examine,jdbcType=INTEGER},
- </if>
- <if test="examineNum != null" >
- #{examineNum,jdbcType=INTEGER},
- </if>
- <if test="redTicket != null" >
- #{redTicket,jdbcType=INTEGER},
- </if>
- <if test="blueTicket != null" >
- #{blueTicket,jdbcType=INTEGER},
- </if>
- <if test="adminId != null" >
- #{adminId,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="lead != null and lead != ''" >
- #{lead,jdbcType=LONGVARCHAR},
- </if>
- <if test="redDesc != null and redDesc != ''" >
- #{redDesc,jdbcType=LONGVARCHAR},
- </if>
- <if test="blueDesc != null and blueDesc != ''" >
- #{blueDesc,jdbcType=LONGVARCHAR},
- </if>
- <if test="pkVoteNum != null">
- #{pkVoteNum,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.circle.Topic" >
- update topic
- <set >
- <if test="title != null" >
- title = #{title,jdbcType=VARCHAR},
- </if>
- <if test="pic != null" >
- pic = #{pic,jdbcType=VARCHAR},
- </if>
- <if test="sort != null" >
- sort = #{sort,jdbcType=INTEGER},
- </if>
- <if test="activation != null" >
- activation = #{activation,jdbcType=INTEGER},
- </if>
- <if test="pk != null" >
- pk = #{pk,jdbcType=INTEGER},
- </if>
- <if test="redOption != null" >
- red_option = #{redOption,jdbcType=VARCHAR},
- </if>
- <if test="blueOption != null" >
- blue_option = #{blueOption,jdbcType=VARCHAR},
- </if>
- <if test="endTime != null" >
- end_time = #{endTime,jdbcType=VARCHAR},
- </if>
- <if test="examine != null" >
- examine = #{examine,jdbcType=INTEGER},
- </if>
- <if test="examineNum != null" >
- examine_num = #{examineNum,jdbcType=INTEGER},
- </if>
- <if test="redTicket != null" >
- red_ticket = #{redTicket,jdbcType=INTEGER},
- </if>
- <if test="blueTicket != null" >
- blue_ticket = #{blueTicket,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="lead != null" >
- lead = #{lead,jdbcType=LONGVARCHAR},
- </if>
- <if test="redDesc != null" >
- red_desc = #{redDesc,jdbcType=LONGVARCHAR},
- </if>
- <if test="blueDesc != null" >
- blue_desc = #{blueDesc,jdbcType=LONGVARCHAR},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.circle.Topic" >
- update topic
- set title = #{title,jdbcType=VARCHAR},
- pic = #{pic,jdbcType=VARCHAR},
- sort = #{sort,jdbcType=INTEGER},
- activation = #{activation,jdbcType=INTEGER},
- pk = #{pk,jdbcType=INTEGER},
- red_option = #{redOption,jdbcType=VARCHAR},
- blue_option = #{blueOption,jdbcType=VARCHAR},
- end_time = #{endTime,jdbcType=VARCHAR},
- examine = #{examine,jdbcType=INTEGER},
- examine_num = #{examineNum,jdbcType=INTEGER},
- red_ticket = #{redTicket,jdbcType=INTEGER},
- blue_ticket = #{blueTicket,jdbcType=INTEGER},
- admin_id = #{adminId,jdbcType=INTEGER},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- pk_vote_num = #{pkVoteNum,jdbcType=INTEGER},
- where id = #{id,jdbcType=INTEGER}
- </update>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
- delete from topic
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <select id="selectTopicByPage" resultType="com.juxiao.xchat.module.xbd.vo.TopicVO">
- select t.id, t.title, t.pic, t.sort, t.activation, t.pk, t.red_option as redOption, t.blue_option as blueOption, t.end_time as endTime, t.examine,
- t.examine_num as examineNum, t.red_ticket as redTicket, t.blue_ticket as blueTicket, t.admin_id as adminId, t.create_time as createTime,t.lead,
- t.red_desc as redDesc, t.blue_desc as blueDesc,su.user_name as adminName,t.pk_vote_num as pkVoteNum
- from topic t
- left join sys_user su on t.admin_id = su.user_id
- where 1 = 1
- <if test="title != null and title != ''">
- and t.title LIKE "%"#{title}"%"
- </if>
- <if test="status != null">
- and t.activation = #{status}
- </if>
- <if test="adminName != null and adminName != ''">
- and su.user_name = #{adminName}
- </if>
- order by t.sort asc , t.create_time desc
- </select>
- </mapper>
|