PointPkMapper.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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.activity.PointPkMapper" >
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.activity.PointPk" >
  5. <id column="id" property="id" jdbcType="BIGINT" />
  6. <result column="term" property="term" jdbcType="INTEGER" />
  7. <result column="title" property="title" jdbcType="VARCHAR" />
  8. <result column="red_answer" property="redAnswer" jdbcType="VARCHAR" />
  9. <result column="blue_answer" property="blueAnswer" jdbcType="VARCHAR" />
  10. <result column="red_pic" property="redPic" jdbcType="VARCHAR" />
  11. <result column="blue_pic" property="bluePic" jdbcType="VARCHAR" />
  12. <result column="red_polls" property="redPolls" jdbcType="INTEGER" />
  13. <result column="blue_polls" property="bluePolls" jdbcType="INTEGER" />
  14. <result column="lottery_time" property="lotteryTime" jdbcType="TIMESTAMP" />
  15. <result column="carve_up_mcoin_num" property="carveUpMcoinNum" jdbcType="INTEGER" />
  16. <result column="pk_status" property="pkStatus" jdbcType="BIT" />
  17. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  18. <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
  19. </resultMap>
  20. <sql id="Base_Column_List" >
  21. id, term, title, red_answer, blue_answer, red_pic, blue_pic, red_polls, blue_polls,
  22. lottery_time, carve_up_mcoin_num, pk_status, create_time, update_time
  23. </sql>
  24. <select id="getPointPkList" resultMap="BaseResultMap">
  25. select
  26. <include refid="Base_Column_List" />
  27. from mcoin_pk_info
  28. <where>
  29. <if test="term != null">
  30. and term = #{term}
  31. </if>
  32. <if test="pkStatus != null">
  33. and pk_status = #{pkStatus}
  34. </if>
  35. </where>
  36. </select>
  37. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.activity.PointPk" >
  38. insert into mcoin_pk_info (id, term, title,
  39. red_answer, blue_answer, red_pic,
  40. blue_pic, red_polls, blue_polls,
  41. lottery_time, carve_up_mcoin_num, pk_status,
  42. create_time, update_time)
  43. values ((select AUTO_INCREMENT from information_schema.tables where table_name='mcoin_pk_info'),id, #{title,jdbcType=VARCHAR},
  44. #{redAnswer,jdbcType=VARCHAR}, #{blueAnswer,jdbcType=VARCHAR}, #{redPic,jdbcType=VARCHAR},
  45. #{bluePic,jdbcType=VARCHAR}, #{redPolls,jdbcType=INTEGER}, #{bluePolls,jdbcType=INTEGER},
  46. #{lotteryTime,jdbcType=TIMESTAMP}, #{carveUpMcoinNum,jdbcType=INTEGER}, #{pkStatus,jdbcType=BIT},
  47. #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
  48. </insert>
  49. <select id="selectByPkStatus" resultMap="BaseResultMap" parameterType="java.lang.Byte" >
  50. select
  51. <include refid="Base_Column_List" />
  52. from mcoin_pk_info
  53. where pk_status = #{pkStatus,jdbcType=BIT} limit 1
  54. </select>
  55. <select id="selectById" resultMap="BaseResultMap" parameterType="java.lang.Long" >
  56. select
  57. <include refid="Base_Column_List" />
  58. from mcoin_pk_info
  59. where id = #{id,jdbcType=BIGINT} limit 1
  60. </select>
  61. <update id="updateById" parameterType="com.juxiao.xchat.module.xbd.domain.activity.PointPk" >
  62. update mcoin_pk_info
  63. set
  64. title = #{title,jdbcType=VARCHAR},
  65. red_answer = #{redAnswer,jdbcType=VARCHAR},
  66. blue_answer = #{blueAnswer,jdbcType=VARCHAR},
  67. red_pic = #{redPic,jdbcType=VARCHAR},
  68. blue_pic = #{bluePic,jdbcType=VARCHAR},
  69. lottery_time = #{lotteryTime,jdbcType=TIMESTAMP},
  70. pk_status = #{pkStatus,jdbcType=BIT},
  71. update_time = now()
  72. where id = #{id,jdbcType=BIGINT}
  73. </update>
  74. </mapper>