LuckDrawCountMapper.xml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.ym.mec.biz.dal.dao.LuckDrawCountDao" >
  4. <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.LuckDrawCount" >
  5. <id column="user_id_" property="userId" jdbcType="BIGINT" />
  6. <result column="used_count_" property="usedCount" jdbcType="INTEGER" />
  7. <result column="available_count_" property="availableCount" jdbcType="INTEGER" />
  8. <result column="available_amount_" property="availableAmount" jdbcType="BIGINT" />
  9. <result column="modify_on_" property="modifyOn" jdbcType="TIMESTAMP" />
  10. </resultMap>
  11. <sql id="Base_Column_List" >
  12. user_id_, used_count_, available_count_, available_amount_, modify_on_
  13. </sql>
  14. <select id="get" resultMap="BaseResultMap" parameterType="java.lang.Long" >
  15. select
  16. <include refid="Base_Column_List" />
  17. from luck_draw_count
  18. where user_id_ = #{userId,jdbcType=BIGINT}
  19. </select>
  20. <select id="getLock" resultMap="BaseResultMap" parameterType="java.lang.Long" >
  21. select
  22. <include refid="Base_Column_List" />
  23. from luck_draw_count
  24. where user_id_ = #{userId,jdbcType=BIGINT} for update
  25. </select>
  26. <select id="findAll" resultMap="BaseResultMap">
  27. select * from luck_draw_count
  28. </select>
  29. <delete id="delete" parameterType="java.lang.Long" >
  30. delete from luck_draw_count
  31. where user_id_ = #{userId,jdbcType=BIGINT}
  32. </delete>
  33. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.LuckDrawCount" >
  34. insert into luck_draw_count (user_id_, used_count_, available_count_, available_amount_,
  35. modify_on_)
  36. values (#{userId,jdbcType=BIGINT}, #{usedCount,jdbcType=INTEGER}, #{availableCount,jdbcType=INTEGER}, #{availableAmount,jdbcType=BIGINT},
  37. #{modifyOn,jdbcType=TIMESTAMP})
  38. </insert>
  39. <update id="update" parameterType="com.ym.mec.biz.dal.entity.LuckDrawCount" >
  40. update luck_draw_count
  41. <set >
  42. <if test="usedCount != null" >
  43. used_count_ = #{usedCount,jdbcType=INTEGER},
  44. </if>
  45. <if test="availableCount != null" >
  46. available_count_ = #{availableCount,jdbcType=INTEGER},
  47. </if>
  48. <if test="availableAmount != null" >
  49. available_amount_ = #{availableAmount,jdbcType=BIGINT},
  50. </if>
  51. <if test="modifyOn != null" >
  52. modify_on_ = #{modifyOn,jdbcType=TIMESTAMP},
  53. </if>
  54. </set>
  55. where user_id_ = #{userId,jdbcType=BIGINT}
  56. </update>
  57. </mapper>