123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <?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.room.MoraAwardMapper">
- <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.room.MoraAward" >
- <id column="id" property="id" jdbcType="INTEGER" />
- <result column="json" property="json" jdbcType="VARCHAR" />
- <result column="probability" property="probability" jdbcType="INTEGER" />
- <result column="is_use" property="isUse" jdbcType="INTEGER" />
- <result column="grade" property="grade" jdbcType="INTEGER" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="admin_id" property="adminId" jdbcType="INTEGER" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, json, probability, is_use, grade, create_time, admin_id
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
- select
- <include refid="Base_Column_List" />
- from mora_award
- where id = #{id,jdbcType=INTEGER}
- </select>
- <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.room.MoraAward" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into mora_award (json, probability, is_use,
- grade, create_time, admin_id
- )
- values (#{json,jdbcType=VARCHAR}, #{probability,jdbcType=INTEGER}, #{isUse,jdbcType=INTEGER},
- #{grade,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{adminId,jdbcType=INTEGER}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.room.MoraAward" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
- SELECT LAST_INSERT_ID()
- </selectKey>
- insert into mora_award
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="json != null" >
- json,
- </if>
- <if test="probability != null" >
- probability,
- </if>
- <if test="isUse != null" >
- is_use,
- </if>
- <if test="grade != null" >
- grade,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- <if test="adminId != null" >
- admin_id,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="json != null" >
- #{json,jdbcType=VARCHAR},
- </if>
- <if test="probability != null" >
- #{probability,jdbcType=INTEGER},
- </if>
- <if test="isUse != null" >
- #{isUse,jdbcType=INTEGER},
- </if>
- <if test="grade != null" >
- #{grade,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="adminId != null" >
- #{adminId,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.room.MoraAward" >
- update mora_award
- <set >
- <if test="json != null" >
- json = #{json,jdbcType=VARCHAR},
- </if>
- <if test="probability != null" >
- probability = #{probability,jdbcType=INTEGER},
- </if>
- <if test="isUse != null" >
- is_use = #{isUse,jdbcType=INTEGER},
- </if>
- <if test="grade != null" >
- grade = #{grade,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="adminId != null" >
- admin_id = #{adminId,jdbcType=INTEGER},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.room.MoraAward" >
- update mora_award
- set json = #{json,jdbcType=VARCHAR},
- probability = #{probability,jdbcType=INTEGER},
- is_use = #{isUse,jdbcType=INTEGER},
- grade = #{grade,jdbcType=INTEGER},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- admin_id = #{adminId,jdbcType=INTEGER}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
- delete from mora_award
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <select id="selectByIsUse" resultType="java.lang.Integer">
- select count(1) from mora_award where probability = #{probability}
- </select>
- <select id="selectByPage" resultType="com.juxiao.xchat.module.xbd.vo.MoraAwardVO">
- select id,json,probability,is_use as isUse,grade,create_time as createTime,admin_id as adminId
- from mora_award
- where 1 = 1
- <if test="probability != null">
- and probability = #{probability}
- </if>
- ORDER BY create_time DESC
- </select>
- <update id="updateIsUseByProbability">
- update mora_award set is_use = #{isUse} where probability = #{probability}
- </update>
- </mapper>
|