MoraConfigMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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.MoraConfigMapper">
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.room.MoraConfig" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="uid" property="uid" jdbcType="BIGINT" />
  7. <result column="start" property="start" jdbcType="VARCHAR" />
  8. <result column="end" property="end" jdbcType="VARCHAR" />
  9. <result column="status" property="status" 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, uid, start, end, status, 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_config
  20. where id = #{id,jdbcType=INTEGER}
  21. </select>
  22. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.room.MoraConfig" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
  23. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  24. SELECT LAST_INSERT_ID()
  25. </selectKey>
  26. insert into mora_config (uid, start, end,
  27. status, create_time, admin_id
  28. )
  29. values (#{uid,jdbcType=BIGINT}, #{start,jdbcType=VARCHAR}, #{end,jdbcType=VARCHAR},
  30. #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{adminId,jdbcType=INTEGER}
  31. )
  32. </insert>
  33. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.room.MoraConfig" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
  34. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  35. SELECT LAST_INSERT_ID()
  36. </selectKey>
  37. insert into mora_config
  38. <trim prefix="(" suffix=")" suffixOverrides="," >
  39. <if test="uid != null" >
  40. uid,
  41. </if>
  42. <if test="start != null" >
  43. start,
  44. </if>
  45. <if test="end != null" >
  46. end,
  47. </if>
  48. <if test="status != null" >
  49. status,
  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="uid != null" >
  60. #{uid,jdbcType=BIGINT},
  61. </if>
  62. <if test="start != null" >
  63. #{start,jdbcType=VARCHAR},
  64. </if>
  65. <if test="end != null" >
  66. #{end,jdbcType=VARCHAR},
  67. </if>
  68. <if test="status != null" >
  69. #{status,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.MoraConfig" >
  80. update mora_config
  81. <set >
  82. <if test="uid != null" >
  83. uid = #{uid,jdbcType=BIGINT},
  84. </if>
  85. <if test="start != null" >
  86. start = #{start,jdbcType=VARCHAR},
  87. </if>
  88. <if test="end != null" >
  89. end = #{end,jdbcType=VARCHAR},
  90. </if>
  91. <if test="status != null" >
  92. status = #{status,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.MoraConfig" >
  104. update mora_config
  105. set uid = #{uid,jdbcType=BIGINT},
  106. start = #{start,jdbcType=VARCHAR},
  107. end = #{end,jdbcType=VARCHAR},
  108. status = #{status,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_config
  115. where id = #{id,jdbcType=INTEGER}
  116. </delete>
  117. <select id="selectByPage" resultType="com.juxiao.xchat.module.xbd.vo.MoraConfVO">
  118. select mc.id,mc.uid,mc.start,mc.end,mc.status,mc.admin_id as adminId,mc.create_time as createTime,u.erban_no as erbanNo,u.nick
  119. from mora_config mc
  120. inner join users u on mc.uid = u.uid
  121. <if test="erBanNo != null and erBanNo != ''">
  122. and u.erban_no = #{erBanNo}
  123. </if>
  124. ORDER BY mc.create_time DESC
  125. </select>
  126. <select id="selectByUid" resultMap="BaseResultMap">
  127. select <include refid="Base_Column_List"/>
  128. from mora_config
  129. where uid = #{uid}
  130. </select>
  131. </mapper>