<?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.sqx.modules.app.dao.UserCashOutDao">

    <select id="findBalanceById" resultType="com.sqx.modules.app.entity.UserEntity">
        select * from tb_user where user_id = #{userId}
    </select>

    <update id="updateMoney">
        update tb_user  set
        <if test="type==1">
            balance=balance+#{money}
        </if>
        <if test="type==2">
            balance=balance-#{money}
        </if>
        where user_id=#{userId}
    </update>

</mapper>