MoraAwardMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.juxiao.xchat.module.xbd.mapper.room.MoraAwardMapper">
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.room.MoraAward" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="json" property="json" jdbcType="VARCHAR" />
  7. <result column="probability" property="probability" jdbcType="INTEGER" />
  8. <result column="is_use" property="isUse" jdbcType="INTEGER" />
  9. <result column="grade" property="grade" jdbcType="INTEGER" />
  10. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  11. <result column="admin_id" property="adminId" jdbcType="INTEGER" />
  12. </resultMap>
  13. <sql id="Base_Column_List" >
  14. id, json, probability, is_use, grade, create_time, admin_id
  15. </sql>
  16. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  17. select
  18. <include refid="Base_Column_List" />
  19. from mora_award
  20. where id = #{id,jdbcType=INTEGER}
  21. </select>
  22. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.room.MoraAward" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  23. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  24. SELECT LAST_INSERT_ID()
  25. </selectKey>
  26. insert into mora_award (json, probability, is_use,
  27. grade, create_time, admin_id
  28. )
  29. values (#{json,jdbcType=VARCHAR}, #{probability,jdbcType=INTEGER}, #{isUse,jdbcType=INTEGER},
  30. #{grade,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{adminId,jdbcType=INTEGER}
  31. )
  32. </insert>
  33. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.room.MoraAward" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  34. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  35. SELECT LAST_INSERT_ID()
  36. </selectKey>
  37. insert into mora_award
  38. <trim prefix="(" suffix=")" suffixOverrides="," >
  39. <if test="json != null" >
  40. json,
  41. </if>
  42. <if test="probability != null" >
  43. probability,
  44. </if>
  45. <if test="isUse != null" >
  46. is_use,
  47. </if>
  48. <if test="grade != null" >
  49. grade,
  50. </if>
  51. <if test="createTime != null" >
  52. create_time,
  53. </if>
  54. <if test="adminId != null" >
  55. admin_id,
  56. </if>
  57. </trim>
  58. <trim prefix="values (" suffix=")" suffixOverrides="," >
  59. <if test="json != null" >
  60. #{json,jdbcType=VARCHAR},
  61. </if>
  62. <if test="probability != null" >
  63. #{probability,jdbcType=INTEGER},
  64. </if>
  65. <if test="isUse != null" >
  66. #{isUse,jdbcType=INTEGER},
  67. </if>
  68. <if test="grade != null" >
  69. #{grade,jdbcType=INTEGER},
  70. </if>
  71. <if test="createTime != null" >
  72. #{createTime,jdbcType=TIMESTAMP},
  73. </if>
  74. <if test="adminId != null" >
  75. #{adminId,jdbcType=INTEGER},
  76. </if>
  77. </trim>
  78. </insert>
  79. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.room.MoraAward" >
  80. update mora_award
  81. <set >
  82. <if test="json != null" >
  83. json = #{json,jdbcType=VARCHAR},
  84. </if>
  85. <if test="probability != null" >
  86. probability = #{probability,jdbcType=INTEGER},
  87. </if>
  88. <if test="isUse != null" >
  89. is_use = #{isUse,jdbcType=INTEGER},
  90. </if>
  91. <if test="grade != null" >
  92. grade = #{grade,jdbcType=INTEGER},
  93. </if>
  94. <if test="createTime != null" >
  95. create_time = #{createTime,jdbcType=TIMESTAMP},
  96. </if>
  97. <if test="adminId != null" >
  98. admin_id = #{adminId,jdbcType=INTEGER},
  99. </if>
  100. </set>
  101. where id = #{id,jdbcType=INTEGER}
  102. </update>
  103. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.room.MoraAward" >
  104. update mora_award
  105. set json = #{json,jdbcType=VARCHAR},
  106. probability = #{probability,jdbcType=INTEGER},
  107. is_use = #{isUse,jdbcType=INTEGER},
  108. grade = #{grade,jdbcType=INTEGER},
  109. create_time = #{createTime,jdbcType=TIMESTAMP},
  110. admin_id = #{adminId,jdbcType=INTEGER}
  111. where id = #{id,jdbcType=INTEGER}
  112. </update>
  113. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  114. delete from mora_award
  115. where id = #{id,jdbcType=INTEGER}
  116. </delete>
  117. <select id="selectByIsUse" resultType="java.lang.Integer">
  118. select count(1) from mora_award where probability = #{probability}
  119. </select>
  120. <select id="selectByPage" resultType="com.juxiao.xchat.module.xbd.vo.MoraAwardVO">
  121. select id,json,probability,is_use as isUse,grade,create_time as createTime,admin_id as adminId
  122. from mora_award
  123. where 1 = 1
  124. <if test="probability != null">
  125. and probability = #{probability}
  126. </if>
  127. ORDER BY create_time DESC
  128. </select>
  129. <update id="updateIsUseByProbability">
  130. update mora_award set is_use = #{isUse} where probability = #{probability}
  131. </update>
  132. </mapper>