LuckDrawGroupMapper.xml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.LuckDrawGroupDao" >
  4. <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.LuckDrawGroup" >
  5. <id column="id_" property="id" jdbcType="INTEGER" />
  6. <result column="name_" property="name" jdbcType="VARCHAR" />
  7. <result column="consume_type_" property="consumeType" jdbcType="VARCHAR" />
  8. <result column="consume_value_" property="consumeValue" jdbcType="INTEGER" />
  9. <result column="start_time_" property="startTime" jdbcType="TIMESTAMP" />
  10. <result column="end_time_" property="endTime" jdbcType="TIMESTAMP" />
  11. <result column="create_on_" property="createOn" jdbcType="TIMESTAMP" />
  12. </resultMap>
  13. <sql id="Base_Column_List" >
  14. id_, name_, consume_type_, consume_value_, start_time_, end_time_, create_on_
  15. </sql>
  16. <select id="get" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  17. select
  18. <include refid="Base_Column_List" />
  19. from luck_draw_group
  20. where id_ = #{id,jdbcType=INTEGER}
  21. </select>
  22. <select id="findAll" resultMap="BaseResultMap" parameterType="map" >
  23. select * from luck_draw_group
  24. </select>
  25. <delete id="delete" parameterType="java.lang.Integer" >
  26. delete from luck_draw_group
  27. where id_ = #{id,jdbcType=INTEGER}
  28. </delete>
  29. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.LuckDrawGroup" >
  30. insert into luck_draw_group (id_, name_, consume_type_, consume_value_,
  31. start_time_, end_time_, create_on_
  32. )
  33. values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{consumeType,jdbcType=VARCHAR}, #{consumeValue,jdbcType=INTEGER},
  34. #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{createOn,jdbcType=TIMESTAMP}
  35. )
  36. </insert>
  37. <update id="update" parameterType="com.ym.mec.biz.dal.entity.LuckDrawGroup" >
  38. update luck_draw_group
  39. <set >
  40. <if test="name != null" >
  41. name_ = #{name,jdbcType=VARCHAR},
  42. </if>
  43. <if test="consumeType != null" >
  44. consume_type_ = #{consumeType,jdbcType=VARCHAR},
  45. </if>
  46. <if test="consumeValue != null" >
  47. consume_value_ = #{consumeValue,jdbcType=INTEGER},
  48. </if>
  49. <if test="startTime != null" >
  50. start_time_ = #{startTime,jdbcType=TIMESTAMP},
  51. </if>
  52. <if test="endTime != null" >
  53. end_time_ = #{endTime,jdbcType=TIMESTAMP},
  54. </if>
  55. <if test="createOn != null" >
  56. create_on_ = #{createOn,jdbcType=TIMESTAMP},
  57. </if>
  58. </set>
  59. where id_ = #{id,jdbcType=INTEGER}
  60. </update>
  61. <select id="queryCount" parameterType="map" resultType="int">
  62. select count(*) from luck_draw_group
  63. <where>
  64. <if test="search != null">
  65. and name_ like concat('%',#{search},'%')
  66. </if>
  67. </where>
  68. </select>
  69. <select id="queryPage" parameterType="map" resultMap="BaseResultMap">
  70. select * from luck_draw_group
  71. <where>
  72. <if test="search != null">
  73. and name_ like concat('%',#{search},'%')
  74. </if>
  75. </where>
  76. order by create_on_ desc
  77. <include refid="global.limit" />
  78. </select>
  79. </mapper>