| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?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.LuckDrawCountDao" >
- <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.LuckDrawCount" >
- <id column="user_id_" property="userId" jdbcType="BIGINT" />
- <result column="used_count_" property="usedCount" jdbcType="INTEGER" />
- <result column="available_count_" property="availableCount" jdbcType="INTEGER" />
- <result column="available_amount_" property="availableAmount" jdbcType="BIGINT" />
- <result column="modify_on_" property="modifyOn" jdbcType="TIMESTAMP" />
- <result column="group_id_" property="groupId"/>
- <result column="tenant_id_" property="tenantId" />
- </resultMap>
- <sql id="Base_Column_List" >
- user_id_, used_count_, available_count_, available_amount_, modify_on_,group_id_,tenant_id_
- </sql>
-
- <select id="get" resultMap="BaseResultMap" parameterType="java.lang.Long" >
- select
- <include refid="Base_Column_List" />
- from luck_draw_count
- where user_id_ = #{userId,jdbcType=BIGINT}
- </select>
-
- <select id="getLock" resultMap="BaseResultMap" parameterType="java.lang.Long" >
- select
- <include refid="Base_Column_List" />
- from luck_draw_count
- where user_id_ = #{userId,jdbcType=BIGINT} for update
- </select>
-
- <select id="findAll" resultMap="BaseResultMap">
- select * from luck_draw_count where tenant_id_ = #{tenantId}
- </select>
- <select id="findByIdAndGroupId" resultMap="BaseResultMap">
- SELECT * FROM luck_draw_count WHERE user_id_ = #{userId} AND group_id_ = #{groupId}
- </select>
- <select id="findLockByIdAndGroupId" resultMap="BaseResultMap">
- SELECT * FROM luck_draw_count WHERE user_id_ = #{userId} AND group_id_ = #{groupId} FOR UPDATE
- </select>
- <delete id="delete" parameterType="java.lang.Long" >
- delete from luck_draw_count
- where user_id_ = #{userId,jdbcType=BIGINT}
- </delete>
-
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.LuckDrawCount" >
- insert into luck_draw_count (user_id_, used_count_, available_count_, available_amount_,
- modify_on_,group_id_,tenant_id_)
- values (#{userId}, #{usedCount}, #{availableCount}, #{availableAmount},
- NOW(),#{groupId},#{tenantId})
- </insert>
-
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.LuckDrawCount" >
- update luck_draw_count
- <set >
- <if test="groupId != null" >
- group_id_ = #{groupId},
- </if>
- <if test="usedCount != null" >
- used_count_ = #{usedCount,jdbcType=INTEGER},
- </if>
- <if test="availableCount != null" >
- available_count_ = #{availableCount,jdbcType=INTEGER},
- </if>
- <if test="availableAmount != null" >
- available_amount_ = #{availableAmount,jdbcType=BIGINT},
- </if>
- <if test="modifyOn != null" >
- modify_on_ = #{modifyOn,jdbcType=TIMESTAMP},
- </if>
- </set>
- where user_id_ = #{userId,jdbcType=BIGINT} and tenant_id_ = #{tenantId}
- </update>
- </mapper>
|