1
zj
2024-06-03 09206aedcfdf30050123e99f2af0a192ebad1de4
src/main/resources/mapper/UserMapper.xml
@@ -24,14 +24,13 @@
        <result column="auth_msg" property="authMsg"/>
        <result column="withdrawal_Pwd" property="withdrawalPwd"/>
        <result column="vaild_number"  property="vaildNumber"/>
        <result column="amt_pwd"  property="amtPwd"/>
    </resultMap>
    <sql id="Base_Column_List">
    id, agent_id, agent_name, phone, user_pwd, with_pwd, nick_name, real_name, id_card, 
    account_type, is_lock, is_login,
    reg_time, reg_ip, reg_address, img1_key, img2_key, img3_key, is_active, auth_msg,
    withdrawal_Pwd,vaild_number,amt_pwd
    withdrawal_Pwd,vaild_number
  </sql>
@@ -40,7 +39,7 @@
        SELECT
        <include refid="Base_Column_List"/>
        FROM user
        WHERE (phone = #{phone} or email = #{phone}) and user_pwd = #{userPwd}
        WHERE phone = #{phone} and user_pwd = #{userPwd}
    </select>
    <select id="listByAgent" resultMap="BaseResultMap" parameterType="map">
@@ -73,6 +72,10 @@
        select count(*) from user where TO_DAYS(reg_time) = TO_DAYS(NOW()) and agent_id = #{id}
    </select>
    <select id="findByPhone" parameterType="string" resultType="com.nq.pojo.User">
        select * from user where phone= #{phone}
    </select>
    <select id="queryAgintSumTodayRegCount"  parameterType="integer"   resultType="int">
        select count(*) from user where agent_id =#{id}   TO_DAYS(reg_time) = TO_DAYS(NOW())
@@ -83,6 +86,9 @@
        <include refid="Base_Column_List"/>
        FROM user
        <where>
            <if test="id != null and id != '' ">
                and id = #{id}
            </if>
            <if test="searchId != null ">
                and agent_id = #{searchId}
            </if>
@@ -97,24 +103,5 @@
            </if>
        </where>
        ORDER BY id DESC
    </select>
    <select id="getMarketValue" parameterType="integer" resultType="decimal">
        select SUM(order_total_price) as marketValue
        from user_position
        where user_id = #{user_id} and sell_order_id is null
    </select>
    <select id="getProfit" parameterType="integer" resultType="Float">
        select
            (select SUM(order_total_price)
             from user_position
             where user_id = #{user_id} and sell_order_id is  null and order_direction='买涨')
                -
            (select SUM(order_total_price) as dsum
             from user_position
             where user_id = #{user_id} and sell_order_id is null and order_direction='买跌'
            ) as profit
    </select>
</mapper>