| | |
| | | <?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.ks.goldcorn.mapper.GoldCornBalanceMapper"> |
| | | <resultMap id="BaseResultMap" type="com.ks.goldcorn.pojo/DO.GoldCornBalance"> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="app_id" jdbcType="BIGINT" property="appId" /> |
| | | <result column="uid" jdbcType="VARCHAR" property="uid" /> |
| | | <result column="balance" jdbcType="BIGINT" property="balance" /> |
| | | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
| | | <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <resultMap id="BaseResultMap" type="com.ks.goldcorn.pojo.DO.GoldCornBalance"> |
| | | <id column="id" jdbcType="BIGINT" property="id"/> |
| | | <result column="app_id" jdbcType="BIGINT" property="appId"/> |
| | | <result column="uid" jdbcType="VARCHAR" property="uid"/> |
| | | <result column="balance" jdbcType="BIGINT" property="balance"/> |
| | | <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> |
| | | <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | id, app_id, uid, balance, create_time, update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from ks_balance |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from ks_balance |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByAppIdAndUid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from ks_balance |
| | | where app_id = #{appId} and uid=#{uid} |
| | | </select> |
| | | |
| | | <select id="selectByAppIdAndUidForUpdate" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from ks_balance |
| | | where app_id = #{appId} and uid=#{uid} for update |
| | | </select> |
| | | |
| | | <select id="listByUids" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from ks_balance |
| | | where app_id = #{appId} |
| | | <foreach collection="uidList" item="uid" separator=" or " open=" and (" close=")"> |
| | | uid=#{uid} |
| | | </foreach> |
| | | </select> |
| | | |
| | | <update id="addMoney"> |
| | | update ks_balance set balance=balance+#{money},update_time=now() where id=#{id} |
| | | </update> |
| | | |
| | | <update id="subMoney"> |
| | | update ks_balance set balance=balance-#{money},update_time=now() where id=#{id} |
| | | </update> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | delete from ks_balance |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.ks.goldcorn.pojo/DO.GoldCornBalance"> |
| | | <insert id="insert" parameterType="com.ks.goldcorn.pojo.DO.GoldCornBalance"> |
| | | insert into ks_balance (id, app_id, uid, |
| | | balance, create_time, update_time |
| | | ) |
| | |
| | | #{balance,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.ks.goldcorn.pojo/DO.GoldCornBalance"> |
| | | insert into ks_balance |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="appId != null"> |
| | | app_id, |
| | | </if> |
| | | <if test="uid != null"> |
| | | uid, |
| | | </if> |
| | | <if test="balance != null"> |
| | | balance, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | update_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="appId != null"> |
| | | #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="uid != null"> |
| | | #{uid,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="balance != null"> |
| | | #{balance,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.goldcorn.pojo/DO.GoldCornBalance"> |
| | | update ks_balance |
| | | <set> |
| | | <if test="appId != null"> |
| | | app_id = #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="uid != null"> |
| | | uid = #{uid,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="balance != null"> |
| | | balance = #{balance,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.goldcorn.pojo/DO.GoldCornBalance"> |
| | | update ks_balance |
| | | set app_id = #{appId,jdbcType=BIGINT}, |
| | | uid = #{uid,jdbcType=VARCHAR}, |
| | | balance = #{balance,jdbcType=BIGINT}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <resultMap id="BaseResultMap" type="com.ks.goldcorn.entity.GoldCornBalance"> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="app_id" jdbcType="BIGINT" property="appId" /> |
| | | <result column="uid" jdbcType="VARCHAR" property="uid" /> |
| | | <result column="balance" jdbcType="BIGINT" property="balance" /> |
| | | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
| | | <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | id, app_id, uid, balance, create_time, update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from ks_balance |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | delete from ks_balance |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.ks.goldcorn.entity.GoldCornBalance"> |
| | | insert into ks_balance (id, app_id, uid, |
| | | balance, create_time, update_time |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{appId,jdbcType=BIGINT}, #{uid,jdbcType=VARCHAR}, |
| | | #{balance,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.ks.goldcorn.entity.GoldCornBalance"> |
| | | insert into ks_balance |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="appId != null"> |
| | | app_id, |
| | | </if> |
| | | <if test="uid != null"> |
| | | uid, |
| | | </if> |
| | | <if test="balance != null"> |
| | | balance, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | update_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="appId != null"> |
| | | #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="uid != null"> |
| | | #{uid,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="balance != null"> |
| | | #{balance,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.goldcorn.entity.GoldCornBalance"> |
| | | update ks_balance |
| | | <set> |
| | | <if test="appId != null"> |
| | | app_id = #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="uid != null"> |
| | | uid = #{uid,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="balance != null"> |
| | | balance = #{balance,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.goldcorn.entity.GoldCornBalance"> |
| | | <insert id="insertSelective" parameterType="com.ks.goldcorn.pojo.DO.GoldCornBalance"> |
| | | insert into ks_balance |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="appId != null"> |
| | | app_id, |
| | | </if> |
| | | <if test="uid != null"> |
| | | uid, |
| | | </if> |
| | | <if test="balance != null"> |
| | | balance, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | update_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="appId != null"> |
| | | #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="uid != null"> |
| | | #{uid,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="balance != null"> |
| | | #{balance,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.goldcorn.pojo.DO.GoldCornBalance"> |
| | | update ks_balance |
| | | <set> |
| | | <if test="appId != null"> |
| | | app_id = #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="uid != null"> |
| | | uid = #{uid,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="balance != null"> |
| | | balance = #{balance,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.goldcorn.pojo.DO.GoldCornBalance"> |
| | | update ks_balance |
| | | set app_id = #{appId,jdbcType=BIGINT}, |
| | | uid = #{uid,jdbcType=VARCHAR}, |