|
@@ -0,0 +1,116 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
+<mapper namespace="com.ym.mec.biz.dal.dao.LuckDrawDao">
|
|
|
+ <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.LuckDrawPrize">
|
|
|
+ <id column="id_" property="id" jdbcType="INTEGER" />
|
|
|
+ <result column="name_" property="name" jdbcType="VARCHAR" />
|
|
|
+ <result column="chances_" property="chances" jdbcType="DOUBLE" />
|
|
|
+ <result column="stock_" property="stock" jdbcType="INTEGER" />
|
|
|
+ <result column="enabled_" property="enabled" jdbcType="BIT" />
|
|
|
+ <result column="reward_type_" property="rewardType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
|
|
|
+ <result column="memo_" property="memo" jdbcType="VARCHAR" />
|
|
|
+ <result column="group_id_" property="groupId" jdbcType="INTEGER" />
|
|
|
+ <result column="create_on_" property="createOn" jdbcType="TIMESTAMP" />
|
|
|
+ <result column="modify_on_" property="modifyOn" jdbcType="TIMESTAMP" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id_, name_, chances_, stock_, enabled_, reward_type_, memo_, group_id_, create_on_, modify_on_
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="queryCondition">
|
|
|
+ <where>
|
|
|
+ <if test="id != null">
|
|
|
+ and id_ = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ and name_ like '%' #{name} '%'
|
|
|
+ </if>
|
|
|
+ <if test="rewardType != null">
|
|
|
+ and reward_type_ like '%' #{rewardType} '%'
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="get" resultMap="BaseResultMap" parameterType="java.lang.Integer">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from luck_draw_prize
|
|
|
+ where id_ = #{id,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getLock" resultMap="BaseResultMap" parameterType="java.lang.Integer">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from luck_draw_prize
|
|
|
+ where id_ = #{id,jdbcType=INTEGER} for update
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <delete id="delete" parameterType="java.lang.Integer">
|
|
|
+ delete from luck_draw_prize
|
|
|
+ where id_ = #{id,jdbcType=INTEGER}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.LuckDrawPrize">
|
|
|
+ insert into luck_draw_prize (id_, name_, chances_,
|
|
|
+ stock_, enabled_, reward_type_, memo_, group_id_, create_on_,
|
|
|
+ modify_on_)
|
|
|
+ values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
|
|
|
+ #{chances,jdbcType=DOUBLE},
|
|
|
+ #{stock,jdbcType=INTEGER}, #{enabled,jdbcType=BIT},#{rewardType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{memo,jdbcType=VARCHAR}, #{groupId,jdbcType=INTEGER}, #{createOn,jdbcType=TIMESTAMP},
|
|
|
+ #{modifyOn,jdbcType=TIMESTAMP})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="update" parameterType="com.ym.mec.biz.dal.entity.LuckDrawPrize">
|
|
|
+ update luck_draw_prize
|
|
|
+ <set>
|
|
|
+ <if test="name != null">
|
|
|
+ name_ = #{name,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="chances != null">
|
|
|
+ chances_ = #{chances,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="stock != null">
|
|
|
+ stock_ = #{stock,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="enabled != null">
|
|
|
+ enabled_ = #{enabled,jdbcType=BIT},
|
|
|
+ </if>
|
|
|
+ <if test="rewardType != null">
|
|
|
+ reward_type_ = #{rewardType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
+ </if>
|
|
|
+ <if test="memo != null">
|
|
|
+ memo_ = #{memo,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="groupId != null">
|
|
|
+ group_id_ = #{groupId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="createOn != null">
|
|
|
+ create_on_ = #{createOn,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="modifyOn != null">
|
|
|
+ modify_on_ = #{modifyOn,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id_ = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="findCount" parameterType="map" resultType="int">
|
|
|
+ select count(*) from luck_draw_prize
|
|
|
+ <include refid="queryCondition" />
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryPage" parameterType="map" resultMap="BaseResultMap">
|
|
|
+ select * from luck_draw_prize
|
|
|
+ <include refid="queryCondition" />
|
|
|
+ <include refid="global.orderby" />
|
|
|
+ <include refid="global.limit" />
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryEnabledList" resultMap="BaseResultMap" parameterType="int">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from luck_draw_prize
|
|
|
+ where enabled_ = 1 and group_id_ = #{group} order by id_ asc
|
|
|
+ </select>
|
|
|
+</mapper>
|