LuckDrawGroupMapper.xml 3.3 KB

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